18.05.2014, 07:11
if an player uses my command /stats and he is seeing stats of player id 1 and then an other players types the same command and want's to see stats of playerid 2 the command will show everyone the stats of player id 2 even to those who are seeing of player id 1
pawn Код:
CMD:stats(playerid, params[])
{
new TargetID;
new string[500], str1[500], str[500];
if(sscanf(params, "u", TargetID)) TargetID = playerid;
if(TargetID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_RED, "*Player Is Not Connected.");
new score = GetPlayerScore(TargetID);
new cash = GetPlayerMoney(TargetID);
HideAllServerTextDraws(playerid);
format(str1, sizeof(str1),"~P~%s (%d)~W~~N~Score: ~G~%d",pInfo[TargetID][playername],TargetID,score);
TextDrawSetString(Stats[2], str1);
TextDrawShowForPlayer(playerid,Stats[2]);
format(string, sizeof(string),"~W~Kills~N~Deaths~N~Money~N~AD Pills Used~N~Raped~N~Got Raped~N~Times Flashed~N~Flash Kills~N~Insulted Kills~N~Flashed Deaths~N~Insulted Deaths~N~Money Bags Found");
TextDrawSetString(Stats[3], string);
TextDrawShowForPlayer(playerid,Stats[3]);
format(str, sizeof(str),"~G~%d~N~%d~N~$%d~N~%d~N~%d~N~%d~N~%d~N~%d~N~%d~N~%d~N~%d~N~%d",pInfo[TargetID][Kills],pInfo[TargetID][Deaths],cash,pInfo[TargetID][ad],pInfo[TargetID][raped],pInfo[TargetID][gotraped],pInfo[TargetID][flash],pInfo[TargetID][flash_kills],pInfo[TargetID][flash_deaths],pInfo[TargetID][foff_kills],pInfo[TargetID][foff_deaths],pInfo[playerid][MoneyBag_Founded]);
TextDrawSetString(Stats[4], str);
TextDrawShowForPlayer(playerid,Stats[4]);
TextDrawShowForPlayer(playerid,Stats[0]);
TextDrawShowForPlayer(playerid,Stats[1]);
TextDrawShowForPlayer(playerid,Stats[5]);
Stats_viewing[playerid] =1;
return 1;
}