new Text3D:antispawnkill;
public OnPlayerSpawn(playerid) { SetPlayerHealth(playerid, 99999.0); SetPlayerVirtualWorld(playerid, 0); SendClientMessage(playerid, 0xFF0000AA, "You can't be killed for 5 second(s) (spawn protection)"); SetPlayerWantedLevel(playerid, 0); SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500,0,"d",playerid); antispawnkill = Create3DTextLabel("Anti-Spawnkill Protected", 0xFF0000FF , 30.0, 40.0, 50.0, 40.0, 0); //SPAWNKILLTAG Attach3DTextLabelToPlayer(antispawnkill, playerid, 0.0, 0.0, 0.7);
public AntiSpawnkill(playerid) { DeletePlayer3DTextLabel(playerid, PlayerText3D:antispawnkill); //SpawnKill TAG SetPlayerHealth(playerid, 100.0); SendClientMessage(playerid, 0x00ff00ff, "Anti Spawn kill protection over."); return 1; }
SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500, false,"d",playerid);
You need an array to store the labelids otherwise you won't be able to destroy them.
|
Hey Vince, long time no see. Anyway man, can you elaborate? Label ID's?
|
new Text3D:antispawnkill;
new Text3D:antispawnkill[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
SetPlayerHealth(playerid, 99999.0);
SetPlayerVirtualWorld(playerid, 0);
SendClientMessage(playerid, 0xFF0000AA, "You can't be killed for 5 second(s) (spawn protection)");
SetPlayerWantedLevel(playerid, 0);
antispawnkill = Create3DTextLabel("Anti-Spawnkill Protected", 0xFF0000FF , 30.0, 40.0, 50.0, 40.0, 0); //SPAWNKILLTAG
Attach3DTextLabelToPlayer(antispawnkill, playerid, 0.0, 0.0, 0.7);
SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500,0,"ii",playerid,_:antispawnkill);
public AntiSpawnkill(playerid, labelid)
{
Delete3DTextLabel(Text3D:labelid); //SpawnKill TAG
SetPlayerHealth(playerid, 100.0);
SendClientMessage(playerid, 0x00ff00ff, "Anti Spawn kill protection over.");
return 1;
}
public AntiSpawnkill(playerid, labelid)
error 025: function heading differs from prototype
forward AntiSpawnkill(playerid, labelid);
new Text3D:antispawnkill[MAX_PLAYERS] = {Text3D:-1, ...}; // fill array with -1
public OnPlayerSpawn(playerid)
{
SetPlayerHealth(playerid, 99999.0);
SetPlayerVirtualWorld(playerid, 0);
SendClientMessage(playerid, 0xFF0000AA, "You can't be killed for 5 second(s) (spawn protection)");
SetPlayerWantedLevel(playerid, 0);
if(antispawnkill[playerid] != Text3D:-1) Delete3DTextLabel(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.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(antispawnkill[playerid], playerid, 0.0, 0.0, 0.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(playerid, 100.0);
SendClientMessage(playerid, 0x00ff00ff, "Anti Spawn kill protection over.");
return 1;
}
error 017: undefined symbol "MAX_PLAYERS" error 025: function heading differs from prototype
new Text3D:antispawnkill[MAX_PLAYERS] = {Text3D:-1, ...},
ptmAntiSpawnKill[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
SetPlayerHealth(playerid, 99999.0);
SetPlayerVirtualWorld(playerid, 0);
SendClientMessage(playerid, 0xFF0000AA, "You can't be killed for 5 second(s) (spawn protection)");
SetPlayerWantedLevel(playerid, 0);
Delete3DTextLabel(antispawnkill[playerid]);
antispawnkill[playerid] = Create3DTextLabel("Anti-Spawnkill Protected", 0xFF0000FF , 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(antispawnkill[playerid], playerid, 0.0, 0.0, 0.7);
KillTimer(ptmAntiSpawnKill[playerid]);
ptmAntiSpawnKill[playerid] = SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500,0,"i",playerid);
return 1;
}
forward AntiSpawnkill(playerid);
public AntiSpawnkill(playerid)
{
Delete3DTextLabel(antispawnkill[playerid]);
antispawnkill[playerid] = Text3D:-1;
SetPlayerHealth(playerid, 100.0);
SendClientMessage(playerid, 0x00ff00ff, "Anti Spawn kill protection over.");
return 1;
}
new Text3D:antispawnkill[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
SetPlayerHealth(playerid, 99999.0);
SetPlayerVirtualWorld(playerid, 0);
SendClientMessage(playerid, 0xFF0000AA, "You can't be killed for 5 second(s) (spawn protection)");
SetPlayerWantedLevel(playerid, 0);
SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500,0,"d",playerid);
antispawnkill[playerid] = Create3DTextLabel("Anti-Spawnkill Protected", 0xFF0000FF , 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(antispawnkill[playerid], playerid, 0.0, 0.0, 0.7);
}
public AntiSpawnkill(playerid)
{
Delete3DTextLabel(antispawnkill[playerid]); //SpawnKill TAG
SetPlayerHealth(playerid, 100.0);
SendClientMessage(playerid, 0x00ff00ff, "Anti Spawn kill protection over.");
return 1;
}
Try this code, And let me know if it works or not
Rep if it works please PHP Code:
|