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)
+--- Thread: Unknown Command (
/showthread.php?tid=636196)
Unknown Command -
Cyboorg - 22.06.2017
I;ve implemented this code:
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(IsPlayerAdmin(playerid))
{
if(!strcmp("/gotomb", cmdtext, true))
{
SetPlayerPos(playerid, MoneyBagPos[0], MoneyBagPos[1] +3, MoneyBagPos[2]);
return SendClientMessage(playerid, -1, "You have been {FF0000}teleported {FFFFFF}to the {33FF66}money bag");
}
if(!strcmp("/startmb", cmdtext, true)) return MoneyBag();
if(!strcmp("/togglemb", cmdtext, true))
{
if(Timer[0] == 0)
{
KillTimer(Timer[1]);
Timer[0] = 1;
SendClientMessage(playerid, -1, "Money bag turned {FF0000} off!");
return 1;
}
if(Timer[0] == 1)
{
Timer[1] = SetTimer("MoneyBag", MB_DELAY, true);
Timer[0] = 0;
SendClientMessage(playerid, -1, "Money bag turned {33FF66} on!");
return 1;
}
return 1;
}
}
if(!strcmp("/moneybag", cmdtext, true))
{
new string[150];
if(!MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag has been {FF0000}hidden in {FFFF66}%s!", MoneyBagLocation);
if(MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag is {FF0000} not running!");
return SendClientMessage(playerid, -1, string);
}
if(!strcmp("/mb", cmdtext, true))
{
new string[150];
if(!MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag has been {FF0000}hidden in {FFFF66}%s!", MoneyBagLocation);
if(MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag is {FF0000} not running!");
return SendClientMessage(playerid, -1, string);
}
if(!strcmp("/teleport", cmdtext, true))
{
SetPlayerPos(playerid, -1967.8365, 2956.9823, 12.9375);
return 1;
}
return 0;
}
But when i run the game ,i type one of the command it says Server: Unknown Command ?,i got no error while compiling....
Where is the problem?
Re: Unknown Command -
Abagail - 22.06.2017
Besides the fact you're still using slower and obsolete methods for processing commands, returning 0 at the end results in the invalid command message showing if nothing above it returned 1.
Re: Unknown Command - Astralis - 22.06.2017
Use ZCMD.
Re: Unknown Command -
Cyboorg - 23.06.2017
Same method was in samp.wiki !! What to use then ?
Re: Unknown Command -
rolex - 23.06.2017
To code, you don't need to follow the "road". Open your mind! Create new a "road" or search how to do it and use the better tools for it.
The Wiki is only to you get the "
North".
Here, in wiki you can find
ZCMD too.
https://sampwiki.blast.hk/wiki/Fast_Commands
Re: Unknown Command -
HoussemGaming - 23.06.2017
use ZCMD
Re: Unknown Command -
Threshold - 23.06.2017
You can't suggest for him to use ZCMD as a solution when he only has 6 commands... this method would probably actually be faster than ZCMD at this point.
Which command are you trying to use? You have 3 commands, "/gotomb, /startmb, /togglemb", that require you to be logged into RCON, otherwise it will give you an 'Unknown Command' error.
Re: Unknown Command -
Meller - 23.06.2017
Quote:
Originally Posted by Astralis
Use ZCMD.
|
get on my level
pawncmd