06.08.2010, 17:11
Textdraw crashes player when /stat
its the LAdmin /stats but i changed command && put in as textdraw but i cant get it to work or stop crashing player, any help?
pawn Код:
dcmd_stat(playerid,params[]) {
new string[128], pDeaths, player1, h, m, s;
if(!strlen(params)) player1 = playerid;
else player1 = strval(params);
if(IsPlayerConnected(player1)) {
TotalGameTime(player1, h, m, s);
if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
Stats = TextDrawCreate(740.0,620.0,"~g~~h~ Stats: \n~b~h~~Kills: \nDeaths: ~r~~h~\nRatio: ~g~~h~\nMoney: ~b~~h~\nTime: hrs mins secs ~r~~h~\n Stats");
TextDrawBoxColor(Stats,0x000000AA);
TextDrawAlignment(Stats,2);
TextDrawFont(Stats,2);
TextDrawLetterSize(Stats,3.2,5.1);
TextDrawTextSize(Stats,2.0,3.6);
TextDrawSetOutline(Stats,1);
format(string,sizeof(string),"~%s's Stats: \nKills: %d \nDeaths: %d \nRatio: %0.2f \nMoney: $%d \nTime: %d hrs %d mins %d secs \n%s's Stats",PlayerName2(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1), h, m, s, PlayerName2(player1));
TextDrawSetString(Stats,string);
return TextDrawShowForPlayer(playerid,Stats);
} else return SendClientMessage(playerid, red, "Player Not Connected!");
}