25.04.2012, 09:27
i have two /stats commands and one is Dialog and 2nd one is text draw and i have dialog /stats but i want text draw can u help me
and this is text draw
and i add text draw command in my gm but error dont sent or send error report and then i click dont sent so my pawn is close but /stats not working can u give fix this textdraw /stats commands
Код:
if(strcmp(cmd, "/stats", true) == 0)
{
new string[345];new cName[MAX_PLAYER_NAME];GetPlayerName(playerid,cName,sizeof(cName));
new Str[10];
if(PlayerDonated[playerid]==true) format(Str,sizeof(Str),"Yes");
else if(PlayerDonated[playerid]==false) format(Str,sizeof(Str),"No");
format(string, sizeof string, "Account STATUS!\n\n\
Username: %s\n\
Money: $%d \n\
Score: %d \n\
WantedLevel: %d \n\
Donated: %s",
cName,GetPlayerMoney(playerid),GetPlayerScore(playerid),GetPlayerWantedLevel(playerid),Str);
ShowPlayerDialog(playerid, 6846, DIALOG_STYLE_MSGBOX, "Stats!", string, "Close", "");
return 1;
}
Код:
COMMAND:stats(playerid,params[])
{
new string[364];
new ID;
if(IsSpawned[playerid] != 1)
{
SendClientMessage(playerid,COLOR_RED,"You must be alive and spawned in order to be able to use this command.");
return 1;
}
if(sscanf(params, "u", ID))
{
ID=playerid;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server.",ID);
SendClientMessage(playerid,COLOR_RED,string);
return 1;
}
format(string, sizeof(string), "~b~%s's Stats ~y~ID:(%d)~n~~n~~n~~b~Kills: ~w~%d~n~~b~Deaths: ~w~%d~n~~b~Score: ~w~%d~n~~b~Wanted Level: ~w~%d~n~~b~Money Bags: ~w~%d~n~~b~Won Lotto: ~w~%d~n~~n~~b~Time On Server: ~g~%d:%d:%d~n~~b~Donator: ~g~Yes~n~~y~/Morestats",PlayerName(ID),ID,PI[ID][pKills], PI[ID][pDeaths],GetPlayerScore(ID),GetPlayerWantedLevel(ID),PI[ID][pRegular],PI[ID][pMoneyBags],PI[ID][pLotto],PI[ID][pHour],PI[ID][pMin],PI[ID][pSec]);
TextDrawSetString(Stats[playerid], string);
TextDrawShowForPlayer(playerid, Stats[playerid]);
}
return 1;
}

