Problem with textdraws
#1

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.
Reply
#2

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
Reply
#3

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

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?
Reply
#5

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

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.
Reply
#7

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).
Reply
#8

I recommend you to make the box transparent.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)