pawn Код:
foreach(new playerid : Player)
{
Stats[playerid][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[playerid][0], 2);
PlayerTextDrawBackgroundColor(playerid,Stats[playerid][0], 255);
PlayerTextDrawFont(playerid,Stats[playerid][0], 1);
PlayerTextDrawLetterSize(playerid,Stats[playerid][0], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,Stats[playerid][0], -1);
PlayerTextDrawSetOutline(playerid,Stats[playerid][0], 0);
PlayerTextDrawSetProportional(playerid,Stats[playerid][0], 1);
PlayerTextDrawSetShadow(playerid,Stats[playerid][0], 1);
PlayerTextDrawUseBox(playerid,Stats[playerid][0], 1);
PlayerTextDrawBoxColor(playerid,Stats[playerid][0], 110);
PlayerTextDrawTextSize(playerid,Stats[playerid][0], -1.000000, 212.000000);
PlayerTextDrawSetSelectable(playerid,Stats[playerid][0], 0);
Stats[playerid][1] = CreatePlayerTextDraw(playerid,120.000000, 131.000000, "~g~Stats");
PlayerTextDrawAlignment(playerid,Stats[playerid][1], 2);
PlayerTextDrawBackgroundColor(playerid,Stats[playerid][1], 255);
PlayerTextDrawFont(playerid,Stats[playerid][1], 3);
PlayerTextDrawLetterSize(playerid,Stats[playerid][1], 0.460000, 1.299999);
PlayerTextDrawColor(playerid,Stats[playerid][1], -1);
PlayerTextDrawSetOutline(playerid,Stats[playerid][1], 1);
PlayerTextDrawSetProportional(playerid,Stats[playerid][1], 1);
PlayerTextDrawSetSelectable(playerid,Stats[playerid][1], 0);
Stats[playerid][2] = CreatePlayerTextDraw(playerid,120.000000, 154.000000, "~w~Press ~y~LMB ~w~ To Close This Box");
PlayerTextDrawAlignment(playerid,Stats[playerid][2], 2);
PlayerTextDrawBackgroundColor(playerid,Stats[playerid][2], 255);
PlayerTextDrawFont(playerid,Stats[playerid][2], 1);
PlayerTextDrawLetterSize(playerid,Stats[playerid][2], 0.250000, 0.899999);
PlayerTextDrawColor(playerid,Stats[playerid][2], -1);
PlayerTextDrawSetOutline(playerid,Stats[playerid][2], 1);
PlayerTextDrawSetProportional(playerid,Stats[playerid][2], 1);
PlayerTextDrawSetSelectable(playerid,Stats[playerid][2], 0);
Stats[playerid][3] = CreatePlayerTextDraw(playerid,34.5, 170.000000, "");
PlayerTextDrawAlignment(playerid,Stats[playerid][3], 1);
PlayerTextDrawBoxColor(playerid,Stats[playerid][3], 255);
PlayerTextDrawFont(playerid,Stats[playerid][3], 1);
PlayerTextDrawLetterSize(playerid,Stats[playerid][3], 0.230000, 1.000000);
PlayerTextDrawColor(playerid,Stats[playerid][3], -1);
PlayerTextDrawSetOutline(playerid,Stats[playerid][3], 1);
PlayerTextDrawSetProportional(playerid,Stats[playerid][3], 1);
PlayerTextDrawSetSelectable(playerid,Stats[playerid][3], 0);
Stats[playerid][4] = CreatePlayerTextDraw(playerid,155.5, 170.000000, "");
PlayerTextDrawAlignment(playerid,Stats[playerid][4], 1);
PlayerTextDrawBoxColor(playerid,Stats[playerid][4], 255);
PlayerTextDrawFont(playerid,Stats[playerid][4], 1);
PlayerTextDrawLetterSize(playerid,Stats[playerid][4], 0.230000, 1.000000);
PlayerTextDrawColor(playerid,Stats[playerid][4], -1);
PlayerTextDrawSetOutline(playerid,Stats[playerid][4], 1);
PlayerTextDrawSetProportional(playerid,Stats[playerid][4], 1);
PlayerTextDrawSetSelectable(playerid,Stats[playerid][4], 0);
Stats[playerid][5] = CreatePlayerTextDraw(playerid,121.000000, 285.000000, "~w~Press ~y~LMB ~w~ To Close This Box");
PlayerTextDrawAlignment(playerid,Stats[playerid][5], 2);
PlayerTextDrawBackgroundColor(playerid,Stats[playerid][5], 255);
PlayerTextDrawFont(playerid,Stats[playerid][5], 1);
PlayerTextDrawLetterSize(playerid,Stats[playerid][5], 0.230000, 1.000000);
PlayerTextDrawColor(playerid,Stats[playerid][5], -1);
PlayerTextDrawSetOutline(playerid,Stats[playerid][5], 1);
PlayerTextDrawSetProportional(playerid,Stats[playerid][5], 1);
PlayerTextDrawSetSelectable(playerid,Stats[playerid][5], 0);
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);
PlayerTextDrawSetString(playerid,Stats[playerid][2], str1);
PlayerTextDrawShow(playerid,Stats[playerid][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");
PlayerTextDrawSetString(playerid,Stats[playerid][3], string);
PlayerTextDrawShow(playerid,Stats[playerid][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]);
PlayerTextDrawSetString(playerid,Stats[playerid][4], str);
PlayerTextDrawShow(playerid,Stats[playerid][4]);
PlayerTextDrawShow(playerid,Stats[playerid][0]);
PlayerTextDrawShow(playerid,Stats[playerid][1]);
PlayerTextDrawShow(playerid,Stats[playerid][5]);
Stats_viewing[playerid] =1;
return 1;
}
you must create PlayerTextdraws under OnPlayerConnect not under OnGameModeInit..
and dont forget to destroy them onplayerdisconnect so ur server wont be laggy
@JFF: you dont need to destroy the playertextdraws if a player disconnect there will be deleted