Prevent player to use commands until he log in. - 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)
+--- Thread: Prevent player to use commands until he log in. (
/showthread.php?tid=380388)
Prevent player to use commands until he log in. -
RedJohn - 25.09.2012
Hey. Is there any chance to prevent player from using commands until he log in. Because while server is connecting and before login dialog if type /stats i get this: "You are banned from this server.". And when i restart and wait for login dialog everything is normal.
Thank you.
Re: Prevent player to use commands until he log in. -
Djole1337 - 25.09.2012
pawn Код:
new blabla[MAX_PLAYERS]
Onplayerconnect
blabla = 1;
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(blabla[playerid] == 1)
{
SendClientMessage(playerid, -1, "You cannot use commands at the moment...");
return 1;
}
return 1;
}
Onplayerspawn
blabla = 0;
Re: Prevent player to use commands until he log in. -
RedJohn - 25.09.2012
I forgot say to that i already have this ^^.
pawn Код:
if(PlayerInfo[playerid][Logged] == false) return SendClientMessage(playerid, RED, "You need to be logged to do this.");
Re: Prevent player to use commands until he log in. -
mamorunl - 25.09.2012
If you are using OnPlayerCommandText you can disable the whole rest of the OPCT (shortened). If you are using ZCMD or something, I am afraid that you will have to code in a check in every command or you can (maybe) use the #if statements. Normal if-statements don't work outside functions iirc.
Edit: Well, those were two fast responses xD
Re: Prevent player to use commands until he log in. -
BlueGames - 25.09.2012
[Edit] Answerd to late
PHP код:
else{ SendClientError(playerid, "You must login first"); return 0; }
Re: Prevent player to use commands until he log in. -
RedJohn - 25.09.2012
I'm using ZCMD but im creating gamemode from scratch so i have just few commands so it's not problem. What do you think, is this okey?
pawn Код:
if(PlayerInfo[playerid][Logged] == false) return 0;
Re: Prevent player to use commands until he log in. - Emmet_ - 25.09.2012
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if (PlayerInfo[playerid][Logged] == false)
{
SendClientMessage(playerid, 0xFF0000FF, "You must login before using commands.");
return 0;
}
return 1;
}
Re: Prevent player to use commands until he log in. -
RedJohn - 25.09.2012
Working, thanks. REP+.