15.03.2016, 19:05
Hello, I have a slight problem, I have done nepotism against Ammo hack, the problem is that when the player starts to click quickly "LMB" it writes scare stories to chat.
I need to do this for the command on the ID of the player, write command and the Player ID, so it will not write to a chat message, and if you turn command write and player ID so it will be typing into the chat.
I mean... (Example)
I need to do this for the command on the ID of the player, write command and the Player ID, so it will not write to a chat message, and if you turn command write and player ID so it will be typing into the chat.
Код:
public CheckAmmo(playerid)
{
newammo = GetPlayerAmmo(playerid);
if((GetTickCount() - GetPVarInt(playerid, "AntiSpam")) > 10000)
{
if (oldammo == newammo)
{
new CheckAmmoString[150], weaponid, weaponname[24];
GetWeaponName(weaponid, weaponname, sizeof (weaponname));
format(CheckAmmoString,sizeof(CheckAmmoString),"{FFFF00}> Warning ! %s ( ID: %i ) possible 'Ammo-Hack' [ InVehicle: %s | Weapon: (ID:%d) | Ammo: %i ]", ReturnPlayerName(playerid), playerid, (IsPlayerInAnyVehicle(playerid)) ? ("{37DB45}True{FFFF00}") : ("{FF0000}False{FFFF00}"), GetPlayerWeapon(playerid), GetPlayerAmmo(playerid));
SendClientMessageToAll(-1,CheckAmmoString);
SetPVarInt(playerid, "AntiSpam", GetTickCount());
//ResetPlayerWeapons(playerid);
//SetPlayerArmedWeapon(playerid, 0);
}
}
return true;
}
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT || PLAYER_STATE_PASSENGER) //if(!IsPlayerAdmin(playerid))
if(HOLDING(KEY_FIRE))
{
if (HavePlayerWeapon(playerid))
{
oldammo = GetPlayerAmmo(playerid); // Save variable
SetTimerEx("CheckAmmo", 1000, false, "i", playerid);
}
return false;
}
}
return true;
}
Код:
CMD:sync(playerid, params[])
{
if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, -1,"SYNTAXE: /sync [playerid]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1,"Nope connected..");
if(PlayerSyncActive)
{
SyncActive(playerid, true);
SendClientMessage(playerid, -1,"The player was immune to Ammo Hack");
}
else if
{
if(PlayerSyncDeActive)
{
SyncDeActive(playerid, false);
SendClientMessage(playerid, -1,"The player wasn't immune to Ammo Hack");
}
return 1;
}


