[Include] OnPlayerSpawnEx (OPSex) - Make everything easy
#4

Quote:
Originally Posted by Romel
Посмотреть сообщение
Which is more save in energy?

This include or that one, Emmet_

Not sure maybe the same.

Anyway thanks.
Not sure, however, this include won't work.

pawn Код:
public OnPlayerConnect(playerid)
{
    varSpawn[playerid] = FIRST_SPAWN;
    return 1;
}
When the player connects without spawning, your include will think they spawned for the first time, so when they spawn for the first time, your include marks it as a second spawn from that player.

You should do it like this:

pawn Код:
public OnPlayerSpawn(playerid)
{
    if (varSpawn[playerid] < 2)
    {
        varSpawn[playerid] ++;
    }
    return CallLocalFunction("OnPlayerSpawnEx", "dd", playerid, varSpawn[playerid]);
}
And maybe an IsPlayerSpawned function?

pawn Код:
#define IsPlayerSpawned(%0) varSpawn[%0]
For example, we can use it under OnPlayerSpawn:

pawn Код:
public OnPlayerSpawn(playerid)
{
    if (IsPlayerSpawned(playerid) == FIRST_SPAWN)
    {
        // Spawned for the first time
    }
    More code here...
    return 1;
}
Reply


Messages In This Thread
OnPlayerSpawnEx (OPSex) - Make everything easy - by JaKe Elite - 15.10.2012, 10:37
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by Emmet_ - 15.10.2012, 10:41
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by JaKe Elite - 15.10.2012, 10:43
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by Emmet_ - 15.10.2012, 10:48
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by JaKe Elite - 15.10.2012, 10:53
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by JaKe Elite - 15.10.2012, 10:59
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by JaKe Elite - 15.10.2012, 11:26
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by Niko_boy - 15.10.2012, 13:51
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by fiki574 - 16.10.2012, 08:13
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by razvan20100 - 16.10.2012, 08:19
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by Lordzy - 16.10.2012, 11:26
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by HuSs3n - 16.10.2012, 21:10
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by JaKe Elite - 19.10.2012, 09:03
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by JaKe Elite - 19.10.2012, 09:28
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by RajatPawar - 19.10.2012, 11:53
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by Mafioso97 - 19.10.2012, 14:44
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by JaKe Elite - 20.10.2012, 00:52
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by Excips - 23.10.2012, 16:30
Re: OnPlayerSpawnEx (OPSex) - Make everything easy - by Skillet` - 23.10.2012, 16:48

Forum Jump:


Users browsing this thread: 2 Guest(s)