Hey.
Ich habe mir ein anti waffen hack gebastelt. ich habe als Vorlage das Antiwaffenhack von bfx genommen.
Nun wird jede Sekunde überprüft ob der Spieler "illegale" waffen hat.
hier mal wie ich es habe:
//------------Anti Waffen:------------//
new Weapons[MAX_PLAYERS][13];//
new Ammos[MAX_PLAYERS][13];//
forward GetSlot(weaponx);//
forward GetPlayerWeapons(playerid);//
new Checked_Weapons[MAX_PLAYERS][13];//
new Checked_Ammos[MAX_PLAYERS][13];//
//-----------------------------------//
public OnGameModeInit()
{
SetTimer("check",1000,1);
return 1;
}
public check()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
//wafffen:
for(new j = 0;j<13;j++)
{
GetPlayerWeapons(i);
if(Checked_Weapons[i][j] != Weapons[i][j])
{
cheater[i] = 5; // sieht unlogisch aus, jedoch wird diese variable noch woanders verwendet..
if(cheater[i] >= 5)
{
new bstr[256],name[MAX_PLAYER_NAME],Spielerdatei[256];
GetPlayerName(i,name,sizeof(name));
format(bstr,sizeof(bstr),"%s wurde gebannt, Grund: Waffenhack", name);
SendClientMessageToAll(0xFF0000FF,bstr);
format(Spielerdatei,sizeof(Spielerdatei),"/User/%s.ini", name);
dini_Set(Spielerdatei,"bangrund","Waffenhack");
dini_IntSet(Spielerdatei,"ban",1);
Kick(i);
}
}
}
}
return 1;
}
public GetSlot(weaponx)
{
new slot;
if(weaponx == 0 || weaponx == 1){slot = 0;}
else if(weaponx > 8 && weaponx < 10){slot = 1;}
else if(weaponx > 9 && weaponx < 16){slot = 10;}
else if(weaponx > 15 && weaponx < 20){slot = 8;}
else if(weaponx > 21 && weaponx < 25){slot = 2;}
else if(weaponx > 24 && weaponx < 28){slot = 3;}
else if(weaponx == 28 || weaponx == 29 || weaponx == 32){slot = 4;}
else if(weaponx == 30 || weaponx == 31){slot = 5;}
else if(weaponx == 33 || weaponx == 34){slot = 6;}
else if(weaponx > 34 || weaponx < 39){slot = 7;}
return slot;
}
stock p_GivePlayerWeapon(playerid,Weapon,ammo)
{
Weapons[playerid][GetSlot(Weapon)] = Weapon;
Ammos[playerid][GetSlot(Weapon)] = ammo;
GivePlayerWeapon(playerid,Weapon,ammo);
}
stock p_ResetPlayerWeapons(playerid)
{
for(new i = 0;i<13;i++)
{
Weapons[playerid][i] = 0;
Ammos[playerid][i] = 0;
}
ResetPlayerWeapons(playerid);
}
stock p_GetPlayerWeaponData(playerid,slotx,&weaps,&ammoz)
{
GetPlayerWeaponData(playerid,slotx,weaps,ammoz);
}
public GetPlayerWeapons(playerid)
{
for(new i = 0;i<13;i++)
{
GetPlayerWeaponData(playerid,i,Checked_Weapons[playerid][i],Checked_Ammos[playerid][i]);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
for(new i = 0;i<13;i++)
{
Weapons[playerid][i] = 0;
Ammos[playerid][i] = 0;
Checked_Weapons[playerid][i] = 0;
Checked_Ammos[playerid][i] = 0;
}
return 1;
}
//bsp command:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/gun", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,1.0,687.0,-1304.5022,13.6058))
{
p_GivePlayerWeapon(playerid,14,1);
}
if(IsPlayerInRangeOfPoint(playerid,1.0,684.0,-1304.5022,13.6058))
{
p_GivePlayerWeapon(playerid,23,50);
}
if(IsPlayerInRangeOfPoint(playerid,1.0,681.0,-1304.5022,13.6058))
{
p_GivePlayerWeapon(playerid,24,50);
}
if(IsPlayerInRangeOfPoint(playerid,1.0,681.0,-1300.4457,13.6058))
{
p_GivePlayerWeapon(playerid,25,50);
}
if(IsPlayerInRangeOfPoint(playerid,1.0,684.0,-1300.4457,13.6058))
{
p_GivePlayerWeapon(playerid,29,150);
}
if(IsPlayerInRangeOfPoint(playerid,1.0,687.0,-1300.4457,13.6058))
{
p_GivePlayerWeapon(playerid,33,50);
}
if(IsPlayerInRangeOfPoint(playerid,1.0,684.0,-1293.5950,13.6058))
{
p_GivePlayerWeapon(playerid,31,200);
}
if(IsPlayerInRangeOfPoint(playerid,1.0,687.0,-1293.5950,13.6058))
{
p_GivePlayerWeapon(playerid,30,200);
}
}
return 1;
}
Mein Problem: ich gehe an diesen positionen und gebe /gun ein, und ich bekomme die waffe. Zwischendurch werde ich aber gebannt. als wenns zufall wäre..
An Lags liegt es nicht..
Ich hoffe ihr könnt mir da helfen, das Script hat keine Warnings oder Errors
mfg
Simon