SERVER: UNKNOWN COMMAND
#1

pawn Код:
CMD:stats(playerid, params[])
{
    if(GetPVarInt(playerid, "Logged") == 1)
    {
        new kills = GetPVarInt(playerid, "Kills"), deaths = GetPVarInt(playerid, "Deaths");
        format(string, sizeof string, "{00CFCF}Username: {FFFFFF}%s\n\n{00CFCF}Money: {FFFFFF}%i\n{00CFCF}Score: {FFFFFF}%i\n\n{00CFCF}Kills: {FFFFFF}%i\n{00CFCF}Deaths: {FFFFFF}%i\n{00CFCF}Ratio: {FFFFFF}%02f",
        GetName(playerid), GetPlayerMoney(playerid), GetPlayerScore(playerid), GetPVarInt(playerid, "Kills"), GetPVarInt(playerid, "Deaths"), ((kills) / (deaths)));
        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Statistics", string, "Send", "Close");
    }
    return 1;
}
Says UNKNOWN COMMAND ingame.
If i comment out either the ratio or string it will work.
Reply
#2

Try to return 1 before the if statement but leave that one as it is
Also u can remove the Params since ur not using it
If that doesn't work then I would say but the kills & deaths into separate lines !
Reply
#3

try kills/deaths instead of ((kills) / (deaths))
Reply
#4

Still unknown command, ratio is the cause.
Reply
#5

Look for codes that are before the command and have [minor] mistakes.
I had a public function before one of my commands and it didn't work because I screwed the function up.
Reply
#6

I think that the string is too big for dialog - Try to put just one \n for each new line.
Reply
#7

It is the ratio that is causing it not to work.
I have tried printing the ratio etc, none of it works.
Reply
#8

How are you defining the ratio ?

Eg:
pawn Код:
new Float:ratio = floatdiv(your kills variable),(your deaths variable);
Outputs kills and death ratio %.2f
Reply
#9

Dosent work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)