[HELP] L Admin
#1

Hey i created a /stats
pawn Код:
#if defined USE_STATS
dcmd_stats(playerid,params[]) {
    new string[256], string2[256], string3[256], string4[256], string5[256], string6[256], string7[256], pDeaths, player1, h, m, s;
    if(!strlen(params)) player1 = playerid;
    else player1 = strval(params);
   
    if(IsPlayerConnected(player1)) {
        TotalGameTime(player1, h, m, s);
        if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
        format string, sizeof(string), "> Username: %s", PlayerName2(player1));
        format string2, sizeof(string2), "> Kills: %d", PlayerInfo[player1][Kills]);
        format string3, sizeof(string3), "> Deaths: %d", PlayerInfo[player1][Deaths]);
        format string4, sizeof(string4), "> Ratio: %0.2f", Float:PlayerInfo[player1][Kills]/Float:pDeaths);
        format string5, sizeof(string5), "> Money: %d", GetPlayerMoney(player1));
        format string6, sizeof(string6), "> Score: %d", GetPlayerScore(player1));
        foramt string7, sizeof(string7), "> Time: %d hours %d minutes %d seconds", h, m, s);
        return SendClientMessage(playerid, green, string);
        return SendClientMessage(playerid, green, string2);
        return SendClientMessage(playerid, green, string3);
        return SendClientMessage(playerid, green, string4);
        return SendClientMessage(playerid, green, string5);
        return SendClientMessage(playerid, green, string6);
        return SendClientMessage(playerid, green, string7);
    } else return SendClientMessage(playerid, red, "Player Not Connected!");
}
#endif
put i got erreors

pawn Код:
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4399) : error 076: syntax error in the expression, or invalid function call
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4399) : warning 215: expression has no effect
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4399) : warning 215: expression has no effect
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4399) : warning 215: expression has no effect
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4399) : error 001: expected token: ";", but found ")"
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4399) : error 029: invalid expression, assumed zero
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4399) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
How i can fix that ?
Reply
#2

what's the line 4399?
Reply
#3

Quote:
Originally Posted by blackwave
Посмотреть сообщение
what's the line 4399?
It's

pawn Код:
format string, sizeof(string), "> Username: %s", PlayerName2(player1));
Reply
#4

Might be caused by many reason. Might be you didn't define:
pawn Код:
new string[128];
Or didn't put params correct of: PlayerName2(player1)
Or even haven't the playername2 defined.
Reply
#5

You have '(' missing.
pawn Код:
format(string, sizeof(string), "> Username: %s", PlayerName2(player1));
Add this on your all strings, all your formats are wrong.
Reply
#6

Quote:
Originally Posted by FreshDoubleX
Посмотреть сообщение
You have '(' missing.
pawn Код:
format(string, sizeof(string), "> Username: %s", PlayerName2(player1));
Add this on your all strings, all your formats are wrong.
I added all

pawn Код:
#if defined USE_STATS
dcmd_stats(playerid,params[]) {
    new string[128], string2[128], string3[128], string4[128], string5[128], string6[128], string7[128], pDeaths, player1, h, m, s;
    if(!strlen(params)) player1 = playerid;
    else player1 = strval(params);
   
    if(IsPlayerConnected(player1)) {
        TotalGameTime(player1, h, m, s);
        if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
        format(string, sizeof(string), "> Username: %s", PlayerName2(player1));
        format (string2, sizeof(string2), "> Kills: %d", PlayerInfo[player1][Kills]);
        format (string3, sizeof(string3), "> Deaths: %d", PlayerInfo[player1][Deaths]);
        format (string4, sizeof(string4), "> Ratio: %0.2f", Float:PlayerInfo[player1][Kills]/Float:pDeaths);
        format (string5, sizeof(string5), "> Money: %d", GetPlayerMoney(player1));
        format (string6, sizeof(string6), "> Score: %d", GetPlayerScore(player1));
        foramt (string7, sizeof(string7), "> Time: %d hours %d minutes %d seconds", h, m, s);
        return SendClientMessage(playerid, green, string);
        return SendClientMessage(playerid, green, string2);
        return SendClientMessage(playerid, green, string3);
        return SendClientMessage(playerid, green, string4);
        return SendClientMessage(playerid, green, string5);
        return SendClientMessage(playerid, green, string6);
        return SendClientMessage(playerid, green, string7);
    } else return SendClientMessage(playerid, red, "Player Not Connected!");
}
#endif
Errors:

pawn Код:
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4405) : error 017: undefined symbol "foramt"
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4405) : warning 202: number of arguments does not match definition
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4405) : warning 202: number of arguments does not match definition
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4405) : warning 202: number of arguments does not match definition
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4405) : warning 202: number of arguments does not match definition
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4405) : warning 202: number of arguments does not match definition
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4407) : warning 225: unreachable code
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4408) : warning 225: unreachable code
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4409) : warning 225: unreachable code
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4410) : warning 225: unreachable code
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4411) : warning 225: unreachable code
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4412) : warning 225: unreachable code
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(7056) : error 001: expected token: "#endif", but found "-end of file-"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply
#7

Just check errors..
pawn Код:
foramt string7, sizeof(string7), "> Time: %d hours %d minutes %d seconds", h, m, s);
You have here 'foramt' instead of format.
Reply
#8

Rofl, seem you're "thoughtless"

Код:
error 017: undefined symbol "foramt"
Put format | instead "foramt"...

Код:
error 001: expected token: "#endif", but found "-end of file-"
Try this underneath
pawn Код:
#if defined USE_STATS
dcmd_stats(playerid,params[]) {
    new string[128], string2[128], string3[128], string4[128], string5[128], string6[128], string7[128], pDeaths, player1, h, m, s;
    if(!strlen(params)) player1 = playerid;
    else player1 = strval(params);
   
    if(IsPlayerConnected(player1)) {
        TotalGameTime(player1, h, m, s);
        if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
        format(string, sizeof(string), "> Username: %s", PlayerName2(player1));
        format (string2, sizeof(string2), "> Kills: %d", PlayerInfo[player1][Kills]);
        format (string3, sizeof(string3), "> Deaths: %d", PlayerInfo[player1][Deaths]);
        format (string4, sizeof(string4), "> Ratio: %0.2f", Float:PlayerInfo[player1][Kills]/Float:pDeaths);
        format (string5, sizeof(string5), "> Money: %d", GetPlayerMoney(player1));
        format (string6, sizeof(string6), "> Score: %d", GetPlayerScore(player1));
        foramt (string7, sizeof(string7), "> Time: %d hours %d minutes %d seconds", h, m, s);
        return SendClientMessage(playerid, green, string);
        return SendClientMessage(playerid, green, string2);
        return SendClientMessage(playerid, green, string3);
        return SendClientMessage(playerid, green, string4);
        return SendClientMessage(playerid, green, string5);
        return SendClientMessage(playerid, green, string6);
        return SendClientMessage(playerid, green, string7);
    } else return SendClientMessage(playerid, red, "Player Not Connected!");
    #endif
}
Reply
#9

You can just use one string on every message Much easier.

pawn Код:
#if defined USE_STATS
dcmd_stats(playerid,params[])
{
        new string[128], pDeaths, player1, h, m, s;
        if(!strlen(params)) player1 = playerid;
        else player1 = strval(params);

        if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, red, "Player Not Connected!");
   
        TotalGameTime(player1, h, m, s);
        if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
        format(string, sizeof(string), "> Username: %s", PlayerName2(player1));
        SendClientMessage(playerid, green, string);
        format(string, sizeof(string), "> Kills: %d", PlayerInfo[player1][Kills]);
        SendClientMessage(playerid, green, string2);
        format(string, sizeof(string), "> Deaths: %d", PlayerInfo[player1][Deaths]);
        SendClientMessage(playerid, green, string2);
        format(string, sizeof(string), "> Ratio: %0.2f", Float:PlayerInfo[player1][Kills]/Float:pDeaths);
        SendClientMessage(playerid, green, string2);
        format(string, sizeof(string), "> Money: %d", GetPlayerMoney(player1));
        SendClientMessage(playerid, green, string2);
        format(string, sizeof(string), "> Score: %d", GetPlayerScore(player1));
        SendClientMessage(playerid, green, string2);
        format(string, sizeof(string), "> Time: %d hours %d minutes %d seconds", h, m, s);
        SendClientMessage(playerid, green, string2);
}
#endif
Reply
#10

Quote:
Originally Posted by FreshDoubleX
Посмотреть сообщение
You can just use one string on every message Much easier.

pawn Код:
#if defined USE_STATS
dcmd_stats(playerid,params[])
{
        new string[128], pDeaths, player1, h, m, s;
        if(!strlen(params)) player1 = playerid;
        else player1 = strval(params);

        if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, red, "Player Not Connected!");
   
        TotalGameTime(player1, h, m, s);
        if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
        format(string, sizeof(string), "> Username: %s", PlayerName2(player1));
        SendClientMessage(playerid, green, string);
        format(string, sizeof(string), "> Kills: %d", PlayerInfo[player1][Kills]);
        SendClientMessage(playerid, green, string2);
        format(string, sizeof(string), "> Deaths: %d", PlayerInfo[player1][Deaths]);
        SendClientMessage(playerid, green, string2);
        format(string, sizeof(string), "> Ratio: %0.2f", Float:PlayerInfo[player1][Kills]/Float:pDeaths);
        SendClientMessage(playerid, green, string2);
        format(string, sizeof(string), "> Money: %d", GetPlayerMoney(player1));
        SendClientMessage(playerid, green, string2);
        format(string, sizeof(string), "> Score: %d", GetPlayerScore(player1));
        SendClientMessage(playerid, green, string2);
        format(string, sizeof(string), "> Time: %d hours %d minutes %d seconds", h, m, s);
        SendClientMessage(playerid, green, string2);
}
#endif
thx i make string 0 - 7

but one waring

pawn Код:
C:\Users\Kodu\Desktop\Unity Stuntages 0.3c\filterscripts\ladmin4v2.pwn(4415) : warning 209: function "dcmd_stats" should return a value
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
wich value i should add ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)