SA-MP Forums Archive
Protect, Ammo-Hack, ... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Protect, Ammo-Hack, ... (/showthread.php?tid=602931)



Protect, Ammo-Hack, ... - FinStar - 15.03.2016

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.

Код:
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;
}
I mean... (Example)

Код:
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;
}



Re: Protect, Ammo-Hack, ... - saffierr - 15.03.2016

Quote:
Originally Posted by FinStar
Посмотреть сообщение
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.
What d... D..o do you even mean on this?


Re: Protect, Ammo-Hack, ... - Pottus - 16.03.2016

Shit code if you expect this to do anything then you have no clue as to what you are doing.