07.03.2013, 16:05
Hey I made a anti cheat. But I dont want it to ban players that the admin gave the minigun to.
anti cheat:
Giveweapon command:
please help me.
anti cheat:
pawn Код:
public OnPlayerUpdate(playerid)
{
new weaponid = GetPlayerWeapon(playerid);//This will cause the "weaponid not defined" Error
new Nam[MAX_PLAYER_NAME];
new str[128];
if(PlayerInfo[playerid][Level] >= 1)
{
if(weaponid == 16) // The weapon ID
{
GetPlayerName(playerid,Nam,sizeof(Nam));
format(str,sizeof(str),"{EA15D5}[Jazmin]: {FF6600}I have banned {FFFFFF}%s {FF6600} for weapon Hax ahahaha noob. ",Nam);
SendClientMessageToAll(0xFF0000FF,str);// Sends message to everyone
BanEx(playerid,"LSGW -|- Weapon Hack");
}
//make another line
if(PlayerInfo[playerid][Level] >= 1)
{
if(weaponid == WEAPONID) // The weapon ID
{
GetPlayerName(playerid,Nam,sizeof(Nam));
format(str,sizeof(str),"ANTI WEAPON HACK: %s has been banned from server for spawning a bad weapon!",Nam);
SendClientMessageToAll(0xFF0000FF,str);// Sends message to everyone
BanEx(playerid,"ANTI WEAPON HACK: Weapon Hack!");
}
return 1;
}
return 1;
}
Giveweapon command:
pawn Код:
dcmd_giveallweapon(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 3) {
new tmp[256], tmp2[256], Index, ammo, weap, WeapName[32], string[128]; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(tmp) ) return SendClientMessage(playerid, red, "USAGE: /giveallweapon [weapon id/weapon name] [ammo]");
if(!strlen(tmp2) || !IsNumeric(tmp2) || strval(tmp2) <= 0 || strval(tmp2) > 99999) ammo = 500;
if(!IsNumeric(tmp)) weap = GetWeaponIDFromName(tmp); else weap = strval(tmp);
if(!IsValidWeapon(weap)) return SendClientMessage(playerid,red,"ERROR: Invalid weapon ID");
CMDMessageToAdmins(playerid,"GIVEALLWEAPON");
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
PlayerPlaySound(i,1057,0.0,0.0,0.0);
GivePlayerWeapon(i,weap,ammo);
}
}
GetWeaponName(weap, WeapName, sizeof(WeapName) );
format(string,sizeof(string),"All Players Been Given A %s (%d) with %d rounds of ammo", WeapName, weap, ammo);
return SendClientMessageToAll(PINK, string);
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
please help me.