SA-MP Forums Archive
Using ZCMD and giving me unknown command? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Using ZCMD and giving me unknown command? (/showthread.php?tid=224394)



Using ZCMD and giving me unknown command? - Spiral - 11.02.2011

Hey! So as I started using zcmd, I made a command like this for a simple test:
pawn Код:
COMMAND:help(playerid, params[])
{
    SendClientMessage(playerid, COLOR_WHITE,"IT WORKS!");
}
Now when i go ingame and type /help it gives me the message and after that: SERVER: Unknown command. How could I fix this? I'm using both includes, zcmd and sscanf.

They are not placed in the onplayercommandtext function because it wont let me.


Re: Using ZCMD and giving me unknown command? - Rock18 - 11.02.2011

Add this somewhere in your gamemode
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    return 1;
}



Re: Using ZCMD and giving me unknown command? - Spiral - 11.02.2011

Just like that? Why so? It is true it worked.


Re: Using ZCMD and giving me unknown command? - Rock18 - 11.02.2011

Yea , just like that , don't ask me why and how it works because i don't know i just use it )


Re: Using ZCMD and giving me unknown command? - xRyder - 11.02.2011

WOW! @Rock18 - Dude, that code what you gave him is not wrong or anything, but that code will do a totally different thing from what he asked.

@Spiral - When you are doing the commands in ZCMD you NEED to return them as true/false.

Your command should look like:

pawn Код:
COMMAND:help(playerid, params[])
{
    SendClientMessage(playerid, COLOR_WHITE,"IT WORKS!");
    return 1; // You see this. You need to return it as a false/true!
}



Re: Using ZCMD and giving me unknown command? - Spiral - 11.02.2011

Well whats the difference? I used many commands in a row, why should I waste 50 more lines on 50 more commands, if i could only use 4 lines?


Re: Using ZCMD and giving me unknown command? - [03]Garsino - 11.02.2011

Because it tells the script that the command was successfull.


Re: Using ZCMD and giving me unknown command? - xRyder - 11.02.2011

Quote:
Originally Posted by Spiral
Посмотреть сообщение
Well whats the difference? I used many commands in a row, why should I waste 50 more lines on 50 more commands, if i could only use 4 lines?
LMAO! Don't be scared to waste lines.
And you'll have your script working more smother. You can look here to see how the commands work with ZCMD.


Re: Using ZCMD and giving me unknown command? - Retardedwolf - 11.02.2011

Quote:
Originally Posted by Spiral
Посмотреть сообщение
Well whats the difference? I used many commands in a row, why should I waste 50 more lines on 50 more commands, if i could only use 4 lines?
First person who I have seen which do not like "lines" in their script and consider it as "waste".


Re: Using ZCMD and giving me unknown command? - Mean - 11.02.2011

If you want to save your lines, put return before your last function.
pawn Код:
COMMAND:help(playerid, params[])
{
    return SendClientMessage(playerid, COLOR_WHITE,"IT WORKS!");
}