CMD:stats(playerid, params[])
{
new id;
new Cash = PlayerInfo[id][pCash];
new Deaths = PlayerInfo[id][pDeaths];
new Kills = PlayerInfo[id][pKills];
new Score = PlayerInfo[id][pScore];
new pName[24];
new string[128];
if(sscanf(params, "u", id))
return SendClientMessage(playerid, DEEPPINK, "USAGE: /stats <id>");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected.");
{
GetPlayerName(playerid, pName, sizeof pName);
format(string, sizeof(string), "{00FF22}===============[Stats of {FFFFFF}%s{00FF22}]==============", pName);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{FFFFFF}Cash: {00FF22}%d $", Cash);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{FFFFFF}Deaths: {00FF22}%d {FFFFFF}| Kills: {00FF22}%d", Deaths, Kills);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{FFFFFF}Score: {00FF22}%d", Score);
SendClientMessage(playerid, -1, string);
SendClientMessage(playerid, -1, "{00FF22}================================================");
}
return 1;
}
CMD:stats(playerid, params[])
{
new id;
new Cash = PlayerInfo[id][pCash];
new Deaths = PlayerInfo[id][pDeaths];
new Kills = PlayerInfo[id][pKills];
new Score = PlayerInfo[id][pScore];
new pName[24];
new string[128];
new rank[30];
switch(Kills)
{
case 0..100: rank= "None";
case 101..500: rank= "Savage Killer";
//Setting the rank according to the kills
}
if(sscanf(params, "u", id))
return SendClientMessage(playerid, DEEPPINK, "USAGE: /stats <id>");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected.");
{
GetPlayerName(playerid, pName, sizeof pName);
format(string, sizeof(string), "{00FF22}===============[Stats of {FFFFFF}%s{00FF22}]==============", pName);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{FFFFFF}Cash: {00FF22}%d $ | {FFFFFF}Rank: {00FF22}%s", Cash , rank);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{FFFFFF}Deaths: {00FF22}%d {FFFFFF}| Kills: {00FF22}%d", Deaths, Kills);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{FFFFFF}Score: {00FF22}%d", Score);
SendClientMessage(playerid, -1, string);
SendClientMessage(playerid, -1, "{00FF22}================================================");
}
return 1;
}
Should probably move it to a function since it's something that will probably be used in multiple places
|
CMD:stats(playerid, params[])
{
new Rank[playerid][100];
new id;
new Cash = PlayerInfo[id][pCash];
new Deaths = PlayerInfo[id][pDeaths];
new Kills = PlayerInfo[id][pKills];
new Score = PlayerInfo[id][pScore];
new pName[24];
new string[128];
if(GetPlayerScore(playerid)>=0)
{ Rank[playerid]="Noobie"; }
if(sscanf(params, "u", id))
return SendClientMessage(playerid, DEEPPINK, "USAGE: /stats <id>");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected.");
{
GetPlayerName(playerid, pName, sizeof pName);
format(string, sizeof(string), "{00FF22}===============[Stats of {FFFFFF}%s{00FF22}]==============", pName);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{FFFFFF}Cash: {00FF22}%d $", Cash);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{FFFFFF}Deaths: {00FF22}%d {FFFFFF}| Kills: {00FF22}%d", Deaths, Kills);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{FFFFFF}Score: {00FF22}%d |{FFFFFF}Rank: {00FF22}%s", Score, Rank[playerid]);
SendClientMessage(playerid, -1, string);
SendClientMessage(playerid, -1, "{00FF22}================================================");
}
return 1;
}
if(GetPlayerScore(playerid)>=0)
{ Rank[playerid]="Noobie"; }
I used [playerid] with the rank variable to prevent the conflict of stats string showing if any occurs.
You may add this function: (just example) pawn Код:
pawn Код:
|