Textdraw problem only updates for id 1
#1

yo i did an kill/deathtextdraw which should show the kill/deathstats of a player but it only updates for the first id
could u tell me why?

pawn Код:
//Ontop of the Script
forward text(playerid);
new Text:text1[MAX_PLAYERS];

//On FS Init
SetTimer("text", 300, 1);
for (new i = 0; i < MAX_PLAYERS; i++)
{
text1[i] = TextDrawCreate(40.000000,430.000000,"0");
}

//OnPlayerLogin
format(str2,256,"http://www.pure-everything.co.nr Kills: %d Deaths: %d",AccountInfo[playerid][Kills],AccountInfo[playerid][Deaths]);
TextDrawSetString(text1[playerid],str2);
TextDrawColor(text1[playerid],0xFFFFFFFF);
TextDrawSetShadow(text1[playerid],1);
TextDrawShowForPlayer(playerid,text1[playerid]);

//public text
public text(playerid)
{
if(AccountInfo[playerid][Logged] == 1)
{
new str2[256];
format(str2,256,"http://www.pure-everything.co.nr[url=http://] Kills: %d Deaths: %d",AccountInfo[playerid][Kills],AccountInfo[playerid][Deaths]);
TextDrawSetString(text1[playerid],str2);
TextDrawHideForPlayer(playerid,text1[playerid]);
TextDrawShowForPlayer(playerid,text1[playerid]);
}
return 1;
}

// /resetstats
if(strcmp(cmd, "/resetstats", true) == 0)
{
new str2[256];
AccountInfo[playerid][Kills] = 0;
AccountInfo[playerid][Deaths] = 0;
format(str2,256,"http://www.pure-everything.co.nr[url=http://] Kills: %d Deaths: %d Hours: %d",AccountInfo[playerid][Kills],AccountInfo[playerid][Deaths],AccountInfo[playerid][Hours]);
TextDrawSetString(text1[playerid],str2);
TextDrawHideForPlayer(playerid,text1[playerid]);
TextDrawShowForPlayer(playerid,text1[playerid]);
return 1;
}

//OnPlayerDeath
AccountInfo[playerid][Deaths]++;
AccountInfo[killerid][Kills]++;
Reply
#2

yo guyz i dont like to bump
please help meh....
Reply
#3

Quote:
Originally Posted by saiberfun
yo guyz i dont like to bump
please help meh....
youre also not allowed to bump...so don't do it.
Reply
#4

ikno sry i promise i wont do ever again cuz i just got in ma head how i could help maself better X_X
im really sry...
could u please help me?
Reply
#5

Try destroying and then recreating your textdraw
Reply
#6

tha't won't work. anyway what I suggest is not to overload your machine by 256 textdraws and do it more like... OnPlayerConnect - create textdraw like: text1[playerid] = TextDrawCreate(..)
and on DIsconnect distroy the text1[playerid]. It won't overload your machine no way, and about updating, I do not know I will check and reply back to this post (edit this)

pawn Код:
//Ontop of the Script
forward text(playerid);
new Text:TD[MAX_PLAYERS];

//On FS Init
SetTimer("text", 300, 1);
for(new a = 0; a < 201; a++)
{
TD[a] = -1;
}


//OnPlayerLogin
format(str2,256,"http://www.pure-everything.co.nr[url=http://] \n Kills: %d Deaths: %d",AccountInfo[playerid][Kills],AccountInfo[playerid][Deaths]);
TextDrawSetString(text1[playerid],str2);
TextDrawColor(text1[playerid],0xFFFFFFFF);
TextDrawSetShadow(text1[playerid],1);
TextDrawShowForPlayer(playerid,text1[playerid]);

//public text
public text()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(TD[playerid] != -1){
if(AccountInfo[playerid][Logged] == 1)
{
new str2[128];
format(str2,256,"http://www.pure-everything.co.nr[url=http://] \n Kills: %d Deaths: %d", AccountInfo[playerid][Kills], AccountInfo[playerid][Deaths]);
TextDrawSetString(text1[playerid],str2);
TextDrawHideForPlayer(playerid,text1[playerid]);
TextDrawShowForPlayer(playerid,text1[playerid]);
}
}
}
return 1;
}

// /resetstats
if(strcmp(cmd, "/resetstats", true) == 0)
{
new str2[128];
AccountInfo[playerid][Kills] = 0;
AccountInfo[playerid][Deaths] = 0;
format(str2,256,"http://www.pure-everything.co.nr[url=http://] \n Kills: %d Deaths: %d Hours: %d", AccountInfo[playerid][Kills], AccountInfo[playerid][Deaths], AccountInfo[playerid][Hours]);
TextDrawSetString(text1[playerid],str2);
TextDrawHideForPlayer(playerid,text1[playerid]);
TextDrawShowForPlayer(playerid,text1[playerid]);
return 1;
}

//OnPlayerDeath
AccountInfo[playerid][Deaths]++;
AccountInfo[killerid][Kills]++;
Reply
#7

pawn Код:
//Leonidas was here
aww fuck, accidently hit post ;//
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)