Please help with login
#1

How do I do that if player isn't logged in he cant spawn and play? please help me?
Reply
#2

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
if(!_PLAYER_AUTHED_[playerid])
{
SendClientMessage(playerid, _YOUR_COLOR_, "You need to login before you can spawn!");
return 0;
}
return 1;
}
I hope this helps you.
You'll need to define your own _PLAYER_AUTHED_ and _YOUR_COLOR_.
Reply
#3

Quote:
Originally Posted by ·٠•●°Alive°●•٠·
How do I do that if player isn't logged in he cant spawn and play? please help me?
You could set a variable. When a player logins, set it to 1. If they try to chat or spawn with the login variable 0, just return a message.

EDIT: Don was faster.
Reply
#4

No, i just was thinking about, that player cant spawn if he hasn't logged in or registered.
Reply
#5

Quote:
Originally Posted by ·٠•●°Alive°●•٠·
No, i just was thinking about, that player cant spawn if he hasn't logged in or registered.
That's what he showed you...

if in public OnPlayerRequestSpawn(playerid) you return 0; the player can't spawn, if you return 1 they can spawn.. if you read the wiki you'd know that.
Reply
#6

Thanks, I did this:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
  if(pInfo[playerid][Logged] == 0)
  {
    SendClientMessage(playerid, COLOR_RED, "You can't spawn if you are not logged in");
    return 0;
    }else{
    return 1;
  }
return 1;
}
And everything works fine.
Reply
#7

You could make it a bit tidier.

Quote:
Originally Posted by ·٠•●°Alive°●•٠·
Thanks, I did this:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
  if(pInfo[playerid][Logged] == 0)
  {
    SendClientMessage(playerid, COLOR_RED, "You can't spawn if you are not logged in");
    return 0;
  }
  return 1;
}
And everything works fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)