12-05-2016, 12:16 PM
(This post was last modified: 12-05-2016, 12:18 PM by [PK]Ignatius Edited 2 times in total.)
I want to suggest anti-afk to prevent death evasion.
Anti Spawn Kill
https://wiki.sa-mp.com/wiki/SetTimerEx
Anti Spawn Kill
https://wiki.sa-mp.com/wiki/SetTimerEx
Code:
// The event callback (OnPlayerSpawn) - we will start a timer here
public OnPlayerSpawn(playerid)
{
// Anti-Spawnkill (5 seconds)
// Set their health very high so they can't be killed
SetPlayerHealth(playerid, 999999);
// Notify them
SendClientMessage(playerid, -1, "You are protected against spawn-killing for 5 seconds.");
// Start a 5 second timer to end the anti-spawnkill
SetTimerEx("EndAntiSpawnKill", 5000, false, "i", playerid);
}
// Forward (make public) the function so the server can 'see' it
forward EndAntiSpawnKill(playerid);
// The timer function - the code to be executed when the timer is called goes here
public EndAntiSpawnKill(playerid)
{
// 5 seconds has passed, so let's set their health back to 100
SetPlayerHealth(playerid, 100);
// Let's notify them also
SendClientMessage(playerid, -1, "You are no longer protected against spawn-killing.");
return 1;
}