Kural İhlali
Moderatör: Moderatörler
-
İmam-POWER
Konu Sahibi - Mesajlar: 1045
- Kayıt: Pzr Oca 28, 2018 11:45 pm
- Konum: SAMSUNLUYUZ
Kural İhlali
Kural İhlali var. Yardımcı olur musunuz ?
Bu mesaja eklenen dosyaları görüntülemek için gerekli izinlere sahip değilsiniz.
| Link: | |
| Linklerini gizle |
-
amad
- Mesajlar: 1809
- Kayıt: Cmt Nis 30, 2016 2:46 pm
- Konum: Batman
- Clan İsmi: Ke$`h | Gaming
- İletişim:
Kural İhlali
Yorum satırlarındaki plugins.ini yazısında kural ihlali vardı. Başlangıçtaki tüm yorum satırlarını kaldırdım bir de öyle dene.
Kod: Tümünü seç
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN_NAME "Custom Sniper Scopes"
#define PLUGIN_VERSION "1.5"
#define PLUGIN_AUTHOR "Numb"
#define SetPlayerBit(%1,%2) ( %1 |= ( 1 << ( %2 & 31 ) ) )
#define ClearPlayerBit(%1,%2) ( %1 &= ~( 1 << ( %2 & 31 ) ) )
#define CheckPlayerBit(%1,%2) ( %1 & ( 1 << ( %2 & 31 ) ) )
#define m_pPlayer 41
#define m_iId 43
#define m_iClip 51
#define m_pActiveItem 373
new g_iAWPFileName[64];
new g_iScoutFileName[64];
new g_iG3SG1FileName[64];
new g_iSG550FileName[64];
new bool:g_bNoErrorSG552;
new bool:g_bNoErrorAUG;
new g_iFatalError;
new g_iCustomAWP;
new g_iCustomScout;
new g_iCustomG3SG1;
new g_iCustomSG550;
new g_iCustomSG552;
new g_iCustomAUG;
new g_iShouldUpdate;
new g_iShouldPrint;
new g_iLastSpectated[33];
new g_iInfoDir[256];
new g_iCustomInfoDir[256];
new g_iMsgId_CurWeapon;
new g_iMsgId_WeaponList;
new bool:g_bCustomAWP;
new bool:g_bCustomScout;
new bool:g_bCustomG3SG1;
new bool:g_bCustomSG550;
new bool:g_bCustomSG552;
new bool:g_bCustomAUG;
public plugin_precache()
{
new iIpAddress[16], iSpriteAWP[32], iSpriteScout[32], iSpriteG3SG1[32], iSpriteSG550[32], iLen;
get_user_ip(0, iIpAddress, 15, 1);
replace_all(iIpAddress, 15, ".", "_");
if( 0<(iLen=get_datadir(g_iInfoDir, 127))<127 )
copy(g_iInfoDir[iLen], (255-iLen), "/custom_sniper_scopes/");
else
copy(g_iInfoDir, 255, "custom_sniper_scopes/");
if( !dir_exists(g_iInfoDir) )
{
if( !mkdir(g_iInfoDir) )
{
g_iFatalError = 3;
return;
}
}
new iConfig[256];
if( 0<(iLen=get_configsdir(iConfig, 127))<127 )
iLen += copy(iConfig[iLen], 255-iLen, "/sniper_scopes/");
else
iLen = copy(iConfig, 255, "sniper_scopes/");
if( !dir_exists(iConfig) )
{
if( !mkdir(iConfig) )
{
g_iFatalError = 2;
return;
}
}
new iCvarText[32];
if( get_pcvar_string(register_cvar("sniper_scopes_custom_ini", ""), iCvarText, 31) )
{
if( equali(iCvarText, "main") )
copy(iConfig[iLen], (255-iLen), "main.ini");
else
{
formatex(iConfig[iLen], (255-iLen), "%s.ini", iCvarText);
if( !file_exists(iConfig) )
{
log_amx("Could not find ^"%s^" file. Loading default one.", iConfig);
iLen += copy(iConfig[iLen], (255-iLen), "main.ini");
copy(iConfig[iLen], (255-iLen), "");
}
else
{
formatex(g_iCustomInfoDir, 255, "%s%s/", g_iInfoDir, iCvarText);
if( !dir_exists(g_iCustomInfoDir) )
{
if( !mkdir(g_iCustomInfoDir) )
{
iLen += copy(iConfig[iLen], (255-iLen), "main.ini");
copy(iConfig[iLen], (255-iLen), "");
g_iCustomInfoDir[0] = 0;
}
}
}
}
}
else
copy(iConfig[iLen], (255-iLen), "main.ini");
iLen = 0;
if( file_exists(iConfig) )
{
new iFileIdRead = fopen(iConfig, "rt");
if( iFileIdRead )
{
new iBuffer[64], bool:bFound[6];
while( (iLen=fgets(iFileIdRead, iBuffer, 63))>0 )
{
iLen -= trim(iBuffer);
if( iLen<3 || iBuffer[0]==';' )
continue;
if( !bFound[0] && (equali(iBuffer, "awp ", 4) || equali(iBuffer, "awp")) )
{
bFound[0] = true;
parse(iBuffer, "", 0, iSpriteAWP, 31);
if( iSpriteAWP[0] )
g_bCustomAWP = true;
}
else if( !bFound[1] && (equali(iBuffer, "scout ", 6) || equali(iBuffer, "scout")) )
{
bFound[1] = true;
parse(iBuffer, "", 0, iSpriteScout, 31);
if( iSpriteScout[0] )
g_bCustomScout = true;
}
else if( !bFound[2] && (equali(iBuffer, "g3sg1 ", 6) || equali(iBuffer, "g3sg1")) )
{
bFound[2] = true;
parse(iBuffer, "", 0, iSpriteG3SG1, 31);
if( iSpriteG3SG1[0] )
g_bCustomG3SG1 = true;
}
else if( !bFound[3] && (equali(iBuffer, "sg550 ", 6) || equali(iBuffer, "sg550")) )
{
bFound[3] = true;
parse(iBuffer, "", 0, iSpriteSG550, 31);
if( iSpriteSG550[0] )
g_bCustomSG550 = true;
}
else if( !bFound[4] && (equali(iBuffer, "sg552 ", 6) || equali(iBuffer, "sg552")) )
{
bFound[4] = true;
g_bCustomSG552 = true;
}
else if( !bFound[5] && (equali(iBuffer, "aug ", 4) || equali(iBuffer, "aug")) )
{
bFound[5] = true;
g_bCustomAUG = true;
}
else if( !bFound[4] && (equali(iBuffer, "/sg552 ", 7) || equali(iBuffer, "/sg552")) )
bFound[4] = true;
else if( !bFound[5] && (equali(iBuffer, "/aug ", 5) || equali(iBuffer, "/aug")) )
bFound[5] = true;
copy(iBuffer, 63, "");
}
fclose(iFileIdRead);
if( !bFound[0] || !bFound[1] || !bFound[2] || !bFound[3] || !bFound[4] || !bFound[5] )
{
new iFileFix[256]
copy(iFileFix, 255, "^n^n^n");
if( !bFound[0] )
add(iFileFix, 255, "^nAWP ^"^"");
if( !bFound[1] )
add(iFileFix, 255, "^nSCOUT ^"^"");
if( !bFound[2] )
add(iFileFix, 255, "^nG3SG1 ^"^"");
if( !bFound[3] )
add(iFileFix, 255, "^nSG550 ^"^"");
if( !bFound[4] )
add(iFileFix, 255, "^n/SG552");
if( !bFound[5] )
add(iFileFix, 255, "^n/AUG");
add(iFileFix, 255, "^n^n; Config errors have been found and auto-fixed. For readme on how to");
add(iFileFix, 255, "^n; configure scopes properly, please delete this file; at map change");
add(iFileFix, 255, "^n; the default one will be generated with readme inside of it.");
write_file(iConfig, iFileFix);
}
}
else
{
g_iFatalError = 1;
return;
}
}
else
{
new iBuffer[2048];
iLen = copy(iBuffer, 2047, "; Here you can set up custom sniper scopes.^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; Game uses sprites for sniper scopes, and so does this plugin.^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; To change the scope you must select a valid sprite file.^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; However do not put ^"sprites/^" prefix nor ^".spr^" ending in this^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; config.^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; In order for files not to repeat themselves on the client,^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; plugin will copy them to a different name what shall be unique^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; only to your server ip. However do not remove the original ones.^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; If you want to use the ones what came with the plugin, just put^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; ^"*^" as the sprite name. If you do not want weapon to have a^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; custom scope, than put ^"^" as the sprite name.^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; SG552 and AUG scopes cannot be changed, but can be disabled by^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; adding a slash (/) before their names.^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; But remember, all players have the ability to disable custom^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; scopes for themselves. Also clients personal configurations^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; about custom scopes are saved on the server.^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; If you'll be creating custom sprites be sure to know:^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; Sprite type should be ^"vp_parallel^".^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; Sprite format should be ^"alphatest^".^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; Sprite size should be 256x256.^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; While color (255 255 255) is transparent.^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; Examples:^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; AWP ^"*^" ; use original custom scope^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; SCOUT ^"some_custom_scope^" ; use ^"sprites/some_custom_scope.spr^"^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; G3SG1 ^"^" ; leave CS original^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; SG550 ^"^" ; leave CS original^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; /SG552 ; leave CS original^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; AUG ; use custom one^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; Have fun and good luck. :)^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "; Default:^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";AWP ^"*^"^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";SCOUT ^"*^"^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";G3SG1 ^"*^"^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";SG550 ^"*^"^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";SG552^n");
iLen += copy(iBuffer[iLen], (2047-iLen), ";AUG^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "AWP ^"^"^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "SCOUT ^"^"^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "G3SG1 ^"^"^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "SG550 ^"^"^n");
iLen += copy(iBuffer[iLen], (2047-iLen), "/SG552^n");
copy(iBuffer[iLen], (2047-iLen), "/AUG");
write_file(iConfig, iBuffer);
}
#define AWP_CONFIG "14^n\
weapon 320 320hud1 80 120 80 20^n\
weapon_s 320 320hud1 80 140 80 20^n\
ammo 320 640hud7 24 96 24 24^n\
%s^n\
weapon 640 640hud2 0 135 170 45^n\
weapon_s 640 640hud5 0 135 170 45^n\
ammo 640 640hud7 24 96 24 24^n\
%s"
if( g_bCustomAWP )
{
if( configurate(iSpriteAWP, "awp", AWP_CONFIG, iIpAddress, g_iAWPFileName, 63) )
register_clcmd(g_iAWPFileName, "clcmd_fix_awp");
}
#define SCOUT_CONFIG "14^n\
weapon 320 320hud1 0 80 80 20^n\
weapon_s 320 320hud1 0 100 80 20^n\
ammo 320 640hud7 72 72 24 24^n\
%s^n\
weapon 640 640hud12 0 45 170 45^n\
weapon_s 640 640hud13 0 45 170 45^n\
ammo 640 640hud7 72 72 24 24^n\
%s"
if( g_bCustomScout )
{
if( configurate(iSpriteScout, "scout", SCOUT_CONFIG, iIpAddress, g_iScoutFileName, 63) )
register_clcmd(g_iScoutFileName, "clcmd_fix_scout");
}
#define G3SG1_CONFIG "14^n\
weapon 320 320hud1 80 160 80 20^n\
weapon_s 320 320hud1 80 180 80 20^n\
ammo 320 640hud7 72 72 24 24^n\
%s^n\
weapon 640 640hud2 0 180 170 45^n\
weapon_s 640 640hud5 0 180 170 45^n\
ammo 640 640hud7 72 72 24 24^n\
%s"
if( g_bCustomG3SG1 )
{
if( configurate(iSpriteG3SG1, "g3sg1", G3SG1_CONFIG, iIpAddress, g_iG3SG1FileName, 63) )
register_clcmd(g_iG3SG1FileName, "clcmd_fix_g3sg1");
}
#define SG550_CONFIG "14^n\
weapon 320 320hud2 160 168 80 20^n\
weapon_s 320 320hud2 160 188 80 20^n\
ammo 320 640hud7 0 96 24 24^n\
%s^n\
weapon 640 640hud14 0 180 170 45^n\
weapon_s 640 640hud15 0 180 170 45^n\
ammo 640 640hud7 0 96 24 24^n\
%s"
if( g_bCustomSG550 )
{
if( configurate(iSpriteSG550, "sg550", SG550_CONFIG, iIpAddress, g_iSG550FileName, 63) )
register_clcmd(g_iSG550FileName, "clcmd_fix_sg550");
}
#define SG552_CONFIG "10^n\
weapon 320 320hud1 80 80 80 20^n\
weapon_s 320 320hud1 80 100 80 20^n\
ammo 320 640hud7 0 96 24 24^n\
crosshair 320 crosshairs 48 48 24 24^n\
autoaim 320 crosshairs 0 72 24 24^n\
weapon 640 640hud10 0 45 170 45^n\
weapon_s 640 640hud11 0 45 170 45^n\
ammo 640 640hud7 0 96 24 24^n\
crosshair 640 crosshairs 48 48 24 24^n\
autoaim 640 crosshairs 0 72 24 24"
if( g_bCustomSG552 )
{
if( (g_bNoErrorSG552=check_mini_scope("sprites/weapon_sg552_numb.txt", SG552_CONFIG)) )
register_clcmd("weapon_sg552_numb", "clcmd_fix_sg552");
}
#define AUG_CONFIG "10^n\
weapon 320 320hud2 80 168 80 20^n\
weapon_s 320 320hud2 80 188 80 20^n\
ammo 320 640hud7 0 96 24 24^n\
crosshair 320 crosshairs 48 48 24 24^n\
autoaim 320 crosshairs 0 72 24 24^n\
weapon 640 640hud14 0 45 170 45^n\
weapon_s 640 640hud15 0 45 170 45^n\
ammo 640 640hud7 0 96 24 24^n\
crosshair 640 crosshairs 48 48 24 24^n\
autoaim 640 crosshairs 0 72 24 24"
if( g_bCustomAUG )
{
if( (g_bNoErrorAUG=check_mini_scope("sprites/weapon_aug_numb.txt", AUG_CONFIG)) )
register_clcmd("weapon_aug_numb", "clcmd_fix_aug");
}
}
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_event("TextMsg", "Event_ResetInfo", "bd", "1=4", "2=#Spec_Mode1");
register_event("TextMsg", "Event_ResetInfo", "bd", "1=4", "2=#Spec_Mode2");
register_event("TextMsg", "Event_ResetInfo", "bd", "1=4", "2=#Spec_Mode3");
register_event("TextMsg", "Event_ResetInfo", "bd", "1=4", "2=#Spec_Mode5");
register_event("TextMsg", "Event_ResetInfo", "bd", "1=4", "2=#Spec_Mode6");
register_event("ResetHUD", "Event_ResetInfo", "be");
register_message((g_iMsgId_CurWeapon=get_user_msgid("CurWeapon")), "Message_CurWeapon");
register_menucmd(register_menuid("Custom Scopes"), 1023, "Menu_Select_Scopes");
register_clcmd("say /scope", "clcmd_scope", ADMIN_ALL, " - menu to change your sniper scopes");
if( g_iAWPFileName[0] )
RegisterHam(Ham_Item_AttachToPlayer, "weapon_awp", "Ham_AttachToPlayer_Post", 1);
if( g_iScoutFileName[0] )
RegisterHam(Ham_Item_AttachToPlayer, "weapon_scout", "Ham_AttachToPlayer_Post", 1);
if( g_iG3SG1FileName[0] )
RegisterHam(Ham_Item_AttachToPlayer, "weapon_g3sg1", "Ham_AttachToPlayer_Post", 1);
if( g_iSG550FileName[0] )
RegisterHam(Ham_Item_AttachToPlayer, "weapon_sg550", "Ham_AttachToPlayer_Post", 1);
if( g_bNoErrorSG552 )
RegisterHam(Ham_Item_AttachToPlayer, "weapon_sg552", "Ham_AttachToPlayer_Post", 1);
if( g_bNoErrorAUG )
RegisterHam(Ham_Item_AttachToPlayer, "weapon_aug", "Ham_AttachToPlayer_Post", 1);
RegisterHam(Ham_Spawn, "player", "Ham_Spawn_player_Pre", 0);
g_iMsgId_WeaponList = get_user_msgid("WeaponList");
}
public plugin_pause()
{
new iPlayers[32], iPlayerNum, iPlrId;
get_players(iPlayers, iPlayerNum, "ch");
for( new iPlayer; iPlayer<iPlayerNum; iPlayer++ )
{
iPlrId = iPlayers[iPlayer];
if( CheckPlayerBit(g_iShouldUpdate, iPlrId) )
continue;
if( CheckPlayerBit(g_iCustomAWP, iPlrId) )
send_awp(iPlrId, true);
if( CheckPlayerBit(g_iCustomScout, iPlrId) )
send_scout(iPlrId, true);
if( CheckPlayerBit(g_iCustomG3SG1, iPlrId) )
send_g3sg1(iPlrId, true);
if( CheckPlayerBit(g_iCustomSG550, iPlrId) )
send_sg550(iPlrId, true);
if( CheckPlayerBit(g_iCustomSG552, iPlrId) )
send_sg552(iPlrId, true);
if( CheckPlayerBit(g_iCustomAUG, iPlrId) )
send_aug(iPlrId, true);
}
g_iCustomAWP = 0;
g_iCustomScout = 0;
g_iCustomG3SG1 = 0;
g_iCustomSG550 = 0;
g_iCustomSG552 = 0;
g_iCustomAUG = 0;
g_iShouldUpdate = 0;
}
public plugin_unpause()
{
new iPlayers[32], iPlayerNum, iPlrId;
get_players(iPlayers, iPlayerNum, "ch");
for( new iPlayer; iPlayer<iPlayerNum; iPlayer++ )
{
iPlrId = iPlayers[iPlayer];
load_data(iPlrId);
if( CheckPlayerBit(g_iCustomAWP, iPlrId) )
send_awp(iPlrId);
if( CheckPlayerBit(g_iCustomScout, iPlrId) )
send_scout(iPlrId);
if( CheckPlayerBit(g_iCustomG3SG1, iPlrId) )
send_g3sg1(iPlrId);
if( CheckPlayerBit(g_iCustomSG550, iPlrId) )
send_sg550(iPlrId);
if( CheckPlayerBit(g_iCustomSG552, iPlrId) )
send_sg552(iPlrId);
if( CheckPlayerBit(g_iCustomAUG, iPlrId) )
send_aug(iPlrId);
g_iLastSpectated[iPlrId] = 0;
}
}
public client_putinserver(iPlrId)
{
if( !is_user_hltv(iPlrId) && !is_user_bot(iPlrId) )
{
load_data(iPlrId);
SetPlayerBit(g_iShouldUpdate, iPlrId);
}
g_iLastSpectated[iPlrId] = 0;
}
public client_disconnect(iPlrId)
{
ClearPlayerBit(g_iCustomAWP, iPlrId);
ClearPlayerBit(g_iCustomScout, iPlrId);
ClearPlayerBit(g_iCustomG3SG1, iPlrId);
ClearPlayerBit(g_iCustomSG550, iPlrId);
ClearPlayerBit(g_iCustomSG552, iPlrId);
ClearPlayerBit(g_iCustomAUG, iPlrId);
ClearPlayerBit(g_iShouldUpdate, iPlrId);
g_iLastSpectated[iPlrId] = 0;
}
public Event_ResetInfo(iPlrId)
g_iLastSpectated[iPlrId] = 0;
public Message_CurWeapon(iMsgId, iMsgType, iPlrId)
{
if( CheckPlayerBit(g_iShouldUpdate, iPlrId) )
{
ClearPlayerBit(g_iShouldUpdate, iPlrId);
if( CheckPlayerBit(g_iCustomAWP, iPlrId) )
send_awp(iPlrId, false, false);
if( CheckPlayerBit(g_iCustomScout, iPlrId) )
send_scout(iPlrId, false, false);
if( CheckPlayerBit(g_iCustomG3SG1, iPlrId) )
send_g3sg1(iPlrId, false, false);
if( CheckPlayerBit(g_iCustomSG550, iPlrId) )
send_sg550(iPlrId, false, false);
if( CheckPlayerBit(g_iCustomSG552, iPlrId) )
send_sg552(iPlrId, false, false);
if( CheckPlayerBit(g_iCustomAUG, iPlrId) )
send_aug(iPlrId, false, false);
}
if( get_msg_arg_int(1) )
{
static s_iSpectated;
s_iSpectated = pev(iPlrId, pev_iuser2);
switch( get_msg_arg_int(2) )
{
case CSW_AWP:
{
if( g_iAWPFileName[0] && s_iSpectated!=g_iLastSpectated[iPlrId] )
{
g_iLastSpectated[iPlrId] = s_iSpectated;
print_message(iPlrId);
}
}
case CSW_SCOUT:
{
if( g_iScoutFileName[0] && s_iSpectated!=g_iLastSpectated[iPlrId] )
{
g_iLastSpectated[iPlrId] = s_iSpectated;
print_message(iPlrId);
}
}
case CSW_G3SG1:
{
if( g_iG3SG1FileName[0] && s_iSpectated!=g_iLastSpectated[iPlrId] )
{
g_iLastSpectated[iPlrId] = s_iSpectated;
print_message(iPlrId);
}
}
case CSW_SG550:
{
if( g_iAWPFileName[0] && s_iSpectated!=g_iLastSpectated[iPlrId] )
{
g_iLastSpectated[iPlrId] = s_iSpectated;
print_message(iPlrId);
}
}
default:
{
if( s_iSpectated!=g_iLastSpectated[iPlrId] )
g_iLastSpectated[iPlrId] = 0;
}
}
}
}
public clcmd_fix_awp(iPlrId)
{
if( CheckPlayerBit(g_iCustomAWP, iPlrId) && !CheckPlayerBit(g_iShouldUpdate, iPlrId) )
engclient_cmd(iPlrId, "weapon_awp");
}
public clcmd_fix_scout(iPlrId)
{
if( CheckPlayerBit(g_iCustomScout, iPlrId) && !CheckPlayerBit(g_iShouldUpdate, iPlrId) )
engclient_cmd(iPlrId, "weapon_scout");
}
public clcmd_fix_g3sg1(iPlrId)
{
if( CheckPlayerBit(g_iCustomG3SG1, iPlrId) && !CheckPlayerBit(g_iShouldUpdate, iPlrId) )
engclient_cmd(iPlrId, "weapon_g3sg1");
}
public clcmd_fix_sg550(iPlrId)
{
if( CheckPlayerBit(g_iCustomSG550, iPlrId) && !CheckPlayerBit(g_iShouldUpdate, iPlrId) )
engclient_cmd(iPlrId, "weapon_sg550");
}
public clcmd_fix_sg552(iPlrId)
{
if( CheckPlayerBit(g_iCustomSG552, iPlrId) && !CheckPlayerBit(g_iShouldUpdate, iPlrId) )
engclient_cmd(iPlrId, "weapon_sg552");
}
public clcmd_fix_aug(iPlrId)
{
if( CheckPlayerBit(g_iCustomAUG, iPlrId) && !CheckPlayerBit(g_iShouldUpdate, iPlrId) )
engclient_cmd(iPlrId, "weapon_aug");
}
public clcmd_scope(iPlrId)
{
if( CheckPlayerBit(g_iShouldUpdate, iPlrId) )
{
ClearPlayerBit(g_iShouldUpdate, iPlrId);
if( CheckPlayerBit(g_iCustomAWP, iPlrId) )
send_awp(iPlrId, false, false);
if( CheckPlayerBit(g_iCustomScout, iPlrId) )
send_scout(iPlrId, false, false);
if( CheckPlayerBit(g_iCustomG3SG1, iPlrId) )
send_g3sg1(iPlrId, false, false);
if( CheckPlayerBit(g_iCustomSG550, iPlrId) )
send_sg550(iPlrId, false, false);
if( CheckPlayerBit(g_iCustomSG552, iPlrId) )
send_sg552(iPlrId, false, false);
if( CheckPlayerBit(g_iCustomAUG, iPlrId) )
send_aug(iPlrId, false, false);
}
Menu_Open_Scope(iPlrId);
}
public Menu_Select_Scopes(iPlrId, iKey)
{
switch( iKey )
{
case 0: send_awp(iPlrId, (CheckPlayerBit(g_iCustomAWP, iPlrId)?true:false));
case 1: send_scout(iPlrId, (CheckPlayerBit(g_iCustomScout, iPlrId)?true:false));
case 2: send_g3sg1(iPlrId, (CheckPlayerBit(g_iCustomG3SG1, iPlrId)?true:false));
case 3: send_sg550(iPlrId, (CheckPlayerBit(g_iCustomSG550, iPlrId)?true:false));
case 4: send_sg552(iPlrId, (CheckPlayerBit(g_iCustomSG552, iPlrId)?true:false));
case 5: send_aug(iPlrId, (CheckPlayerBit(g_iCustomAUG, iPlrId)?true:false));
default: return PLUGIN_HANDLED;
}
Menu_Open_Scope(iPlrId);
switch( save_data(iPlrId) )
{
case 4: client_print(iPlrId, print_center, "SAVED%c(LAN settings)%c(custom config)", 13, 13);
case 3: client_print(iPlrId, print_center, "SAVED%c(custom config)", 13);
case 2: client_print(iPlrId, print_center, "SAVED%c(LAN settings)", 13);
case 1: client_print(iPlrId, print_center, "SAVED");
case -1: client_print(iPlrId, print_center, "SAVED%c(default parameters)", 13);
default: client_print(iPlrId, print_center, "ERROR:%c(could not save)", 13);
}
return PLUGIN_HANDLED;
}
public Ham_AttachToPlayer_Post(iEnt, iPlrId)
print_message(iPlrId);
public Ham_Spawn_player_Pre(iPlrId)
SetPlayerBit(g_iShouldPrint, iPlrId);
configurate(const iSpriteName[], const iWpnName[], const iWpnBuffer[], const iIpAddress[], iToggleCmd[], iLen)
{
#define IDENTICAL_320 "crosshair 320 crosshairs 24 0 24 24^n\
autoaim 320 crosshairs 0 72 24 24^n\
zoom 320 ch_sniper2 0 0 256 256^n\
zoom_autoaim 320 ch_sniper2 0 0 256 256"
#define IDENTICAL_640 "crosshair 640 crosshairs 24 0 24 24^n\
autoaim 640 crosshairs 0 72 24 24^n\
zoom 640 %s 0 0 256 256^n\
zoom_autoaim 640 %s 0 0 256 256"
new iText[32], iSpriteFile[64], bool:bFound;
if( equal(iSpriteName, "*") )
formatex(iText, 31, "scope_%s_numb", iWpnName);
else
{
copy(iText, 31, iSpriteName);
bFound = true;
}
formatex(iSpriteFile, 63, "sprites/%s.spr", iText);
if( file_exists(iSpriteFile) )
{
if( bFound )
{
new iSprite[64];
formatex(iSprite, 63, "sprites/%s_%s.spr", iText, iIpAddress);
if( !file_exists(iSprite) )
{
new iFileIdRead = fopen(iSpriteFile, "rb");
if( !iFileIdRead )
bFound = false;
else
{
new iFileIdWrite = fopen(iSprite, "wb");
if( !iFileIdWrite )
{
fclose(iFileIdRead);
bFound = false;
}
else
{
new iFileBlock[2048];
fseek(iFileIdRead, 0, SEEK_END);
new iFileSize = ftell(iFileIdRead);
fseek(iFileIdRead, 0, SEEK_SET);
for( new iBlock; iBlock<iFileSize; iBlock+=2048 )
fwrite_blocks(iFileIdWrite, iFileBlock, fread_blocks(iFileIdRead, iFileBlock, 2048, BLOCK_BYTE), BLOCK_BYTE);
//while( !feof(iFileIdRead) )
// fputc(iFileIdWrite, fgetc(iFileIdRead));
fclose(iFileIdRead);
fclose(iFileIdWrite);
}
}
}
if( bFound )
{
new iBuffer[1024];
copy(iSpriteFile, 63, iSprite);
formatex(iSprite, 63, "%s_%s", iText, iIpAddress);
new iTextFile[128];
formatex(iTextFile, 127, "sprites/wpn_%s_%s_%s.txt", iWpnName, iIpAddress, iText);
formatex(iBuffer, 1023, iWpnBuffer, IDENTICAL_320, IDENTICAL_640);
format(iBuffer, 1023, iBuffer, iSprite, iSprite);
if( file_exists(iTextFile) )
delete_file(iTextFile);
if( write_file(iTextFile, iBuffer) )
{
precache_generic(iSpriteFile);
precache_generic(iTextFile);
formatex(iToggleCmd, iLen, "wpn_%s_%s_%s", iWpnName, iIpAddress, iText);
return 1;
}
}
}
else
{
new iTextFile[64], iBuffer[1024];
formatex(iTextFile, 63, "sprites/weapon_%s_numb.txt", iWpnName);
formatex(iBuffer, 1023, iWpnBuffer, IDENTICAL_320, IDENTICAL_640);
format(iBuffer, 1023, iBuffer, iText, iText);
if( file_exists(iTextFile) )
delete_file(iTextFile);
if( write_file(iTextFile, iBuffer) )
{
precache_generic(iSpriteFile);
precache_generic(iTextFile);
formatex(iToggleCmd, iLen, "weapon_%s_numb", iWpnName);
return 2;
}
}
}
return 0;
}
bool:check_mini_scope(iFileName[], iConfig[])
{
if( file_exists(iFileName) )
delete_file(iFileName);
if( !write_file(iFileName, iConfig) )
return false;
precache_generic(iFileName);
return true;
}
Menu_Open_Scope(iPlrId)
{
new iMenuBody[512], iMenuBodyLen, iKeys;
iMenuBodyLen = copy(iMenuBody, 511, "\rCustom Sniper Scopes^n\yBy\w: \dNumb^n");
if( g_iFatalError )
{
if( g_iFatalError==1 )
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), "^n\rFATAL ERROR\w:^n\yCould not open^n\dserver config file^n^n\r0\y. \wExit");
else if( g_iFatalError==2 )
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), "^n\rFATAL ERROR\w:^n\yCould not open^n\dserver config folder^n^n\r0\y. \wExit");
else
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), "^n\rFATAL ERROR\w:^n\yCould not open^n\dsave folder for client settings^n^n\r0\y. \wExit");
show_menu(iPlrId, MENU_KEY_0, iMenuBody, -1, "Custom Scopes");
return;
}
if( g_iAWPFileName[0] )
{
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), CheckPlayerBit(g_iCustomAWP, iPlrId)?"^n\r1\y. \wAWP\d: \yON":"^n\r1\y. \wAWP\d: \yOFF");
iKeys |= MENU_KEY_1;
}
else
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), g_bCustomAWP?"^n\r1\y. \dAWP\w: \yERROR":"^n\r1\y. \dAWP\w: \yNONE");
if( g_iScoutFileName[0] )
{
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), CheckPlayerBit(g_iCustomScout, iPlrId)?"^n\r2\y. \wScout\d: \yON":"^n\r2\y. \wScout\d: \yOFF");
iKeys |= MENU_KEY_2;
}
else
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), g_bCustomScout?"^n\r2\y. \dScout\w: \yERROR":"^n\r2\y. \dScout\w: \yNONE");
if( g_iG3SG1FileName[0] )
{
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), CheckPlayerBit(g_iCustomG3SG1, iPlrId)?"^n\r3\y. \wG3SG1\d: \yON":"^n\r3\y. \wG3SG1\d: \yOFF");
iKeys |= MENU_KEY_3;
}
else
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), g_bCustomG3SG1?"^n\r3\y. \dG3SG1\w: \yERROR":"^n\r3\y. \dG3SG1\w: \yNONE");
if( g_iSG550FileName[0] )
{
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), CheckPlayerBit(g_iCustomSG550, iPlrId)?"^n\r4\y. \wSG550\d: \yON":"^n\r4\y. \wSG550\d: \yOFF");
iKeys |= MENU_KEY_4;
}
else
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), g_bCustomSG550?"^n\r4\y. \dSG550\w: \yERROR":"^n\r4\y. \dSG550\w: \yNONE");
if( g_bNoErrorSG552 )
{
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), CheckPlayerBit(g_iCustomSG552, iPlrId)?"^n^n\r5\y. \wSG552\d: \yON":"^n^n\r5\y. \wSG552\d: \yOFF");
iKeys |= MENU_KEY_5;
}
else
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), g_bCustomSG552?"^n^n\r5\y. \dSG552\w: \yERROR":"^n^n\r5\y. \dSG552\w: \yNONE");
if( g_bNoErrorAUG )
{
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), CheckPlayerBit(g_iCustomAUG, iPlrId)?"^n\r6\y. \wAUG\d: \yON":"^n\r6\y. \wAUG\d: \yOFF");
iKeys |= MENU_KEY_6;
}
else
iMenuBodyLen += copy(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), g_bCustomAUG?"^n\r6\y. \dAUG\w: \yERROR":"^n\r6\y. \dAUG\w: \yNONE");
iMenuBodyLen += formatex(iMenuBody[iMenuBodyLen], (511-iMenuBodyLen), "^n^n\r0\y. \wExit");
show_menu(iPlrId, (iKeys|MENU_KEY_0), iMenuBody, -1, "Custom Scopes");
}
send_awp(iPlrId, bool:bReal=false, bool:bCheckActiveItem=true)
{
if( g_iAWPFileName[0] )
{
message_begin(MSG_ONE, g_iMsgId_WeaponList, _, iPlrId);
write_string((bReal?"weapon_awp":g_iAWPFileName));
write_byte(1);
write_byte(30);
write_byte(-1);
write_byte(-1);
write_byte(0);
write_byte(2);
write_byte(CSW_AWP);
write_byte(0);
message_end();
if( bReal )
ClearPlayerBit(g_iCustomAWP, iPlrId);
else
SetPlayerBit(g_iCustomAWP, iPlrId);
if( bCheckActiveItem )
check_active_item(iPlrId, CSW_AWP);
}
else
ClearPlayerBit(g_iCustomAWP, iPlrId);
}
send_scout(iPlrId, bool:bReal=false, bool:bCheckActiveItem=true)
{
if( g_iScoutFileName[0] )
{
message_begin(MSG_ONE, g_iMsgId_WeaponList, _, iPlrId);
write_string((bReal?"weapon_scout":g_iScoutFileName));
write_byte(2);
write_byte(90);
write_byte(-1);
write_byte(-1);
write_byte(0);
write_byte(9);
write_byte(CSW_SCOUT);
write_byte(0);
message_end();
if( bReal )
ClearPlayerBit(g_iCustomScout, iPlrId);
else
SetPlayerBit(g_iCustomScout, iPlrId);
if( bCheckActiveItem )
check_active_item(iPlrId, CSW_SCOUT);
}
else
ClearPlayerBit(g_iCustomScout, iPlrId);
}
send_g3sg1(iPlrId, bool:bReal=false, bool:bCheckActiveItem=true)
{
if( g_iG3SG1FileName[0] )
{
message_begin(MSG_ONE, g_iMsgId_WeaponList, _, iPlrId);
write_string((bReal?"weapon_g3sg1":g_iG3SG1FileName));
write_byte(2);
write_byte(90);
write_byte(-1);
write_byte(-1);
write_byte(0);
write_byte(3);
write_byte(CSW_G3SG1);
write_byte(0);
message_end();
if( bReal )
ClearPlayerBit(g_iCustomG3SG1, iPlrId);
else
SetPlayerBit(g_iCustomG3SG1, iPlrId);
if( bCheckActiveItem )
check_active_item(iPlrId, CSW_G3SG1);
}
else
ClearPlayerBit(g_iCustomG3SG1, iPlrId);
}
send_sg550(iPlrId, bool:bReal=false, bool:bCheckActiveItem=true)
{
if( g_iSG550FileName[0] )
{
message_begin(MSG_ONE, g_iMsgId_WeaponList, _, iPlrId);
write_string((bReal?"weapon_sg550":g_iSG550FileName));
write_byte(4);
write_byte(90);
write_byte(-1);
write_byte(-1);
write_byte(0);
write_byte(16);
write_byte(CSW_SG550);
write_byte(0);
message_end();
if( bReal )
ClearPlayerBit(g_iCustomSG550, iPlrId);
else
SetPlayerBit(g_iCustomSG550, iPlrId);
if( bCheckActiveItem )
check_active_item(iPlrId, CSW_SG550);
}
else
ClearPlayerBit(g_iCustomSG550, iPlrId);
}
send_sg552(iPlrId, bool:bReal=false, bool:bCheckActiveItem=true)
{
if( g_bNoErrorSG552 )
{
message_begin(MSG_ONE, g_iMsgId_WeaponList, _, iPlrId);
write_string((bReal?"weapon_sg552":"weapon_sg552_numb"));
write_byte(4);
write_byte(90);
write_byte(-1);
write_byte(-1);
write_byte(0);
write_byte(10);
write_byte(CSW_SG552);
write_byte(0);
message_end();
if( bReal )
ClearPlayerBit(g_iCustomSG552, iPlrId);
else
SetPlayerBit(g_iCustomSG552, iPlrId);
if( bCheckActiveItem )
check_active_item(iPlrId, CSW_SG552);
}
else
ClearPlayerBit(g_iCustomSG552, iPlrId);
}
send_aug(iPlrId, bool:bReal=false, bool:bCheckActiveItem=true)
{
if( g_bNoErrorAUG )
{
message_begin(MSG_ONE, g_iMsgId_WeaponList, _, iPlrId);
write_string((bReal?"weapon_aug":"weapon_aug_numb"));
write_byte(4);
write_byte(90);
write_byte(-1);
write_byte(-1);
write_byte(0);
write_byte(14);
write_byte(CSW_AUG);
write_byte(0);
message_end();
if( bReal )
ClearPlayerBit(g_iCustomAUG, iPlrId);
else
SetPlayerBit(g_iCustomAUG, iPlrId);
if( bCheckActiveItem )
check_active_item(iPlrId, CSW_AUG);
}
else
ClearPlayerBit(g_iCustomAUG, iPlrId);
}
check_active_item(iPlrId, iWpnType)
{
new iEnt = get_pdata_cbase(iPlrId, m_pActiveItem, 5);
if( iEnt>0 )
{
if( get_pdata_int(iEnt, m_iId, 4)==iWpnType )
{
emessage_begin(MSG_ONE, g_iMsgId_CurWeapon, _, iPlrId);
ewrite_byte(1);
ewrite_byte(iWpnType);
ewrite_byte(get_pdata_int(iEnt, m_iClip, 4));
emessage_end(); // emessage_begin() and emessage_end() for "sniper crosshairs" plugin support.
}
}
}
print_message(iPlrId) // using eng*, cause calling inside an event sometimes
{
if( CheckPlayerBit(g_iShouldPrint, iPlrId) )
{
ClearPlayerBit(g_iShouldPrint, iPlrId);
engclient_print(iPlrId, engprint_center, "^n^nType ^"/scope^" in chat to change^nsniper scopes");
}
}
bool:load_data(iPlrId)
{
new iFile[512], iAuthid[32];
get_user_authid(iPlrId, iAuthid, 31);
if( replace_all(iAuthid[6], 25, ":", "_")!=1 )
{
get_user_ip(iPlrId, iAuthid[6], 25, 1);
replace_all(iAuthid[6], 31, ".", "_");
}
if( g_iCustomInfoDir[0] )
{
formatex(iFile, 511, "%s%s", g_iCustomInfoDir, iAuthid[6]);
if( !file_exists(iFile) )
formatex(iFile, 511, "%s%s", g_iInfoDir, iAuthid[6]);
}
else
formatex(iFile, 511, "%s%s", g_iInfoDir, iAuthid[6]);
if( file_exists(iFile) )
{
new iData[4], iInfo;
read_file(iFile, 0, iData, 3, iInfo);
iInfo = str_to_num(iData);
if( iInfo&1 )
ClearPlayerBit(g_iCustomAWP, iPlrId);
else
SetPlayerBit(g_iCustomAWP, iPlrId);
if( iInfo&2 )
ClearPlayerBit(g_iCustomScout, iPlrId);
else
SetPlayerBit(g_iCustomScout, iPlrId);
if( iInfo&4 )
ClearPlayerBit(g_iCustomG3SG1, iPlrId);
else
SetPlayerBit(g_iCustomG3SG1, iPlrId);
if( iInfo&8 )
ClearPlayerBit(g_iCustomSG550, iPlrId);
else
SetPlayerBit(g_iCustomSG550, iPlrId);
if( iInfo&16 )
ClearPlayerBit(g_iCustomSG552, iPlrId);
else
SetPlayerBit(g_iCustomSG552, iPlrId);
if( iInfo&32 )
ClearPlayerBit(g_iCustomAUG, iPlrId);
else
SetPlayerBit(g_iCustomAUG, iPlrId);
return true;
}
SetPlayerBit(g_iCustomAWP, iPlrId);
SetPlayerBit(g_iCustomScout, iPlrId);
SetPlayerBit(g_iCustomG3SG1, iPlrId);
SetPlayerBit(g_iCustomSG550, iPlrId);
SetPlayerBit(g_iCustomSG552, iPlrId);
SetPlayerBit(g_iCustomAUG, iPlrId);
return false;
}
save_data(iPlrId)
{
new iFile[512], iAuthid[32], bool:bLan;
get_user_authid(iPlrId, iAuthid, 31);
if( replace_all(iAuthid[6], 25, ":", "_")!=1 )
{
get_user_ip(iPlrId, iAuthid[6], 25, 1);
replace_all(iAuthid[6], 31, ".", "_");
bLan = true;
}
formatex(iFile, 511, "%s%s", (g_iCustomInfoDir[0]?g_iCustomInfoDir:g_iInfoDir), iAuthid[6]);
if( file_exists(iFile) )
delete_file(iFile);
new iData[4], iInfo;
if( !CheckPlayerBit(g_iCustomAWP, iPlrId) && g_iAWPFileName[0] )
iInfo |= 1;
if( !CheckPlayerBit(g_iCustomScout, iPlrId) && g_iScoutFileName[0] )
iInfo |= 2;
if( !CheckPlayerBit(g_iCustomG3SG1, iPlrId) && g_iG3SG1FileName[0] )
iInfo |= 4;
if( !CheckPlayerBit(g_iCustomSG550, iPlrId) && g_iSG550FileName[0] )
iInfo |= 8;
if( !CheckPlayerBit(g_iCustomSG552, iPlrId) && g_bNoErrorSG552 )
iInfo |= 16;
if( !CheckPlayerBit(g_iCustomAUG, iPlrId) && g_bNoErrorAUG )
iInfo |= 32;
if( iInfo || g_iCustomInfoDir[0] )
{
num_to_str(iInfo, iData, 3);
if( write_file(iFile, iData) )
{
if( g_iCustomInfoDir[0] )
return (bLan?4:3);
return (bLan?2:1);
}
}
else
return -1;
return 0;
}
| Link: | |
| Linklerini gizle |