SA-MP Forums Archive
Anti-Spawnkill Tag. - 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: Anti-Spawnkill Tag. (/showthread.php?tid=466204)



Anti-Spawnkill Tag. - Sting. - 26.09.2013

Ok, I've tried this with ChatBubble and doesn't seem to work but 3D Text label worked out on my bot but the problem is I can't seem to delete after the spawnkill ends. I will post the code and hopefully someone will show me where do I make my Anti Spawnkill 3D Text in Red.

Top of my script
Код:
forward AntiSpawnkill(playerid);
#define PROTECTIONTIME 10
Ok then OnGameModeIn (OnPlayerSpawn)
Код:
SetPlayerHealth(playerid, 10000.0);
SendClientMessage(playerid, 0xFF0000AA, "You can't be killed for 5 second(s) (spawn protection)");
SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500,0,"d",playerid);
Bottom of my script
Код:
public AntiSpawnkill(playerid)
{
    SetPlayerHealth(playerid, 100.0);
    SendClientMessage(playerid, 0x00ff00ff, "Anti Spawn kill protection over.");
    return 1;
}
So where do I put it and just 2/3 inches about the players head. Like many /me commands thing..


Re: Anti-Spawnkill Tag. - Krakuski - 26.09.2013

~Removed for the Time Be'ing, Tested it myself, Does not work yet~


Re: Anti-Spawnkill Tag. - iZN - 26.09.2013

Place it after setting the player health.
pawn Код:
new Text3D:test1 = Create3DTextLabel("{FF0000}default red", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(test1, playerid, 0.0, 0.0, 0.7);
Put this in AntiSpawnkill callback
pawn Код:
DeletePlayer3DTextLabel(playerid, PlayerText3D:test1);



Re: Anti-Spawnkill Tag. - Sting. - 28.09.2013

I still have the problem, here:

Код:
C:\Users\User\Desktop\GTA\GTA San Andreas\Server 0.3x\gamemodes\script.pwn(2325) : error 017: undefined symbol "test1"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Anti-Spawnkill Tag. - Patrick - 28.09.2013

Make the variable global, iZN only made the variable Local, which you can't destroy it, try this code

pawn Код:
new Text3D:antispawnkill;//global variable, not local

public OnPlayerSpawn(playerid)
{
    SetPlayerHealth(playerid, 10000.0);
    SendClientMessage(playerid, 0xFF0000AA, "You can't be killed for 5 second(s) (spawn protection)");
    SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500,0,"d",playerid);
   
    antispawnkill = Create3DTextLabel("{FF0000}default red", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(antispawnkill, playerid, 0.0, 0.0, 0.7);
}
public AntiSpawnkill(playerid)
{
    DeletePlayer3DTextLabel(playerid, PlayerText3D:antispawnkill);
   
    SetPlayerHealth(playerid, 100.0);
    SendClientMessage(playerid, 0x00ff00ff, "Anti Spawn kill protection over.");
    return 1;
}



Re: Anti-Spawnkill Tag. - Sting. - 28.09.2013

Still get an error...
Код:
C:\Users\User\Desktop\GTA\GTA San Andreas\Server\gamemodes\script.pwn(1288) : warning 219: local variable "test1" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.



Re: Anti-Spawnkill Tag. - Patrick - 28.09.2013

Fixed Code
pawn Код:
new Text3D:antispawnkill;//global variable, not local

public OnPlayerSpawn(playerid)
{
    SetPlayerHealth(playerid, 10000.0);
    SendClientMessage(playerid, 0xFF0000AA, "You can't be killed for 5 second(s) (spawn protection)");
    SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500,0,"d",playerid);
   
    antispawnkill = Create3DTextLabel("{FF0000}default red", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(antispawnkill, playerid, 0.0, 0.0, 0.7);
}
public AntiSpawnkill(playerid)
{
    DeletePlayer3DTextLabel(playerid, PlayerText3D:antispawnkill);
   
    SetPlayerHealth(playerid, 100.0);
    SendClientMessage(playerid, 0x00ff00ff, "Anti Spawn kill protection over.");
    return 1;
}



Re: Anti-Spawnkill Tag. - Sting. - 29.09.2013

Thanks, tried it out and it checks out. +Rep for everyone who helped me out.