Vice City: Multiplayer

Server Development => Scripting and Server Management => Script and Content Requests => Topic started by: Humzasajjad on Sep 30, 2018, 03:59 PM

Title: Invalid command feature
Post by: Humzasajjad on Sep 30, 2018, 03:59 PM
If i write anycommand which is not exist in script there was written invalid command plz tell me any script....
Title: Re: Invalid command feature
Post by: MEGAMIND on Sep 30, 2018, 04:12 PM
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);
}
Title: Re: Invalid command feature
Post by: NicusorN5 on Sep 30, 2018, 04:59 PM
I would recommend using a switch-case in this situation.
Title: Re: Invalid command feature
Post by: Humzasajjad on Oct 01, 2018, 06:30 PM
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
Title: Re: Invalid command feature
Post by: Xhefri on Oct 01, 2018, 08:41 PM
You already got an answer from MEGAMIND.Add this in the end of onPlayerCommand
else MessagePlayer("Invalid Command",player);
}
Title: Re: Invalid command feature
Post by: Humzasajjad on Oct 02, 2018, 05:10 PM
Thanx u all!
Title: Re: Invalid command feature
Post by: Humzasajjad on Oct 05, 2018, 07:43 AM
allfine but if i type any cmd i.e /heal there was written
you successful healed
invalid command

why?
Title: Re: Invalid command feature
Post by: MEGAMIND on Oct 05, 2018, 09:39 AM
Quote from: Athanatos on Sep 30, 2018, 04:59 PMI would recommend using a switch-case in this situation.
Title: Re: Invalid command feature
Post by: NicusorN5 on Oct 05, 2018, 10:21 AM
Nah he propably forgot to put a break instruction into the cases.