one command is returning SERVER: Unknown Command
#1

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 Код:
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.
Reply
#2

EDIT: Never mind, just saw you wrote "ONE"
Reply
#3

bump
Reply
#4

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

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

Try printing every line ?
Reply
#6

https://sampwiki.blast.hk/wiki/Debugging
Reply
#7

pawn Код:
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
Reply
#8

Quote:
Originally Posted by MP2
Посмотреть сообщение
That page is inexistent. Did you even tried to go there or you just write random stuff ?!
Reply
#9

Quote:
Originally Posted by Berlovan
Посмотреть сообщение
That page is inexistent. Did you even tried to go there or you just write random stuff ?!
Works fine enough for me

Edit: I'm an idiot
Reply
#10

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
Works fine enough for me

Edit: I'm an idiot
Well, you said it.

OT: Did you tried removing the Ratio ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)