SA-MP Forums Archive
Please help with login - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Please help with login (/showthread.php?tid=78391)



Please help with login - AiVAMAN - 19.05.2009

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


Re: Please help with login - Correlli - 19.05.2009

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_.


Re: Please help with login - SpiderPork - 19.05.2009

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.


Re: Please help with login - AiVAMAN - 20.05.2009

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


Re: Please help with login - Weirdosport - 20.05.2009

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.


Re: Please help with login - AiVAMAN - 21.05.2009

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.


Re: Please help with login - Badger(new) - 21.05.2009

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.