Prevent player to use commands until he log in.
#1

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.
Reply
#2

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;
Reply
#3

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.");
Reply
#4

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
Reply
#5

[Edit] Answerd to late
PHP код:
else{ SendClientError(playerid"You must login first"); return 0; } 
Reply
#6

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;
Reply
#7

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if (PlayerInfo[playerid][Logged] == false)
    {
        SendClientMessage(playerid, 0xFF0000FF, "You must login before using commands.");
        return 0;
    }
    return 1;
}
Reply
#8

Working, thanks. REP+.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)