05.06.2015, 09:25
Hello today i have added the player stats to dialog..but i got errors..many i fix some of them but others didn't fix
the old stats:
the new stats(dialog)
ERRORS:
any solution ? Fast pls ..and i have already added admins/donor on dialog ..
EDIT: this dialog was working on my old cod gamemode..and now didn't work on my new cod server
the old stats:
Код:
CMD:stats(playerid,params[]) { new id, string[1028]; sscanf(params, "u", id); if (isnull(params)) { format(string, sizeof(string), "_Statistics for '%s'_",PlayerName(playerid)); SendClientMessage(playerid, green, string); format(string, sizeof(string), "Score: %d | Money: $%d | Kills: %d | Deaths: %d | Ratio: %0.2f ", GetPlayerScore(playerid), GetPlayerMoney(playerid), PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], Float:PlayerInfo[playerid][pKills]/Float:PlayerInfo[playerid][pDeaths]); SendClientMessage(playerid, yellow, string); format(string, sizeof(string), "Team: %s | Rank: %s | Class: %s | Admin Level: %d | Helper: %d ", GetTeamName(playerid), GetRankName(playerid), GetClassName(playerid), PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pHelper]); SendClientMessage(playerid, yellow, string); } else if(IsPlayerConnected(id)) { format(string, sizeof(string), "_Statistics for '%s'_",PlayerName(id)); SendClientMessage(playerid, green, string); format(string, sizeof(string), "Score: %d | Money: $%d | Kills: %d | Deaths: %d | Ratio: %0.2f ", GetPlayerScore(id), GetPlayerMoney(id), PlayerInfo[id][pKills], PlayerInfo[id][pDeaths], Float:PlayerInfo[id][pKills]/Float:PlayerInfo[id][pDeaths]); SendClientMessage(playerid, yellow, string); format(string, sizeof(string), "Team: %s | Rank: %s | Class: %s | Admin Level: %d | Helper: %d ", GetTeamName(id), GetRankName(id), GetClassName(id), PlayerInfo[id][pAdmin], PlayerInfo[id][pHelper]); SendClientMessage(playerid, yellow, string); } else SendClientMessage(playerid,RED,"[ERROR]: Player is not connected"); return 1; }
Код:
CMD:stats(playerid, params[]) { new str2[1000]; new str[1000], Deaths, playerid,h, m, s, name[MAX_PLAYER_NAME]; if(isnull(params) (name) = playerid; else playerid = strval(params); if(IsPlayerConnected(playerid)) { TotalGameTime(playerid, h, m, s); GetPlayerName(playerid, name, sizeof(name)); if(PlayerInfo[playerid][pDeaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[playerid][pDeaths]; format(str, sizeof str, "Name: %s\n\n Scores: %d\n\n Money: $%d\n\n Kills: %d\n\n Deaths: %d\n\n K/D Ratio: %0.2f \n\n", PlayerName2(playerid), GetPlayerScore(playerid), GetPlayerMoney(playerid), PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], Float:PlayerInfo[playerid][pKills]/Float:pDeaths); strcat(str2, str); format(str, sizeof str, "Admin Level: %d\n\n Operator: %s\n\n Rank: %s\n\n Team:\n %s\n Class: %s\n\n", PlayerInfo[playerid][padmin], PlayerInfo[playerid][pHelper] ? ("Yes") : ("No"), GetRankName(playerid), GetTeamName(playerid), GetClass(playerid)); strcat(str2, str); format(str, sizeof str, "Vip:%s\n\nTimePlayed: [%d] hrs [%d] mins [%d] secs\n\nZones:\n", PlayerInfo[playerid][pVIP] ? ("Yes") : ("No"), h, m, s); strcat(str2, str); ShowPlayerDialog(playerid, 44, DIALOG_STYLE_MSGBOX, ""cred"User Statistics", str2, "Close", ""); } else return SendClientMessage(playerid, red, "[ERROR]: Player Not Connected!"); return 1; }
Код:
C:\Users\PC\Desktop\Younes\SAMP Version\gamemodes\COD-DW-v1.50.pwn(1424) : warning 219: local variable "playerid" shadows a variable at a preceding level C:\Users\PC\Desktop\Younes\SAMP Version\gamemodes\COD-DW-v1.50.pwn(1425) : error 029: invalid expression, assumed zero C:\Users\PC\Desktop\Younes\SAMP Version\gamemodes\COD-DW-v1.50.pwn(1425) : error 033: array must be indexed (variable "name") C:\Users\PC\Desktop\Younes\SAMP Version\gamemodes\COD-DW-v1.50.pwn(1428) : error 017: undefined symbol "TotalGameTime" C:\Users\PC\Desktop\Younes\SAMP Version\gamemodes\COD-DW-v1.50.pwn(1430) : error 022: must be lvalue (non-constant) C:\Users\PC\Desktop\Younes\SAMP Version\gamemodes\COD-DW-v1.50.pwn(1430) : warning 215: expression has no effect C:\Users\PC\Desktop\Younes\SAMP Version\gamemodes\COD-DW-v1.50.pwn(1430) : error 029: invalid expression, assumed zero C:\Users\PC\Desktop\Younes\SAMP Version\gamemodes\COD-DW-v1.50.pwn(1430) : error 022: must be lvalue (non-constant) C:\Users\PC\Desktop\Younes\SAMP Version\gamemodes\COD-DW-v1.50.pwn(1430) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 7 Errors.
EDIT: this dialog was working on my old cod gamemode..and now didn't work on my new cod server