Ammu shop RP
#5

I'm using NGRP mode, here the whole anticheat code:

Quote:

GivePlayerValidWeapon( playerid, WeaponID, Ammo )
{
if((PlayerInfo[playerid][pConnectTime] < 2 || PlayerInfo[playerid][pWRestricted] > 0) && WeaponID != 46 && WeaponID != 43) return 1;
switch( WeaponID )
{
case 0, 1:
{
PlayerInfo[playerid][pGuns][ 0 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 2, 3, 4, 5, 6, 7, 8, 9:
{
PlayerInfo[playerid][pGuns][ 1 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 22, 23, 24:
{
PlayerInfo[playerid][pGuns][ 2 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 25, 26, 27:
{
PlayerInfo[playerid][pGuns][ 3 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 28, 29, 32:
{
PlayerInfo[playerid][pGuns][ 4 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 30, 31:
{
PlayerInfo[playerid][pGuns][ 5 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 33, 34:
{
PlayerInfo[playerid][pGuns][ 6 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 35, 36, 37, 38:
{
PlayerInfo[playerid][pGuns][ 7 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 16, 17, 18, 39, 40:
{
PlayerInfo[playerid][pGuns][ 8 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 41, 42, 43:
{
PlayerInfo[playerid][pGuns][ 9 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 10, 11, 12, 13, 14, 15:
{
PlayerInfo[playerid][pGuns][ 10 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 44, 45, 46:
{
PlayerInfo[playerid][pGuns][ 11 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
}
return 1;
}

GetWeaponSlot(weaponid)
{
switch( weaponid )
{
case 0, 1:
{
return 0;
}
case 2, 3, 4, 5, 6, 7, 8, 9:
{
return 1;
}
case 22, 23, 24:
{
return 2;
}
case 25, 26, 27:
{
return 3;
}
case 28, 29, 32:
{
return 4;
}
case 30, 31:
{
return 5;
}
case 33, 34:
{
return 6;
}
case 35, 36, 37, 38:
{
return 7;
}
case 16, 17, 18, 39, 40:
{
return 8;
}
case 41, 42, 43:
{
return 9;
}
case 10, 11, 12, 13, 14, 15:
{
return 10;
}
case 44, 45, 46:
{
return 11;
}
}
return -1;
}


ExecuteHackerAction( playerid, weaponid )
{
if(!gPlayerLogged{playerid}) { return 1; }
if(PlayerInfo[playerid][pTut] == 0) { return 1; }
if(playerTabbed[playerid] == 1) { return 1; }
if(GetPVarInt(playerid, "IsInArena") >= 0) { return 1; }

new String[ 128 ], WeaponName[ 128 ];
GetWeaponName( weaponid, WeaponName, sizeof( WeaponName ) );

format( String, sizeof( String ), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) may possibly be weapon hacking (%s).", GetPlayerNameEx(playerid), playerid, WeaponName );
ABroadCast( COLOR_YELLOW, String, 2 );
format(String, sizeof(String), "%s (ID %d) may possibly be weapon hacking (%s)", GetPlayerNameEx(playerid), playerid, WeaponName);
Log("logs/hack.log", String);

return 1;
}

IsValidIP(ip[])
{
new a;
for (new i = 0; i < strlen(ip); i++)
{
if (ip[i] == '.')
{
a++;
}
}
if (a != 3)
{
return 1;
}
return 0;
}

CheckBan(ip[])
{
new string[20];
new File: file = fopen("ban.cfg", io_read);
while(fread(file, string))
{
if (strcmp(ip, string, true, strlen(ip)) == 0)
{
fclose(file);
return 1;
}
}
fclose(file);
return 0;
}

AddBan(ip[])
{
if (CheckBan(ip) == 0)
{
new File: file = fopen("ban.cfg", io_append);
new string[20];
format(string, sizeof(string), "\n%s", ip);
fwrite(file, string);
fclose(file);
foreach(Player, playerid)
{
new playerIP[16];
GetPlayerIp(playerid, playerIP, sizeof(playerIP));
if (strcmp(playerIP, ip) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are banned from this server.");
Kick(playerid);
}
}
return 1;
}
return 0;
}

RemoveBan(ip[])
{
if (CheckBan(ip) == 1)
{
new string[20];
new File: file = fopen("ban.cfg", io_read);
fcreate("tempBan.cfg");
new File: file2 = fopen("tempBan.cfg", io_append);
while(fread(file, string))
{
if (strcmp(ip, string, true, strlen(ip)) != 0 && strcmp("\n", string) != 0)
{
fwrite(file2, string);
}
}
fclose(file);
fclose(file2);
file = fopen("ban.cfg", io_write);
file2 = fopen("tempBan.cfg", io_read);
while(fread(file2, string))
{
fwrite(file, string);
}
fclose(file);
fclose(file2);
fremove("tempBan.cfg");
return 1;
}
return 0;

Reply


Messages In This Thread
Ammu shop RP - by lider1241 - 11.08.2013, 12:59
Re: Ammu shop RP - by Mattakil - 11.08.2013, 13:19
Re: Ammu shop RP - by Donvalley - 11.08.2013, 13:21
Re: Ammu shop RP - by Originality - 11.08.2013, 13:25
Re: Ammu shop RP - by lider1241 - 11.08.2013, 15:24
Re: Ammu shop RP - by Mattakil - 11.08.2013, 16:01
Re: Ammu shop RP - by lider1241 - 11.08.2013, 16:42

Forum Jump:


Users browsing this thread: 2 Guest(s)