onplayercommandtext not working
#1

hello guys, so this time i want to prevent the players from using any cmds if they weren't logged in but the player can use cmds and the clientmessage doesn't appear why ?
pawn Код:
//===========================Anti Login CMD Use=================================
public OnPlayerCommandText(playerid, cmdtext[])
{
    if( (udb_Exists(PlayerName2(playerid))) && (PlayerInfo[playerid][LoggedIn] == 0) )
    {
        SendClientMessage(playerid, red, "This account is registered you need to be logged in to use any cmd");
        return 0;
    }
    return 1;
}
Reply
#2

Quote:
Originally Posted by KillerStrike23
Посмотреть сообщение
hello guys, so this time i want to prevent the players from using any cmds if they weren't logged in but the player can use cmds and the clientmessage doesn't appear why ?
pawn Код:
//===========================Anti Login CMD Use=================================
public OnPlayerCommandText(playerid, cmdtext[])
{
    if( (udb_Exists(PlayerName2(playerid))) && (PlayerInfo[playerid][LoggedIn] == 0) )
    {
        SendClientMessage(playerid, red, "This account is registered you need to be logged in to use any cmd");
        return 0;
    }
    return 1;
}
I'm pretty sure that the return 1; should be before the return 0;

Tell me if it fixes the problem or not

Код:
//===========================Anti Login CMD Use=================================
public OnPlayerCommandText(playerid, cmdtext[])
{
    if( (udb_Exists(PlayerName2(playerid))) && (PlayerInfo[playerid][LoggedIn] == 0) )
	{
		SendClientMessage(playerid, red, "This account is registered you need to be logged in to use any cmd");
		return 1; 
	}
    return 0;
}
Reply
#3

If you use ZCMD you should use OnPlayerCommandReceived instead. It also seems pretty pointless to check if the file exists. The 'LoggedIn' variable should be enough.
Reply
#4

vince it is not pointless, thanks btw i got the client message but he still can use the cmd
Reply
#5

problem fixed now thanksall..
Reply
#6

Quote:
Originally Posted by KillerStrike23
Посмотреть сообщение
vince it is not pointless, thanks btw i got the client message but he still can use the cmd
It is, it's pretty obsolete. Just a waste checking it.
Reply
#7

to make it clear am checking if the player account is already registered he don't have to be registered to use any command else he can't use commands if is registered but not logged in(if he presses f6 to hide the dialog )
i hope you got it guys..
Reply
#8

Quote:
Originally Posted by KillerStrike23
Посмотреть сообщение
to make it clear am checking if the player account is already registered he don't have to be registered to use any command else he can't use commands if is registered but not logged in(if he presses f6 to hide the dialog )
i hope you got it guys..
And? By checking if they are logged-in is enough. Players that aren't registered cannot log in whatsoever... Meaning, non-registered players won't be logged-in, nor would players that are registered but not logged-in.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)