Invalid 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: Invalid command (
/showthread.php?tid=527141)
Invalid command -
iBots - 21.07.2014
Well,i am using strcmp and ZCMD in my gamemode at the same time and they both work,but how can i detect if he entered invalid strcmp command and invalid Zcmd command?please help +rep
Re: Invalid command -
IceBilizard - 21.07.2014
for zcmd
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Unknown Command.");
return 1;
}
and for strcmp use in end of commands
example
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/epr", cmdtext, true) == 0)
{
SetPlayerPos(playerid, -2660.8555,1425.6328,906.4609);
return 1;
}
return 0;
}
it will show unknown command automatically.
Re: Invalid command -
iBots - 21.07.2014
But now if i enter a command that is scripted with ZCMD it will send me the message that gets send in strcmp...
And if i do command which is scripted in strcmp it will send me ZCMD message...
Re: Invalid command -
KayJ - 21.07.2014
Quote:
Originally Posted by IceBilizard
for zcmd
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success) { if(!success) SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Unknown Command."); return 1; }
|
it should be like this-
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
{
new str[256];
format(str, sizeof(str), "Command '%s' "orange"doesn't exist", cmdtext);
SendClientMessage(playerid, -1, str);
}
return 1;
}
---
You can use only 1 command processor if you are using strcmp and want to convert to zcmd see this-
https://sampforum.blast.hk/showthread.php?tid=459934
+rep if helped
Re: Invalid command -
IceBilizard - 21.07.2014
Then Use strcmp commands under OnPlayerCommandPerformed and make sure you return 1
Re: Invalid command -
iBots - 21.07.2014
Not really,you can have 2 processors but i need to know if player entered a command that doent exist in the two processors...please help
Re: Invalid command -
Scottas - 21.07.2014
and why do you need both of them? Choose only one (prefer zcmd)
Re: Invalid command -
iBots - 21.07.2014
I got more than 700 commands snd maybe more than 1000 and half of them are zcmd and other half is strcmp,how can i change them all?
Re: Invalid command -
Raza2013 - 21.07.2014
Here you go:
Click Me