Invalid command
#1

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
Reply
#2

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

pawn Код:
return 0;
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.
Reply
#3

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...
Reply
#4

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
for zcmd

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Unknown Command.");
    return 1;
}
pawn Код:
 

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
Reply
#5

Then Use strcmp commands under OnPlayerCommandPerformed and make sure you return 1
Reply
#6

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
Reply
#7

and why do you need both of them? Choose only one (prefer zcmd)
Reply
#8

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?
Reply
#9

Here you go: Click Me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)