24.11.2013, 05:56
I was trying to create a kills and deaths textdraw . it compiles with no errors or warnings but it crashes ingame . after a certain number of deaths
Code
Code
pawn Код:
#include <a_samp>
#include <zcmd>
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new t[400];
new l[8][400];
public OnFilterScriptInit()
{
Textdraw0 = TextDrawCreate(480.000000, 460, "usebox");
TextDrawLetterSize(Textdraw0, 0.000000, -15);
TextDrawTextSize(Textdraw0, 640.000000, 0.000000);
TextDrawAlignment(Textdraw0, 1);
TextDrawColor(Textdraw0, 0);
TextDrawUseBox(Textdraw0, true);
TextDrawBoxColor(Textdraw0, 102);
TextDrawSetShadow(Textdraw0, 0);
TextDrawSetOutline(Textdraw0, 0);
TextDrawFont(Textdraw0, 0);
Textdraw1 = TextDrawCreate(480, 330, "~r~Kills ~b~And ~r~Deaths");
TextDrawLetterSize(Textdraw1, 0.2, 1.1);
TextDrawAlignment(Textdraw1, 1);
TextDrawColor(Textdraw1, -1);
TextDrawSetShadow(Textdraw1, 0);
TextDrawSetOutline(Textdraw1, 0);
TextDrawBackgroundColor(Textdraw1, 51);
TextDrawFont(Textdraw1, 1);
TextDrawSetProportional(Textdraw1, 1);
Textdraw2 = TextDrawCreate(480, 342, " ");
TextDrawLetterSize(Textdraw2, 0.2, 1.1);
TextDrawAlignment(Textdraw2, 1);
TextDrawColor(Textdraw2, -1);
TextDrawSetShadow(Textdraw2, 0);
TextDrawSetOutline(Textdraw2, 0);
TextDrawBackgroundColor(Textdraw2, 51);
TextDrawFont(Textdraw2, 1);
TextDrawSetProportional(Textdraw2, 1);
return 1;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(playerid != killerid && killerid != INVALID_PLAYER_ID)
{
new str[128];
new playern[MAX_PLAYER_NAME];
new killern[MAX_PLAYER_NAME];
GetPlayerName(playerid,playern,MAX_PLAYER_NAME);
GetPlayerName(killerid,killern,MAX_PLAYER_NAME);
format(str,128,"~w~ %s ~r~Was Killed By ~w~%s",playern,killern);
for(new i = 0 ; i <= 6 ; i++)
{
l[i] = l[i + 1];
}
l[7] = str;
format(t,400,"%s ~n~ %s ~n~ %s ~n~ %s ~n~ %s ~n~ %s ~n~ %s ~n~ %s",l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7]);
TextDrawSetString(Textdraw2,t);
TextDrawShowForAll(Textdraw2);
}
else if(playerid == killerid || killerid == INVALID_PLAYER_ID)
{
new str[128];
new playern[MAX_PLAYER_NAME];
GetPlayerName(playerid,playern,MAX_PLAYER_NAME);
format(str,128,"~w~ %s ~r~Has Committed Suicide",playern);
for(new i = 0 ; i <= 6 ; i++)
{
l[i] = l[i + 1];
}
l[7] = str;
format(t,400,"%s ~n~ %s ~n~ %s ~n~ %s ~n~ %s ~n~ %s ~n~ %s ~n~ %s ~n~ %s",l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7]);
TextDrawSetString(Textdraw2,t);
TextDrawShowForAll(Textdraw2);
}
return 1;
}
CMD:kill(playerid,params[])
{
SetPlayerHealth(playerid,0);
return 1;
}