Anti-Spawn Killing Bug
#1

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

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

What do you mean by an array + killtimer?
Reply
#4

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

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?
Reply
#6

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)