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\n", GetPlayerScore(playerid), string); format(string, sizeof(string), "Money: $%d\n", GetPlayerMoney(playerid), string); format(string, sizeof(string), "Kills: %d\n", PlayerInfo[playerid][pKills], string); format(string, sizeof(string), "Deaths: %d\n", PlayerInfo[playerid][pDeaths], string); format(string, sizeof(string), "Ratio: %0.2f\n", GetTeamName(playerid), string); format(string, sizeof(string), "Team: %s\n", GetTeamName(playerid), string); format(string, sizeof(string), "Rank: %s\n", GetRankName(playerid), string); format(string, sizeof(string), "Class: %s\n", GetClassName(playerid), string); format(string, sizeof(string), "Admin Level: %d\n", PlayerInfo[playerid][pAdmin], string); format(string, sizeof(string), "Helper: %d\n", PlayerInfo[playerid][pHelper], string); ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, "{FF6666}Player Stats", string, "Okay",""); } else if(IsPlayerConnected(id)) { format(string, sizeof(string), "_Statistics for '%s'_",PlayerName(playerid)); SendClientMessage(playerid, green, string); format(string, sizeof(string), "Score: %d\n", GetPlayerScore(playerid), string); format(string, sizeof(string), "Money: $%d\n", GetPlayerMoney(playerid), string); format(string, sizeof(string), "Kills: %d\n", PlayerInfo[playerid][pKills], string); format(string, sizeof(string), "Deaths: %d\n", PlayerInfo[playerid][pDeaths], string); format(string, sizeof(string), "Ratio: %0.2f\n", GetTeamName(playerid), string); format(string, sizeof(string), "Team: %s\n", GetTeamName(playerid), string); format(string, sizeof(string), "Rank: %s\n", GetRankName(playerid), string); format(string, sizeof(string), "Class: %s\n", GetClassName(playerid), string); format(string, sizeof(string), "Admin Level: %d\n", PlayerInfo[playerid][pAdmin], string); format(string, sizeof(string), "Helper: %d\n", PlayerInfo[playerid][pHelper], string); ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, "{FF6666}Player Stats", string, "Okay",""); } else SendClientMessage(playerid,RED,"[ERROR]: Player is not connected"); return 1; }
new id, tmp[50], string[1028];
sscanf(params, "u", id);
if (isnull(params))
{
format(string, sizeof(string), "_Statistics for '%s'_",PlayerName(playerid));
SendClientMessage(playerid, green, string);
format(tmp, sizeof(tmp), "Score: %d\n", GetPlayerScore(playerid));
strcat(string, tmp);
format(tmp, sizeof(tmp), "Money: $%d\n", GetPlayerMoney(playerid));
strcat(string, tmp);
You can use strcat to join more than one string together. You need to format each "line" (Score, Money etc.) then add it to "string" using strcat.
pawn Код:
You can read more here: https://sampwiki.blast.hk/wiki/Strcat |