onplayercommandtext not working - 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: onplayercommandtext not working (
/showthread.php?tid=599167)
onplayercommandtext not working -
KillerStrike23 - 21.01.2016
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;
}
Re: onplayercommandtext not working -
brandypol - 21.01.2016
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;
}
Re: onplayercommandtext not working -
Vince - 21.01.2016
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.
Re: onplayercommandtext not working -
KillerStrike23 - 22.01.2016
vince it is not pointless, thanks btw i got the client message but he still can use the cmd
Re: onplayercommandtext not working -
KillerStrike23 - 22.01.2016
problem fixed now thanksall..
Re: onplayercommandtext not working -
SickAttack - 22.01.2016
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.
Re: onplayercommandtext not working -
KillerStrike23 - 22.01.2016
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..
Re: onplayercommandtext not working -
SickAttack - 22.01.2016
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.