SA-MP Forums Archive
Anti-Spawn Killing Bug - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Anti-Spawn Killing Bug (/showthread.php?tid=163283)



Anti-Spawn Killing Bug - ScottCFR - 26.07.2010

I made a anti spawn killing system last night. Today I realized, that when anyone spawns, it set's their health to 100. I know what the bug is, just not sure how to fix it.

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerRandomSpawn(playerid);
    SetPlayerInterior(playerid,0);
    SetPlayerMoney(playerid, 10000);
    SendClientMessage(playerid, ORANGE, "The bank has gifted you $10,000!");
    SendClientMessage(playerid, RED, "ANTI SPAWN KILL: 15 Seconds left!");
    SetPlayerHealth(playerid, 1000000.0);
    SetTimer("SpawnKill", 15000, false);
    return 1;
}

forward SpawnKill(playerid);
public SpawnKill(playerid)
{
    SetPlayerHealth(playerid, 100.0);
    SendClientMessage(playerid, GREEN, "ANTI SPAWN KILL: Disabled!");
    return 1;
}



Re: Anti-Spawn Killing Bug - Jefff - 26.07.2010

pawn Код:
SetTimer("SpawnKill", 15000, false);
to
pawn Код:
SetTimerEx("SpawnKill", 15000, false, "d", playerid);
but what if someone type 10x /kill? xD must be array + killtimer


Re: Anti-Spawn Killing Bug - ScottCFR - 26.07.2010

What do you mean by an array + killtimer?


Re: Anti-Spawn Killing Bug - Jefff - 26.07.2010

Or that
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerRandomSpawn(playerid);
    SetPlayerInterior(playerid,0);
    SetPlayerMoney(playerid, 10000);
    SendClientMessage(playerid, ORANGE, "The bank has gifted you $10,000!");
    SendClientMessage(playerid, RED, "ANTI SPAWN KILL: 15 Seconds left!");
    SetPlayerHealth(playerid, 1000000.0);
    if(GetPVarInt(playerid,"Timer"))
        KillTimer(GetPVarInt(playerid,"Timer"));
    SetPVarInt(playerid,"Timer",SetTimerEx("SpawnKill", 15000, false, "d", playerid));
    return 1;
}
forward SpawnKill(playerid);
public SpawnKill(playerid)
{
    if(GetPVarInt(playerid,"Timer"))
        KillTimer(GetPVarInt(playerid,"Timer"));
    DeletePVar(playerid,"Timer");
    SetPlayerHealth(playerid, 100.0);
    SendClientMessage(playerid, GREEN, "ANTI SPAWN KILL: Disabled!");
    return 1;
}



Re: Anti-Spawn Killing Bug - ScottCFR - 26.07.2010

Okay, I didn't make it clear above xD. When someone spawns, anyone in the server gets 100 health. Would the SetTimerEx fix that problem?


Re: Anti-Spawn Killing Bug - willsuckformoney - 26.07.2010

i realize this may not work but give it a try

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerRandomSpawn(playerid);
    SetPlayerInterior(playerid,0);
    SetPlayerMoney(playerid, 10000);
    SendClientMessage(playerid, ORANGE, "The bank has gifted you $10,000!");
    SendClientMessage(playerid, RED, "ANTI SPAWN KILL: 15 Seconds left!");
    SetPlayerHealth(playerid, 1000000.0);
    return 1;
}

forward SpawnKill(playerid);
public SpawnKill(playerid)
{
    SetPlayerHealth(playerid, 100.0);
    SendClientMessage(playerid, GREEN, "ANTI SPAWN KILL: Disabled!");
    SetTimer("SpawnKill", 15000,false);
    return 1;
}
just a switch and may not work but its a try


Re: Anti-Spawn Killing Bug - Jefff - 26.07.2010

Quote:
Originally Posted by ScottCFR
Посмотреть сообщение
Okay, I didn't make it clear above xD. When someone spawns, anyone in the server gets 100 health. Would the SetTimerEx fix that problem?
Yes Ex working only for single player, but SetTimer("SpawnKill", 15000,false); only for id 0