SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 19/11/2011, 10:27 PM   #1
admantis
High-roller
 
admantis's Avatar
 
Join Date: Sep 2009
Posts: 2,292
Reputation: 242
Default one command is returning SERVER: Unknown Command

Hello everybody,

I had this command working perfectly before .. I did alot of changes which I cannot revert anymore and now ONLY this command gives SERVER: Unknown Command like it did not exist.

pawn Code:
CMD:stats( playerid, params[] )
{
    if ( !LoggedIn[ playerid ] ) return SendClientMessage ( playerid, -1, " You need to log in first! " );
    new iCrenshawRank = PlayerInfo[playerid][CrenshawRank];
    new iMurdablockRank = PlayerInfo[playerid][MurdablockRank];
    new iLatinKingsRank = PlayerInfo[playerid][LatinKingsRank];
    new iBlackMobRank = PlayerInfo[playerid][BlackMobRank];
    new iRollinCripsRank = PlayerInfo[playerid][RollinCripsRank];
    new iCriminalJusticeRank = PlayerInfo[playerid][CriminalJusticeRank];
    new iShingTriadRank = PlayerInfo[playerid][ShingTriadRank];
    new iRussianMafiaRank = PlayerInfo[playerid][RussianMafiaRank];
    new iAztecasRank = PlayerInfo[playerid][AztecaRank];
   
    new iCrenshawKills = PlayerInfo[playerid][CrenshawKills];
    new iMurdablockKills = PlayerInfo[playerid][MurdablockKills];
    new iLatinKingsKills = PlayerInfo[playerid][LatinKingsKills];
    new iBlackMobKills = PlayerInfo[playerid][BlackMobKills];
    new iRollinCripsKills = PlayerInfo[playerid][RollinCripsKills];
    new iCriminalJusticeKills = PlayerInfo[playerid][CriminalJusticeKills];
    new iShingTriadKills = PlayerInfo[playerid][ShingTriadKills];
    new iRussianMafiaKills = PlayerInfo[playerid][RussianMafiaKills];
    new iAztecasKills = PlayerInfo[playerid][AztecaKills];
   
    PlayerInfo[playerid][Ratio] = PlayerInfo[playerid][Kills] / PlayerInfo[playerid][Deaths];
   
    SendClientMessage( playerid, COLOR_LIGHTBLUE, "____________________________________________");

    new szString[128], szRank[32];
    format( szString, 128, "{FFFFFF}General:{FF9900} [Overall Kills: %d] [Deaths: %d] [Ratio: %0.2f]",
    PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], Float:PlayerInfo[playerid][Ratio] );
    SendClientMessage( playerid, -1, szString );
   
    format( szString, 128, "{FFFFFF}Other:{FF9900} [Warnings: %d] [Kicks: %d] [Admin Level: %d]",
    PlayerInfo[playerid][Warnings], PlayerInfo[playerid][Kicks], PlayerInfo[playerid][Admin] );
    SendClientMessage( playerid, -1, szString );

    switch ( Team[playerid] )
    {
        case TEAM_CRENSHAW:
        {
            switch ( PlayerInfo[playerid][CrenshawRank] )
            {
                case 1: szRank = "New Blood";
                case 2: szRank = "Hustla'";
                case 3: szRank = "Big Homie";
                case 4: szRank = "King Blood";
            }
           
            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Crenshaw Mafia Bloods] [Rank: %s (%d)] [Gang Points: %d]", szRank, iCrenshawRank, iCrenshawKills );
            SendClientMessage( playerid, -1, szString );
        }
       
        case TEAM_MURDABLOCK:
        {
            switch ( PlayerInfo[playerid][MurdablockRank] )
            {
                case 1: szRank = "Goon";
                case 2: szRank = "Soulja'";
                case 3: szRank = "Gangsta'";
                case 4: szRank = "Original Gangsta'";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Murdablock] [Rank: %s (%d)] [Gang Points: %d]", szRank, iMurdablockRank, iMurdablockKills );
            SendClientMessage( playerid, -1, szString );
        }
       
        case TEAM_LATINKINGS:
        {
            switch ( PlayerInfo[playerid][LatinKingsRank] )
            {
                case 1: szRank = "Cholo";
                case 2: szRank = "Chico";
                case 3: szRank = "Vato";
                case 4: szRank = "El Jefe";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Latin Kings] [Rank: %s (%d)] [Gang Points: %d]", szRank, iLatinKingsRank, iLatinKingsKills );
            SendClientMessage( playerid, -1, szString );
        }
       
        case TEAM_BLACKMOB:
        {
            switch ( PlayerInfo[playerid][BlackMobRank] )
            {
                case 1: szRank = "New Nigga";
                case 2: szRank = "Pusha'";
                case 3: szRank = "Gunna'";
                case 4: szRank = "Black General";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Black Mob] [Rank: %s (%d)] [Gang Points: %d]", szRank, iBlackMobRank, iBlackMobKills );
            SendClientMessage( playerid, -1, szString );
        }
       
        case TEAM_ROLLINCRIPS:
        {
            switch ( PlayerInfo[playerid][RollinCripsRank] )
            {
                case 1: szRank = "Young Crip";
                case 2: szRank = "Loc";
                case 3: szRank = "Tru' Crip";
                case 4: szRank = "Triple O.G";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Rollin' 60 Crips] [Rank: %s (%d)] [Gang Points: %d]", szRank, iRollinCripsRank, iRollinCripsKills );
            SendClientMessage( playerid, -1, szString );
        }
       
        case TEAM_AZTECAS:
        {
            switch ( PlayerInfo[playerid][AztecaRank] )
            {
                case 1: szRank = "New Nigga";
                case 2: szRank = "Pusha'";
                case 3: szRank = "Gunna'";
                case 4: szRank = "Black General";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Los Aztecas] [Rank: %s (%d)] [Gang Points: %d]", szRank, iAztecasRank, iAztecasKills );
            SendClientMessage( playerid, -1, szString );
        }
       
        case TEAM_CJUSTICE:
        {
            switch ( PlayerInfo[playerid][CriminalJusticeRank] )
            {
                case 1: szRank = "Cadet";
                case 2: szRank = "Officer";
                case 3: szRank = "Sergeant";
                case 4: szRank = "Commander";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Criminal Justice] [Rank: %s (%d)] [Gang Points: %d]", szRank, iCriminalJusticeRank, iCriminalJusticeKills );
            SendClientMessage( playerid, -1, szString );
        }
       
        case TEAM_SHINGTRIAD:
        {
            switch ( PlayerInfo[playerid][ShingTriadRank] )
            {
                case 1: szRank = "Member";
                case 2: szRank = "Enforcer";
                case 3: szRank = "Deputy";
                case 4: szRank = "Dragon Head";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Shing Triads] [Rank: %s (%d)] [Gang Points: %d]", szRank, iShingTriadRank, iShingTriadKills );
            SendClientMessage( playerid, -1, szString );
        }
       
        case TEAM_RUSSIANMAFIA:
        {
            switch ( PlayerInfo[playerid][RussianMafiaRank] )
            {
                case 1: szRank = "Outsider";
                case 2: szRank = "Associate";
                case 3: szRank = "Soldier";
                case 4: szRank = "Right Hand";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Russian Mafia] [Rank: %s (%d)] [Gang Points: %d]", szRank, iRussianMafiaRank, iRussianMafiaKills );
            SendClientMessage( playerid, -1, szString );
        }
        default:
        {
            SendClientMessage( playerid, -1, "{FFFFFF}Gang:{FF9900} Couldn't get any data.");
        }
    }

    SendClientMessage( playerid, COLOR_LIGHTBLUE, "____________________________________________");

    return 1;
}

I hope you can tell me why it gives that. And I would appreciate no critices about perfomance that's not my query.
admantis is offline   Reply With Quote
Old 19/11/2011, 10:36 PM   #2
iNorton
High-roller
 
iNorton's Avatar
 
Join Date: Oct 2011
Location: United Kingdom
Posts: 1,226
Reputation: 245
Default Re: one command is returning SERVER: Unknown Command

EDIT: Never mind, just saw you wrote "ONE"
iNorton is offline   Reply With Quote
Old 20/11/2011, 03:44 PM   #3
admantis
High-roller
 
admantis's Avatar
 
Join Date: Sep 2009
Posts: 2,292
Reputation: 242
Default Re: one command is returning SERVER: Unknown Command

bump
admantis is offline   Reply With Quote
Old 20/11/2011, 03:48 PM   #4
Berlovan
Gangsta
 
Berlovan's Avatar
 
Join Date: Dec 2009
Posts: 993
Reputation: 129
Default Re: one command is returning SERVER: Unknown Command

PlayerInfo[playerid][Ratio] = PlayerInfo[playerid][Kills] / PlayerInfo[playerid][Deaths];

Watch over there for the ratio. There is a mathematical problem. If Death == 0 then it can't be processed. Why ? Because anynumber/0 can't be calculated. You can't divide by 0. I had such a problem with my stats textdraw.
__________________

hi
Berlovan is offline   Reply With Quote
Old 20/11/2011, 03:49 PM   #5
grand.Theft.Otto
High-roller
 
grand.Theft.Otto's Avatar
 
Join Date: Sep 2010
Location: Canada
Posts: 1,074
Reputation: 65
Default Re: one command is returning SERVER: Unknown Command

Something inside of your command could probably be causing it to return Unknown Command.

Try printing every line ?
__________________


grand.Theft.Otto is offline   Reply With Quote
Old 20/11/2011, 03:51 PM   #6
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,316
Reputation: 909
Default Re: one command is returning SERVER: Unknown Command

http://wiki.sa-mp.com/wiki/Debugging
__________________
>> Click here to see my releases.

Please do not PM me requesting help. Here you have a forum with 11,000+ active users - why are you limiting your help to one person?
MP2 is offline   Reply With Quote
Old 20/11/2011, 03:52 PM   #7
Pharrel
High-roller
 
Pharrel's Avatar
 
Join Date: Feb 2011
Location: Brazil
Posts: 1,535
Reputation: 132
Default Re: one command is returning SERVER: Unknown Command

pawn Code:
CMD:stats( playerid )
{
    if ( !LoggedIn[ playerid ] ) return SendClientMessage ( playerid, -1, " You need to log in first! " );
    new iCrenshawRank = PlayerInfo[playerid][CrenshawRank];
    new iMurdablockRank = PlayerInfo[playerid][MurdablockRank];
    new iLatinKingsRank = PlayerInfo[playerid][LatinKingsRank];
    new iBlackMobRank = PlayerInfo[playerid][BlackMobRank];
    new iRollinCripsRank = PlayerInfo[playerid][RollinCripsRank];
    new iCriminalJusticeRank = PlayerInfo[playerid][CriminalJusticeRank];
    new iShingTriadRank = PlayerInfo[playerid][ShingTriadRank];
    new iRussianMafiaRank = PlayerInfo[playerid][RussianMafiaRank];
    new iAztecasRank = PlayerInfo[playerid][AztecaRank];

    new iCrenshawKills = PlayerInfo[playerid][CrenshawKills];
    new iMurdablockKills = PlayerInfo[playerid][MurdablockKills];
    new iLatinKingsKills = PlayerInfo[playerid][LatinKingsKills];
    new iBlackMobKills = PlayerInfo[playerid][BlackMobKills];
    new iRollinCripsKills = PlayerInfo[playerid][RollinCripsKills];
    new iCriminalJusticeKills = PlayerInfo[playerid][CriminalJusticeKills];
    new iShingTriadKills = PlayerInfo[playerid][ShingTriadKills];
    new iRussianMafiaKills = PlayerInfo[playerid][RussianMafiaKills];
    new iAztecasKills = PlayerInfo[playerid][AztecaKills];

    PlayerInfo[playerid][Ratio] = PlayerInfo[playerid][Kills] / PlayerInfo[playerid][Deaths];

    SendClientMessage( playerid, COLOR_LIGHTBLUE, "____________________________________________");

    new szString[128], szRank[32] = " ";
    format( szString, 128, "{FFFFFF}General:{FF9900} [Overall Kills: %d] [Deaths: %d] [Ratio: %0.2f]",
    PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], Float:PlayerInfo[playerid][Ratio] );
    SendClientMessage( playerid, -1, szString );

    format( szString, 128, "{FFFFFF}Other:{FF9900} [Warnings: %d] [Kicks: %d] [Admin Level: %d]",
    PlayerInfo[playerid][Warnings], PlayerInfo[playerid][Kicks], PlayerInfo[playerid][Admin] );
    SendClientMessage( playerid, -1, szString );

    switch ( Team[playerid] )
    {
        case TEAM_CRENSHAW:
        {
            switch ( PlayerInfo[playerid][CrenshawRank] )
            {
                case 1: szRank = "New Blood";
                case 2: szRank = "Hustla'";
                case 3: szRank = "Big Homie";
                case 4: szRank = "King Blood";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Crenshaw Mafia Bloods] [Rank: %s (%d)] [Gang Points: %d]", szRank, iCrenshawRank, iCrenshawKills );
            SendClientMessage( playerid, -1, szString );
        }

        case TEAM_MURDABLOCK:
        {
            switch ( PlayerInfo[playerid][MurdablockRank] )
            {
                case 1: szRank = "Goon";
                case 2: szRank = "Soulja'";
                case 3: szRank = "Gangsta'";
                case 4: szRank = "Original Gangsta'";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Murdablock] [Rank: %s (%d)] [Gang Points: %d]", szRank, iMurdablockRank, iMurdablockKills );
            SendClientMessage( playerid, -1, szString );
        }

        case TEAM_LATINKINGS:
        {
            switch ( PlayerInfo[playerid][LatinKingsRank] )
            {
                case 1: szRank = "Cholo";
                case 2: szRank = "Chico";
                case 3: szRank = "Vato";
                case 4: szRank = "El Jefe";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Latin Kings] [Rank: %s (%d)] [Gang Points: %d]", szRank, iLatinKingsRank, iLatinKingsKills );
            SendClientMessage( playerid, -1, szString );
        }

        case TEAM_BLACKMOB:
        {
            switch ( PlayerInfo[playerid][BlackMobRank] )
            {
                case 1: szRank = "New Nigga";
                case 2: szRank = "Pusha'";
                case 3: szRank = "Gunna'";
                case 4: szRank = "Black General";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Black Mob] [Rank: %s (%d)] [Gang Points: %d]", szRank, iBlackMobRank, iBlackMobKills );
            SendClientMessage( playerid, -1, szString );
        }

        case TEAM_ROLLINCRIPS:
        {
            switch ( PlayerInfo[playerid][RollinCripsRank] )
            {
                case 1: szRank = "Young Crip";
                case 2: szRank = "Loc";
                case 3: szRank = "Tru' Crip";
                case 4: szRank = "Triple O.G";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Rollin' 60 Crips] [Rank: %s (%d)] [Gang Points: %d]", szRank, iRollinCripsRank, iRollinCripsKills );
            SendClientMessage( playerid, -1, szString );
        }

        case TEAM_AZTECAS:
        {
            switch ( PlayerInfo[playerid][AztecaRank] )
            {
                case 1: szRank = "New Nigga";
                case 2: szRank = "Pusha'";
                case 3: szRank = "Gunna'";
                case 4: szRank = "Black General";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Los Aztecas] [Rank: %s (%d)] [Gang Points: %d]", szRank, iAztecasRank, iAztecasKills );
            SendClientMessage( playerid, -1, szString );
        }

        case TEAM_CJUSTICE:
        {
            switch ( PlayerInfo[playerid][CriminalJusticeRank] )
            {
                case 1: szRank = "Cadet";
                case 2: szRank = "Officer";
                case 3: szRank = "Sergeant";
                case 4: szRank = "Commander";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Criminal Justice] [Rank: %s (%d)] [Gang Points: %d]", szRank, iCriminalJusticeRank, iCriminalJusticeKills );
            SendClientMessage( playerid, -1, szString );
        }

        case TEAM_SHINGTRIAD:
        {
            switch ( PlayerInfo[playerid][ShingTriadRank] )
            {
                case 1: szRank = "Member";
                case 2: szRank = "Enforcer";
                case 3: szRank = "Deputy";
                case 4: szRank = "Dragon Head";
            }

            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Shing Triads] [Rank: %s (%d)] [Gang Points: %d]", szRank, iShingTriadRank, iShingTriadKills );
            SendClientMessage( playerid, -1, szString );
        }

        case TEAM_RUSSIANMAFIA:
        {
            switch ( PlayerInfo[playerid][RussianMafiaRank] )
            {
                case 1: szRank = "Outsider";
                case 2: szRank = "Associate";
                case 3: szRank = "Soldier";
                case 4: szRank = "Right Hand";
            }
            format( szString, 128, "{FFFFFF}Gang:{FF9900} [Gang: Russian Mafia] [Rank: %s (%d)] [Gang Points: %d]", szRank, iRussianMafiaRank, iRussianMafiaKills );
            SendClientMessage( playerid, -1, szString );
        }
        default: SendClientMessage( playerid, -1, "{FFFFFF}Gang:{FF9900} Couldn't get any data.");
    }
    return SendClientMessage( playerid, COLOR_LIGHTBLUE, "____________________________________________");
}

i cant see nothing wrong but try this way
__________________

"Afirmo que ambos somos ateus. Apenas acredito num deus a menos que você.
Quando você entender porque é que rejeita todos os outros deuses possíveis,
entenderá porque é que eu rejeito o seu."
Stephen Henry Roberts
Pharrel is offline   Reply With Quote
Old 20/11/2011, 03:53 PM   #8
Berlovan
Gangsta
 
Berlovan's Avatar
 
Join Date: Dec 2009
Posts: 993
Reputation: 129
Default Re: one command is returning SERVER: Unknown Command

Quote:
Originally Posted by MP2 View Post
That page is inexistent. Did you even tried to go there or you just write random stuff ?!
__________________

hi
Berlovan is offline   Reply With Quote
Old 20/11/2011, 03:56 PM   #9
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,316
Reputation: 909
Default Re: one command is returning SERVER: Unknown Command

The link works fine now, try again.
__________________
>> Click here to see my releases.

Please do not PM me requesting help. Here you have a forum with 11,000+ active users - why are you limiting your help to one person?
MP2 is offline   Reply With Quote
Old 20/11/2011, 03:58 PM   #10
Berlovan
Gangsta
 
Berlovan's Avatar
 
Join Date: Dec 2009
Posts: 993
Reputation: 129
Default Re: one command is returning SERVER: Unknown Command

Yes it works now, sorry ^^
__________________

hi
Berlovan 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
all commands in my GM and FS's including Npc record script returning ERROR UNKNOWN COMMAND Zonoya Scripting Help 4 23/10/2011 08:59 PM
all commands in one FS returning ERROR:Unknown Command Zonoya Scripting Help 18 01/10/2011 10:04 PM
Returning unknown command. Fat Scripting Help 19 21/09/2011 07:44 AM
SERVER: Unknown Command when using a scripted command and it does execute! Moustafa Help Archive 6 11/06/2010 01:34 PM
2 Commands returning "SERVER: Unknown command" _Vortex Help Archive 6 08/01/2010 08:38 PM


All times are GMT. The time now is 02:39 PM.


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