Anti-SpawnKill Tag issue
#12

It will not work as intended, there will be cases when more than one player has the 3DTextLabel; therefore, you must save all of the players' 3DTextLabel IDs in an array.

PHP Code:
new Text3D:antispawnkill[MAX_PLAYERS] = {Text3D:-1, ...}; // fill array with -1
public OnPlayerSpawn(playerid)
{
    
SetPlayerHealth(playerid99999.0);
    
SetPlayerVirtualWorld(playerid0);
    
SendClientMessage(playerid0xFF0000AA"You can't be killed for 5 second(s) (spawn protection)");
    
SetPlayerWantedLevel(playerid0);
    if(
antispawnkill[playerid] != Text3D:-1Delete3DTextLabel(antispawnkill[playerid]); // destroy old text label if player dies for whatever reason with spawn protection enabled (e.g. admin kill)
    
antispawnkill[playerid] = Create3DTextLabel("Anti-Spawnkill Protected"0xFF0000FF 30.040.050.040.00);
    
Attach3DTextLabelToPlayer(antispawnkill[playerid], playerid0.00.00.7);
    
SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500,0,"i",playerid);
    return 
1;
}
forward AntiSpawnkill(playerid);
public 
AntiSpawnkill(playerid)
{
    
Delete3DTextLabel(antispawnkill[playerid]);
    
antispawnkill[playerid] = Text3D:-1// reset array index used to destroy old text label
    
SetPlayerHealth(playerid100.0);
    
SendClientMessage(playerid0x00ff00ff"Anti Spawn kill protection over.");
    return 
1;

Reply


Messages In This Thread
Anti-SpawnKill Tag issue - by Sting. - 16.07.2017, 14:11
Re: Anti-SpawnKill Tag issue - by GuilhermeNunes - 16.07.2017, 14:39
Re: Anti-SpawnKill Tag issue - by Sting. - 16.07.2017, 15:55
Re: Anti-SpawnKill Tag issue - by Vince - 16.07.2017, 16:00
Re: Anti-SpawnKill Tag issue - by GuilhermeNunes - 16.07.2017, 16:03
Re: Anti-SpawnKill Tag issue - by Sting. - 16.07.2017, 16:43
Re: Anti-SpawnKill Tag issue - by Paulice - 16.07.2017, 16:47
Re: Anti-SpawnKill Tag issue - by Jefff - 16.07.2017, 18:08
Re: Anti-SpawnKill Tag issue - by Sting. - 16.07.2017, 18:19
Re: Anti-SpawnKill Tag issue - by kubak01 - 16.07.2017, 18:25
Re: Anti-SpawnKill Tag issue - by Sting. - 16.07.2017, 18:32
Re: Anti-SpawnKill Tag issue - by Paulice - 16.07.2017, 18:49
Re: Anti-SpawnKill Tag issue - by Sting. - 17.07.2017, 19:21
Re: Anti-SpawnKill Tag issue - by Paulice - 17.07.2017, 19:40
Re: Anti-SpawnKill Tag issue - by jlalt - 17.07.2017, 19:52
Re: Anti-SpawnKill Tag issue - by Paulice - 17.07.2017, 20:16
Re: Anti-SpawnKill Tag issue - by Arbico - 17.07.2017, 21:56
Re: Anti-SpawnKill Tag issue - by Paulice - 17.07.2017, 22:34

Forum Jump:


Users browsing this thread: 2 Guest(s)