Posts: 1,861
Threads: 103
Joined: Sep 2011
Reputation:
0
Create a public function, to destroy, and then create the draw.
Set a timer to call the public every X seconds, and then it get's "updated"
Posts: 2,286
Threads: 18
Joined: Jun 2010
Quote:
Originally Posted by Jari_Johnson*
pawn Код:
//onplayerspawn put this SetTimer("Killdraw",10000,1); //it "updates" the textdraw every 10 seconds
forward Killdraw(playerid); public Killdraw(playerid) { TextDrawDestroy()//destroy the textdraw Text:TextDrawCreate()//create it again }
@MP2 yes that's also possible, my bad, i can make a code of that aswell if he wants it that way..
|
*facepalm* Ever heard of the "killerid" variable in OnPlayerDeath? Plus why would he need to create a new one when he can just TextDrawSetString ?
https://sampwiki.blast.hk/wiki/TextDrawSetString
Edit: Oh you edited your post... Then only see the 2nd sentence
Posts: 2,286
Threads: 18
Joined: Jun 2010
Quote:
Originally Posted by [D]ry[D]esert
i think this is Long Way ..
I Make this and its Work and short (Just for More info)
pawn Код:
Textdraw1 = TextDrawCreate(414.000000, 424.000000, "Kills:~r~"); TextDrawBackgroundColor(Kills, 16711935); TextDrawFont(Kills, 2); TextDrawLetterSize(Kills, 0.559999, 2.299999); TextDrawColor(Kills, 65535); TextDrawSetOutline(Kills, 1); TextDrawSetProportional(Kills, 1);
pawn Код:
public OnPlayerSpawn(playerid) { TextDrawShowForPlayer( playerid, Kills); }
pawn Код:
OnPlayerUpdate(playerid) { new str[120]; format(str, sizeof(str),"Kills : %d",AccountInfo[playerid][Kills]); TextDrawSetString(Kills, str );
|
Ever heard of code optimization? Oh wait, this is SA:MP, of course you haven't. Why would someone use OnPlayerUpdate and call a function every half a second if he can call it only when needed (OnPlayerDeath) ?!