/stats Error
#1

Error:

Код:
G:\GTA SA-MP Installers\SA-MP Server\0.3z Server\Golden Ghost Gamers Freeroam\gamemodes\GGG.pwn(21822) : error 076: syntax error in the expression, or invalid function call
Line 21822-21823:

Код:
 		format(sstring, sizeof(sstring),"%s's Stats:\nAdmin Level : %d\nRank : %s\n\nVIP Level : %d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nMoney: $%d\nBank: $%d\nTime Played: %d hrs %d mins %d secs",PlayerName2(player1),PlayerInfo[player1][Level],GetRankFromLevel,PlayerInfo[player1][VIP],PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1),PlayerInfo[player1][bank], h, m, s);
        return ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_LIST, "Stats", sstring, "Ok", "");
Fix This Please !!!
Reply
#2

show full code ?
Reply
#3

Quote:
Originally Posted by ChandraLouis
Посмотреть сообщение
show full code ?
Код:
CMD:stats(playerid,params[]) {
	new sstring[1024], pDeaths, player1, h, m, s;
	if(isnull(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(sstring, sizeof(sstring),"%s's Stats:\nAdmin Level : %d\nRank : %s\nVIP Level : %d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nMoney: $%d\nBank: $%d\nTime Played: %d hrs %d mins %d secs",PlayerName2(player1),PlayerInfo[player1][Level],GetRankFromLevel,PlayerInfo[player1][VIP],PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1),PlayerInfo[player1][bank], h, m, s);
        return ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_LIST, "Stats", sstring, "Ok", "");
	} else return SendClientMessage(playerid, red, "Player Not Connected!");
}
Reply
#4

the problem is due to this in format line "Float:PlayerInfo[player1][Kills]/FloatDeaths"
you cant do a calulation like this in for mat do it before it like this
pawn Код:
new Float:kdratio;
kdratio=PlayerInfo[player1][Kills]/pDeaths;
//and then that format line and in place of "Float:PlayerInfo[player1][Kills]/Float:pDeaths" use kdratio
Reply
#5

pawn Код:
CMD:stats(playerid,params[])
{
    new sstring[1024], pDeaths, player1, h, m, s;
    if(isnull(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(sstring, sizeof(sstring),"%s's Stats:\nAdmin Level : %d\nRank : %s\nVIP Level : %d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nMoney: $%d\nBank: $%d\nTime Played: %d hrs %d mins %d secs",PlayerName2(player1),PlayerInfo[player1][Level],GetRankFromLevel,PlayerInfo[player1][VIP],PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1),PlayerInfo[player1][bank], h, m, s);
        ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_LIST, "Stats", sstring, "Ok", "");
    }
    else return SendClientMessage(playerid, red, "Player Not Connected!");
}
Try it
Can you use [pawn] ?
Reply
#6

Quote:
Originally Posted by ChandraLouis
Посмотреть сообщение
pawn Код:
CMD:stats(playerid,params[])
{
    new sstring[1024], pDeaths, player1, h, m, s;
    if(isnull(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(sstring, sizeof(sstring),"%s's Stats:\nAdmin Level : %d\nRank : %s\nVIP Level : %d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nMoney: $%d\nBank: $%d\nTime Played: %d hrs %d mins %d secs",PlayerName2(player1),PlayerInfo[player1][Level],GetRankFromLevel,PlayerInfo[player1][VIP],PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1),PlayerInfo[player1][bank], h, m, s);
        ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_LIST, "Stats", sstring, "Ok", "");
    }
    else return SendClientMessage(playerid, red, "Player Not Connected!");
}
Try it
Can you use [pawn] ?
Still Having Errors:

Quote:

G:\GTA SA-MP Installers\SA-MP Server\0.3z Server\Golden Ghost Gamers Freeroam\gamemodes\GGG.pwn(21822) : error 076: syntax error in the expression, or invalid function call

Reply
#7

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
the problem is due to this in format line "Float:PlayerInfo[player1][Kills]/FloatDeaths"
you cant do a calulation like this in for mat do it before it like this
pawn Код:
new Float:kdratio;
kdratio=PlayerInfo[player1][Kills]/pDeaths;
//and then that format line and in place of "Float:PlayerInfo[player1][Kills]/Float:pDeaths" use kdratio
same error like ChandraLouis
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)