SA-MP Forums Archive
Problem with textdraws - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with textdraws (/showthread.php?tid=151261)



Problem with textdraws - [XST]O_x - 29.05.2010

Hey guys.
Today after i finally finished making the status textdraws for my server,i got a problem.
I have a timer in gamemodeinit which updates the X,Y,Z,Angle,Cash,Health,Armour and Score information:
pawn Code:
SetTimer("Fuck",1,1);
Well here is what happens when i have the timer on:


And here is what happens if i remove it:


Here is the timer callback:
pawn Code:
forward Fuck(playerid);
public Fuck(playerid)
{
    new N[60];
    new Str[60];
    GetPlayerName(playerid,N,sizeof(N));
    format(Str,sizeof(Str),"Name: %s",N);
    TextDrawSetString(Textdraw0,Str);
    new IP[60];
    GetPlayerIp(playerid,IP,sizeof(IP));
    format(Str,sizeof(Str),"IP : %s",IP);
    TextDrawSetString(Textdraw1,Str);
    new Float:x,Float:y,Float:z,Float:a,Float:c,Float:h,Float:ar,Float:s;
    GetPlayerPos(playerid,x,y,z);
    format(Str,sizeof(Str),"X: %f",x);
    TextDrawSetString(Textdraw2,Str);
    format(Str,sizeof(Str),"Y: %f",y);
    TextDrawSetString(Textdraw3,Str);
    format(Str,sizeof(Str),"Z: %f",z);
    TextDrawSetString(Textdraw4,Str);
    GetPlayerFacingAngle(playerid,a);
    format(Str,sizeof(Str),"Angle : %f",a);
    TextDrawSetString(Textdraw5,Str);
    c = GetPlayerMoney(playerid);
    format(Str,sizeof(Str),"Money : %d$",c);
    TextDrawSetString(Textdraw6,Str);
    GetPlayerHealth(playerid,h);
    format(Str,sizeof(Str),"Health :%s",h);
    TextDrawSetString(Textdraw7,Str);
    GetPlayerArmour(playerid,ar);
    format(Str,sizeof(Str),"Armour : %s",ar);
    TextDrawSetString(Textdraw8,Str);
    s = GetPlayerScore(playerid);
    format(Str,sizeof(Str),"Score: %s",s);
    TextDrawSetString(Textdraw9,Str);
}
Can you tell me whats wrong please?
Thanks in advance.


Re: Problem with textdraws - (SF)Noobanatior - 29.05.2010

is it just health and armour dont work? they should be floats not strings
pawn Code:
forward Fuck(playerid);
public Fuck(playerid)
{
    new N[60];
    new Str[60];
    GetPlayerName(playerid,N,sizeof(N));
    format(Str,sizeof(Str),"Name: %s",N);
    TextDrawSetString(Textdraw0,Str);
    new IP[60];
    GetPlayerIp(playerid,IP,sizeof(IP));
    format(Str,sizeof(Str),"IP : %s",IP);
    TextDrawSetString(Textdraw1,Str);
    new Float:x,Float:y,Float:z,Float:a,Float:c,Float:h,Float:ar,Float:s;
    GetPlayerPos(playerid,x,y,z);
    format(Str,sizeof(Str),"X: %f",x);
    TextDrawSetString(Textdraw2,Str);
    format(Str,sizeof(Str),"Y: %f",y);
    TextDrawSetString(Textdraw3,Str);
    format(Str,sizeof(Str),"Z: %f",z);
    TextDrawSetString(Textdraw4,Str);
    GetPlayerFacingAngle(playerid,a);
    format(Str,sizeof(Str),"Angle : %f",a);
    TextDrawSetString(Textdraw5,Str);
    c = GetPlayerMoney(playerid);
    format(Str,sizeof(Str),"Money : $%d",c);
    TextDrawSetString(Textdraw6,Str);
    GetPlayerHealth(playerid,h);
    format(Str,sizeof(Str),"Health :%f",h);
    TextDrawSetString(Textdraw7,Str);
    GetPlayerArmour(playerid,ar);
    format(Str,sizeof(Str),"Armour : %f",ar);
    TextDrawSetString(Textdraw8,Str);
    s = GetPlayerScore(playerid);
    format(Str,sizeof(Str),"Score: %d",s);
    TextDrawSetString(Textdraw9,Str);
}
try that


Re: Problem with textdraws - WackoX - 29.05.2010

Updating / Setting a timer every 1 milisecond (so 0,001 second) is realy flooding your server, try it under OnPlayerUpdate.


Re: Problem with textdraws - [XST]O_x - 29.05.2010

Gee,thanks
It's working now,but the "Score:" is still completely hiding though ;/

Quote:
Originally Posted by WackoX
Updating / Setting a timer every 1 milisecond (so 0,001 second) is realy flooding your server, try it under OnPlayerUpdate.
Will one second be ok?


Re: Problem with textdraws - (SF)Noobanatior - 29.05.2010

should be fine i did update that after i posted make sure yours says Score :%d not %s


Re: Problem with textdraws - Retardedwolf - 29.05.2010

You should remove the X, Y, Z and the Angle. Those are not needed.

You should not even update the IP and name after you have set the values on OnPlayerConnect.


Re: Problem with textdraws - [XST]O_x - 29.05.2010

Quote:
Originally Posted by (SF)Noobanatior
should be fine i did update that after i posted make sure yours says Score :%d not %s
Oh,ok sorry it was %s,it works with %d,forgot to change it to an integer,cause of copying from the name textdraw.
My bad,thanks it is working now.
Quote:
Originally Posted by www.******.com
You should remove the X, Y, Z and the Angle. Those are not needed.

You should not even update the IP and name after you have set the values on OnPlayerConnect.
I'm sorry,i forgot to mention,those were just a test,I'm changing most of it,because it will be under a command,
that only you can type,and i think you don't need to read your own name to remember it.
The X,Y,Z,Name and angle will be removed,leaving the Score,Money,IP,and adding Kills(TDM).


Re: Problem with textdraws - Retardedwolf - 29.05.2010

I recommend you to make the box transparent.