SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 30/12/2011, 05:09 PM   #1
SexTourist
Little Clucker
 
Join Date: Dec 2009
Posts: 12
Reputation: 0
Question Executed ZCMD command returns SERVER: Unknown Command

Hello everyone,
I use ZCMD, sscanf and Diler's MultiLanguage include.
When I try to use /kick command without being an admin, first MultiLanguage language returns both !success message and SERVER: Unknown command.
Here is the command:
Code:
COMMAND:kick(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3) return 0; //LanguageMessage(playerid, COLOR_RED, LANGUAGE_EN, "You can't use this command!", LANGUAGE_LT, "Negali naudoti šios komandos!");
    new pid, reason[105];
	if(sscanf(params, "uS(No Reason Given)[128]", pid, reason)) return LanguageMessage(playerid, COLOR_RED, LANGUAGE_EN, ""GREEN"Usage: "WHITE"/kick [playerid/name] [reason].", LANGUAGE_LT, ""WHITE"Naudojimas:"GREEN" /kick [id/vardas] [priežastis]");
    if(IsPlayerConnected(pid) && pid != INVALID_PLAYER_ID && pid != playerid)
    {
        new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180], ltstring[180];
        GetPlayerName(pid, paramname, sizeof(paramname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        format(string, sizeof(string), "%s has been kicked by %s for: %s", paramname, adminname, reason);
        format(ltstring, sizeof(ltstring), "%s iškickino %s už: %s", adminname, paramname, reason);
        LanguageMessageToAll(COLOR_LIME, LANGUAGE_EN, string, LANGUAGE_LT, ltstring);
        Kick(pid);
    }
    else return LanguageMessage(playerid, COLOR_RED, LANGUAGE_EN, "You can't kick yourself or player that is not connected!", LANGUAGE_LT, "Negali iškickinti savęs ar žaidėjo kuris neprisijungęs!");
	return 1;
}
When this
Code:
if(PlayerInfo[playerid][pAdmin] >= 3) return 0; //LanguageMessage(playerid, COLOR_RED, LANGUAGE_EN, "You can't use this command!", LANGUAGE_LT, "Negali naudoti šios komandos!");
is used, it returns me 3 messages:
You can't use this command!
There is no such command. Type /cmds for commands list.
SERVER: Unknown command.

Here is my OnPlayerCommandPerformed callback:
Code:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
   	if(!success) return LanguageMessage(playerid, 0xFF0000FF, LANGUAGE_EN, "{FFFFFF}[LFR]: {FF0000}There is no such command. Type /cmds for commands list.", LANGUAGE_LT, "{FFFFFF}[LFR]: {FF0000}Tokios komandos nėra! Rašykite /komandos, kad pamatytumėte komandų sarašą.");
   	return 1;
}
I'm out of ideas. Don't know what to do. Could it be MultiLanguage's fault?
SexTourist is offline   Reply With Quote
Old 30/12/2011, 06:39 PM   #2
[O.z]Caroline
High-roller
 
[O.z]Caroline's Avatar
 
Join Date: Sep 2011
Location: Brazil
Posts: 1,463
Reputation: 92
Default Re: Executed ZCMD command returns SERVER: Unknown Command

pawn Code:
COMMAND:kick(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3) return 0; //LanguageMessage(playerid, COLOR_RED, LANGUAGE_EN, "You can't use this command!", LANGUAGE_LT, "Negali naudoti šios komandos!");
    new pid, reason[105];
    if(sscanf(params, "us[128]", pid, reason))
        return LanguageMessage(playerid, COLOR_RED, LANGUAGE_EN, ""GREEN"Usage: "WHITE"/kick [playerid/name] [reason].", LANGUAGE_LT, ""WHITE"Naudojimas:"GREEN" /kick [id/vardas] [priežastis]");

    if(reason == ' ' || reason == EOS) format(reason, sizeof(reason),"No Reason Given");
   
    if(IsPlayerConnected(pid) && pid != INVALID_PLAYER_ID && pid != playerid)
    {
        new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180], ltstring[180];
        GetPlayerName(pid, paramname, sizeof(paramname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        format(string, sizeof(string), "%s has been kicked by %s for: %s", paramname, adminname, reason);
        format(ltstring, sizeof(ltstring), "%s iškickino %s už: %s", adminname, paramname, reason);
        LanguageMessageToAll(COLOR_LIME, LANGUAGE_EN, string, LANGUAGE_LT, ltstring);
        Kick(pid);
    }
    else return LanguageMessage(playerid, COLOR_RED, LANGUAGE_EN, "You can't kick yourself or player that is not connected!", LANGUAGE_LT, "Negali iškickinti savęs ar žaidėjo kuris neprisijungęs!");
    return 1;
}
__________________
[O.z]Caroline is offline   Reply With Quote
Old 30/12/2011, 06:49 PM   #3
SexTourist
Little Clucker
 
Join Date: Dec 2009
Posts: 12
Reputation: 0
Default Re: Executed ZCMD command returns SERVER: Unknown Command

Your code gives me
Code:
error 033: array must be indexed (variable "reason")
wich is this line:
Code:
if(reason == ' ' || reason == EOS) format(reason, sizeof(reason),"No Reason Given");
Huh
SexTourist is offline   Reply With Quote
Old 30/12/2011, 06:51 PM   #4
Jefff
High-roller
 
Join Date: Dec 2007
Posts: 1,747
Reputation: 138
Default Re: Executed ZCMD command returns SERVER: Unknown Command

reason[0]
Jefff is offline   Reply With Quote
Old 30/12/2011, 06:52 PM   #5
[O.z]Caroline
High-roller
 
[O.z]Caroline's Avatar
 
Join Date: Sep 2011
Location: Brazil
Posts: 1,463
Reputation: 92
Default Re: Executed ZCMD command returns SERVER: Unknown Command

yeah
pawn Code:
if(reason[0] == ' ' || reason[0] == EOS) format(reason, sizeof(reason),"No Reason Given");
__________________
[O.z]Caroline is offline   Reply With Quote
Old 30/12/2011, 07:03 PM   #6
SexTourist
Little Clucker
 
Join Date: Dec 2009
Posts: 12
Reputation: 0
Default Re: Executed ZCMD command returns SERVER: Unknown Command

Thank you for your help, but still, once I type this, or any other command it gives me:
SexTourist is offline   Reply With Quote
Old 30/12/2011, 07:22 PM   #7
Jefff
High-roller
 
Join Date: Dec 2007
Posts: 1,747
Reputation: 138
Default Re: Executed ZCMD command returns SERVER: Unknown Command

public OnPlayerCommandReceived(playerid, cmdtext[])
Jefff is offline   Reply With Quote
Old 30/12/2011, 08:16 PM   #8
SexTourist
Little Clucker
 
Join Date: Dec 2009
Posts: 12
Reputation: 0
Default Re: Executed ZCMD command returns SERVER: Unknown Command

Can you explain what do I need to do with it? I've added OnPlayerCommandReceived(playerid, cmdtext[]).
SexTourist is offline   Reply With Quote
Old 01/01/2012, 04:13 PM   #9
SexTourist
Little Clucker
 
Join Date: Dec 2009
Posts: 12
Reputation: 0
Default Re: Executed ZCMD command returns SERVER: Unknown Command

Sorry for BUMP'ing, but I need to know this. Script developing has stopped. :/
SexTourist is offline   Reply With Quote
Old 01/01/2012, 04:55 PM   #10
Bogdan1992
Huge Clucker
 
Bogdan1992's Avatar
 
Join Date: Dec 2011
Location: Romania
Posts: 267
Reputation: 21
Default Re: Executed ZCMD command returns SERVER: Unknown Command

Use this
PHP Code:
if(PlayerInfo[playerid][pAdmin] <= 3) return 0
or
PHP Code:
if(PlayerInfo[playerid][pAdmin] == 3) return 0
Bogdan1992 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slap command returns an Unknown Command when player is not connected HydraX Help Archive 16 01/08/2011 05:19 AM
'SERVER:UNKNOWN COMMAND' using ZCMD. maramizo Help Archive 4 17/03/2011 09:33 PM
Command returns SERVER: Unknown command admantis Help Archive 7 09/12/2010 07:52 AM
Command that returns SERVER: Unknown Command. pagie1111 Help Archive 11 11/04/2010 09:55 AM
Commands working, but returns Server: Unknown Command WickWoody Help Archive 1 09/09/2009 12:13 AM


All times are GMT. The time now is 08:34 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.