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;
}
foreach(new playerid : Player)
{
Stats[0] = CreatePlayerTextDraw(playerid,118.000000, 122.000000, "~l~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~N~~N~~N~~N~~N~~N~");
PlayerTextDrawAlignment(playerid,Stats[0], 2);
PlayerTextDrawBackgroundColor(playerid,Stats[0], 255);
PlayerTextDrawFont(playerid,Stats[0], 1);
PlayerTextDrawLetterSize(playerid,Stats[0], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,Stats[0], -1);
PlayerTextDrawSetOutline(playerid,Stats[0], 0);
PlayerTextDrawSetProportional(playerid,Stats[0], 1);
PlayerTextDrawSetShadow(playerid,Stats[0], 1);
PlayerTextDrawUseBox(playerid,Stats[0], 1);
PlayerTextDrawBoxColor(playerid,Stats[0], 110);
PlayerTextDrawTextSize(playerid,Stats[0], -1.000000, 212.000000);
PlayerTextDrawSetSelectable(playerid,Stats[0], 0);
}
new PlayerText:Stats[10][MAX_PLAYERS];
//OnPlayerConnect
Stats[0][playerid] = CreatePlayerTextDraw(playerid,118.000000, 122.000000, "~l~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~N~~N~~N~~N~~N~~N~");
PlayerTextDrawAlignment(playerid,Stats[0][playerid], 2);
PlayerTextDrawBackgroundColor(playerid,Stats[0][playerid], 255);
PlayerTextDrawFont(playerid,Stats[0][playerid], 1);
PlayerTextDrawLetterSize(playerid,Stats[0][playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,Stats[0][playerid], -1);
PlayerTextDrawSetOutline(playerid,Stats[0][playerid], 0);
PlayerTextDrawSetProportional(playerid,Stats[0][playerid], 1);
PlayerTextDrawSetShadow(playerid,Stats[0][playerid], 1);
PlayerTextDrawUseBox(playerid,Stats[0][playerid], 1);
PlayerTextDrawBoxColor(playerid,Stats[0][playerid], 110);
PlayerTextDrawTextSize(playerid,Stats[0][playerid], -1.000000, 212.000000);
PlayerTextDrawSetSelectable(playerid,Stats[0][playerid], 0);
new PlayerText:Stats[10][MAX_PLAYERS]; //On to top under includes
public OnGameModeInit()
{
Stats[0] = (playerid,118.000000, 122.000000, "~l~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~N~~N~~N~~N~~N~~N~");
PlayerTextDrawAlignment(playerid,Stats[0], 2);
PlayerTextDrawBackgroundColor(playerid,Stats[0], 255);
PlayerTextDrawFont(playerid,Stats[0], 1);
PlayerTextDrawLetterSize(playerid,Stats[0], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,Stats[0], -1);
PlayerTextDrawSetOutline(playerid,Stats[0], 0);
PlayerTextDrawSetProportional(playerid,Stats[0], 1);
PlayerTextDrawSetShadow(playerid,Stats[0], 1);
PlayerTextDrawUseBox(playerid,Stats[0], 1);
PlayerTextDrawBoxColor(playerid,Stats[0], 110);
PlayerTextDrawTextSize(playerid,Stats[0], -1.000000, 212.000000);
PlayerTextDrawSetSelectable(playerid,Stats[0], 0);
return 1;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, Stats[0]);
return 1;
}
In you GameModeInit you dont need foreach because it textdraw already showed for everyone.
pawn Код:
|
he need a foreach if he want to add it in ongamemodeinit
because playerid isnt defined in OnGameModeInit |
No he dont need loop it because it's already showed for everyone. I also maked this way my speedomeeter. But if really need foreach, I make for him when
|
Settings[playerid][0] = CreatePlayerTextDraw(playerid,118.000000, 122.000000, "~l~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~");
new Text:Settings[MAX_PLAYERS][6]; // is my define for it
new PlayerText:Settings[MAX_PLAYERS][6];