30.09.2013, 18:36
Quote:
Your using 7 formats when you should only be using 1 (Possibly 2 if the string is too long and you need strcat) each successive format clears the action of the last so you'll only ever end up with the last formatted string of course.
Example (You will need to complete this) pawn Код:
|
Код:
dcmd_stats(playerid,params[]) { new str[512], pDeaths, player1, h, m, s; new status[2][10] = {"Disabled", "Enabled"}; if(!strlen(params)) player1 = playerid; else player1 = strval(params); if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, white, "{FF0000}>> Player not Connected"); TotalGameTime(player1, h, m, s); if(AccInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = AccInfo[player1][Deaths]; format(str, sizeof(str), "{DAA520}%s (ID: %d){B0C4DE}\n\n", PlayerName2(player1), player1); format(str, sizeof(str), "%sSkinID: %d\n", str, GetPlayerSkin(player1)); format(str, sizeof(str), "%sScore: %d\n", str, GetPlayerScore(player1)); format(str, sizeof(str), "%sKills: %d\n", str, AccInfo[player1][Kills]); format(str, sizeof(str), "%sMoney: $%d\n", str, GetPlayerMoney(player1)); format(str, sizeof(str), "%sRatio: %.2f\n", str, Float:AccInfo[player1][Kills]/Float:pDeaths); format(str, sizeof(str), "%sReputations: +%d\n\n", str, AccInfo[player1][Reps]); format(str, sizeof(str), "%sInterior: %d\n", str, GetPlayerInterior(player1)); format(str, sizeof(str), "%sTime Login: %d hours %d minutes %d seconds\n", str, h, m, s); ShowPlayerDialog(playerid, 8435, DIALOG_STYLE_MSGBOX, "Player Statistics", str, "Close", ""); return 1; } #endif
Код:
format(Jstring, sizeof(Jstring), "{ffd700}%s (ID:%d)\n\n \ Score: %d\n \ Money: $%d\n", pName, playerid, GetPlayerScore(playerid), GetPlayerMoney(playerid));