If i write anycommand which is not exist in script there was written invalid command plz tell me any script....
function onPlayerCommand( player, cmd, text )
{
if(cmd == "hello")
{
MessagePlayer("server says hello back",player);
}
else if(cmd == newcmdhere){
//stuff goes here
}
else MessagePlayer("Invalid Command",player);
}
I would recommend using a switch-case in this situation.
Quote from: Humzasajjad on Sep 30, 2018, 03:59 PMIf i write anycommand which is not exist in script there was written invalid command plz tell me any script....
i need this function.i really need plz give me.plz
You already got an answer from MEGAMIND.Add this in the end of onPlayerCommand
else MessagePlayer("Invalid Command",player);
}
Thanx u all!
allfine but if i type any cmd i.e /heal there was written
you successful healed
invalid command
why?
Quote from: Athanatos on Sep 30, 2018, 04:59 PMI would recommend using a switch-case in this situation.
Nah he propably forgot to put a break instruction into the cases.