21.12.2013, 16:15
Hello, how to make that when someone spawnkill that he get killed automatic?
Public OnPlayerSpawn(Playerid)
{
SetPlayerHealth(playerid, 99999.0);
SetTimerEx("SpawnProtection", 10000, false, "i", playerid);
SendClientMessage(playerid, COLOR_GREEN, "Anti Spawn Kill Started.");
}
public SpawnProtection(playerid)//Our Function we made.
{//Open Braket 4
SetPlayerHealth(playerid, 100.0);// Setting the player a Normal Health. 100 change it to what you want.
SendClientMessage(playerid, COLOR_RED, "Anti Spawn Kill Ended.");
return 1;// Returning to True
}//Open Braket 4
new Protected[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
Protected[playerid] = 1;
SetTimer("Endprotect",3000,false);//change 3000 to the protect time you want
return 1;
}
forward Endprotect(playerid);
public Endprotect(playerid)
{
Protected[playerid] = 0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(Protected[playerid] == 1)
{
SetPlayerHealth(killerid,0);
}
return 1;
}
Antispawnkill(playerid); //put on onplayerspawn
stock Antispawnkill(playerid) //put on the bottom of the script
{
new spawnkill;
{
SetPlayerHealth(playerid,99999);
SendClientMessage(playerid, 0x00FF00AA, "You are now protected by anti spawn-kill!");
SetTimerEx("StopAntiSpawnKill",5000,0,"i",playerid);
}
return spawnkill;
}
forward StopAntiSpawnKill(playerid);
public StopAntiSpawnKill(playerid)
{
SetPlayerHealth(playerid,100);
SendClientMessage(playerid, 0xFF0000AA, "Spawn kill protection is now over!");
return 1;
}