When i do /login and in more cmds also this is like this
else if (!text) MessagePlayer( bla bla )
and my command dose not exits
else if (!text) bla bla..
BEcause there is else it comes and if there will be like if, it will not come...
So, in my script there are lot of cmds sin which else if (!text) is there
So, in this [ else if (!text) MessagePlayer("command does not exist, player) ] , is there any other thing that can be put instead of !text.
I tested !cmd but message does not appear if we type wrong cmd.
Any help?
!text or !arguments means it will not check if command is typed or not, it checks if a text after a command is given.
To setup an invalid command - error message you can use the following - which I am showing you for an example:
function onPlayerCommand( player, cmd, arguments )
{
if ( cmd == "test" )
{
MessagePlayer( "testing the command", player );
}
else if ( cmd == "hello" )
{
MessagePlayer( "hello " + player.Name, player );
}
else MessagePlayer( "Error - Invalid commad", player );
}
You may be using something like this as I aspect from some players:
if (status[ player.ID ].IsReg == true && status[ player.ID ].IsLogged == true )
{
if ( cmd ........
}
else MessagePlayer( "You need to be signed in!",player);
Change it to:
else if (status[ player.ID ].IsReg == true && status[ player.ID ].IsLogged == true )
{
MessagePlayer( "You need to be signed in!",player);
}
else if ( cmd ......
Not tested but I tried the same to fix my script!
Quote from: Mashreq on Nov 04, 2015, 10:59 AM !text or !arguments means it will not check if command is typed or not, it checks if a text after a command is given.
To setup an invalid command - error message you can use the following - which I am showing you for an example:
function onPlayerCommand( player, cmd, arguments )
{
if ( cmd == "test" )
{
MessagePlayer( "testing the command", player );
}
else if ( cmd == "hello" )
{
MessagePlayer( "hello " + player.Name, player );
}
else MessagePlayer( "Error - Invalid commad", player );
}
Now even Message is not coming
LOL!
Because he used arguments instead of the parameter text., or maybe something wrong in your script.
Quote from: KAKAN on Nov 04, 2015, 11:19 AMLOL!
Because he used arguments instead of the parameter text., or maybe something wrong in your script.
I tried Mashreq example?
Yea, you did.
His example just works fine