SA-MP Forums Archive
How can you set a Anti-Spawnkill - 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: How can you set a Anti-Spawnkill (/showthread.php?tid=473236)



How can you set a Anti-Spawnkill - lulo356 - 02.11.2013

Quote:

TeamGang[playerid] = 1;
if(PlayerDied[playerid] == 1)
{
SetPlayerPos(playerid,2025.2041,-1423.6470,16.9922);
SendClientMessage(playerid,COLOR_WHITE,"You Got Rescued by Medics!");
SetPlayerFacingAngle(playerid,137.0703);
}
else
{
SetPlayerPos(playerid,2536.4011,-2049.3030,13.5500,85.0934);
}
return 1;
}

How cn you set anti-Spawnkill on it?


Re: How can you set a Anti-Spawnkill - Isolated - 02.11.2013

Player spawns->Set Timer with a player var->Player takes damage->Check var->If var = 1->Give back health->if not->continue->killtimer


Re: How can you set a Anti-Spawnkill - lulo356 - 02.11.2013

Quote:
Originally Posted by Isolated
Посмотреть сообщение
Player spawns->Set Timer with a player var->Player takes damage->Check var->If var = 1->Give back health->if not->continue->killtimer
??


Re: How can you set a Anti-Spawnkill - Isolated - 02.11.2013

I'm not going to give you the code unless you try first yourself.

The process above is to be followed.


Re: How can you set a Anti-Spawnkill - lulo356 - 02.11.2013

Mannn... I dont know what i need to do
Im a noob


Re: How can you set a Anti-Spawnkill - Isolated - 02.11.2013

pawn Код:
// Create the var
new PlayerAntiSpawn[MAX_PLAYERS] = 0;
new Timer;

// Process p1->Player Spawns
public OnPlayerSpawn(playerid)
{
    // p2->SetTimer
    Timer = SetTimerEx("OnPlayerAntiSpawn", TIME_TO_WAIT, false, "d", playerid); // Change TIME_TO_WAIT to the time in ms you want.
    PlayerAntiSpawn[playerid] = 1;
    return 1;
}

// Process p3->OnPlayerTakeDamage
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if(PlayerAntiSpawn[playerid] == 1) // p4->Check var
    {
        GivePlayerHealth(playerid, amount);
        return 1;
    }
    else // p5->Otherwise don't
    {
        // Other code.
    }
    return 1;
}

// p6->KillTimer/Var

forward OnPlayerAntiSpawn(playerid);
public OnPlayerAntiSpawn(playerid)
{
    PlayerAntiSpawn[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(Timer);
    PlayerAntiSpawn[playerid] = 0;
    return 1;
}



Re: How can you set a Anti-Spawnkill - -Prodigy- - 02.11.2013

No need to use timers, use timestamps