Anti-Spawnkill Tag.
#1

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..
Reply
#2

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

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);
Reply
#4

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.
Reply
#5

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;
}
Reply
#6

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.
Reply
#7

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;
}
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)