OnPlayerSpawn callback
#1

How do i make a message on player spawn only for 1 time and not spamming everytime he spawns?
Reply
#2

._. do a variable check that checks true onplayerspawn and false onplayerdisconnect? ex:
PHP код:
new bool:OneMessage[MAX_PLAYERS];
public 
OnPlayerSpawn(playerid)
{
    if(!
OneMessage[playerid])//checking if it was never set before
    
{
        
SendClientMessage(playerid, -1"Hi one message here");//sending the message
        
OneMessage[playerid] = true;//checking true to make it get called once
        
}
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
OneMessage[playerid] = false;// resetting it for the next player connecting with that id.
    
return 1;

Reply
#3

Use some variable to store player first spawn and set it to 0 when player connects and under OnPlayerSpawn check if that variable is 0 then Send the spawn message and set the variable to 1.

EDIT: Nevermind, i didn't saw the 2nd post.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)