OnPlayerSpawn
#1

Hi. I've been thinking for a while and I have no idea how to do the following thing:

Okay, OnPlayerSpawn I want a message that a person has spawned. That is a simple code.
Also I need to kind of give players weapons OnPlayerSpawn too, but the problem is that OnPlayerSpawn is
kind of linked upon OnPlayerDeath too, so when a player respawns, it says in the chat " (playername) has spawned! "
How can I kind of seperate these two scripts?

- Cir
Reply
#2

Use a playervariable which gets set after the FIRST spawn to 1 and ask if the variable == 0 or == 1 in the Callback.
Reply
#3

aaah, thanks man!
Reply
#4

pawn Код:
public OnPlayerSpawn(playerid)
{
    new str[128],pname[MAX_PLAYER_NAME],firstspawned[MAX_PLAYERS];
    GetPlayerName(playerid,pname,sizeof(pname));
    if(firstspawned[playerid] == 0)
    {
        firstspawned[playerid] = 1;
        GivePlayerWeapon(playerid,31,99999);
        SendClientMessage(playerid,0xFFFFFFFF,"Have a free m4!");
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            format(str,sizeof(str),"%s has spawned",pname);
            SendClientMessage(i,0xFFFFFFFF,str);
        }
    }
    return 1;
}
Reply
#5

What the heck are you posting for pseudo code? It's not useful for him to get a whole code snippet, because this way he can't learn anything + the Playervariable would be global better.

Also would it be enough to use SetPVarInt and GetPVarInt when he doesn't have a enum or otherwise anything for players.
Reply
#6

Quote:
Originally Posted by ulbi1990
Посмотреть сообщение
What the heck are you posting for pseudo code? It's not useful for him to get a whole code snippet, because this way he can't learn anything + the Playervariable would be global better.

Also would it be enough to use SetPVarInt and GetPVarInt when he doesn't have a enum or otherwise anything for players.
It's also helpful to learn from codes, i learned how to make stuff like dynamic bars and stuff from looking at a dynamic business coding.

Also i'm not using an enum.
pawn Код:
new str[128],pname[MAX_PLAYER_NAME],firstspawned[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)