How do I detect when the player has spawn first time?
#1

Hello, I wana show rules when a player spawns for first time after connecting, not everytime he spawns. If I add it under OnPlayerSpawn, it will show rules each time player spawns, any idea how do I do that? Only once, the first spawn after the player connects.
Reply
#2

I think
If(PlayerInfo[playerid][Registered] == 1) {
Ur rules
Return 1;
}
Reply
#3

What? lol.
Reply
#4

I meant
if(PlayerInfo[Playerid][Registered] == 0 ) {
\\ Ur rules
Return 1; // so if player isn't registered the rules dialog will appear
Reply
#5

This is not at all associated with registration system, what are you trying to prove / say?
Reply
#6

OnPlayerConnect set a global variable to 0. OnPlayerSpawn, if variable is 0 it's first time spawn. Then increment variable. Not that hard.
Reply
#7

Hi, I thought of this, isn't there any other way? Rather than declaring a variable?
Reply
#8

Quote:
Originally Posted by [ND]xXZeusXx.
Посмотреть сообщение
Hi, I thought of this, isn't there any other way? Rather than declaring a variable?
No, just
PHP код:
new First[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
  
First[playerid] = 0;
  return 
1;
}
Public 
OnPlayerSpawn(playerid)
{
  if(
First[playerid] == 0// If Player will spawn for first time
 
{
  ........... 
// Do something
  
}
  
First[playerid] = 1;
  return 
1;

Reply
#9

You've done the same thing, lol. But thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)