OnPlayerTakeDamage gets called wrong
#4

Alternate Fix
I'm aware that you can remove few lines from what is being stated in this post but SA-MP acts weird sometimes so I'm just making sure that nothing would go off the plan.

Make a public variable on top of your script.
pawn Code:
new Spawned[MAX_PLAYERS];
Add this to the following callbacks: OnPlayerConnect & OnPlayerDisconnect
pawn Code:
Spawned[playerid] = 0;
Add this to the following callbacks: OnGameModeInit, OnGameModeExit
pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    Spawned[i] = 0;
}
Add this to the following callback: OnPlayerSpawn
pawn Code:
Spawned[playerid] = 1;
Now change your code to:
pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(!Spawned[playerid])
    {
        Spawned[playerid] = 1;
    }
    else
    {
        SendClientMessage(playerid, -1, "This will get called after restart on spawn");
        //Other Code
    }
    return 1;
}
Reply


Messages In This Thread
OnPlayerTakeDamage gets called wrong - by [SF]OutLawZ - 11.03.2013, 02:03
Re: OnPlayerTakeDamage gets called wrong - by MP2 - 11.03.2013, 02:40
Re: OnPlayerTakeDamage gets called wrong - by Kar - 11.03.2013, 10:15
Re: OnPlayerTakeDamage gets called wrong - by iRage - 11.03.2013, 10:48

Forum Jump:


Users browsing this thread: 3 Guest(s)