SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 29/05/2010, 07:57 PM   #1
[XST]O_x
High-roller
 
[XST]O_x's Avatar
 
Join Date: Aug 2009
Posts: 1,960
Reputation: 94
Default Problem with textdraws

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.
[XST]O_x is offline  
Old 29/05/2010, 08:09 PM   #2
(SF)Noobanatior
Gangsta
 
Join Date: Dec 2006
Posts: 544
Reputation: 2
Default Re: Problem with textdraws

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
(SF)Noobanatior is offline  
Old 29/05/2010, 08:12 PM   #3
WackoX
Guest
 
Posts: n/a
Default Re: Problem with textdraws

Updating / Setting a timer every 1 milisecond (so 0,001 second) is realy flooding your server, try it under OnPlayerUpdate.
 
Old 29/05/2010, 08:12 PM   #4
[XST]O_x
High-roller
 
[XST]O_x's Avatar
 
Join Date: Aug 2009
Posts: 1,960
Reputation: 94
Default Re: Problem with textdraws

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?
[XST]O_x is offline  
Old 29/05/2010, 08:16 PM   #5
(SF)Noobanatior
Gangsta
 
Join Date: Dec 2006
Posts: 544
Reputation: 2
Default Re: Problem with textdraws

should be fine i did update that after i posted make sure yours says Score :%d not %s
(SF)Noobanatior is offline  
Old 29/05/2010, 08:21 PM   #6
Retardedwolf
High-roller
 
Retardedwolf's Avatar
 
Join Date: Jun 2009
Posts: 1,466
Reputation: 60
Default Re: Problem with textdraws

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.
Retardedwolf is offline  
Old 29/05/2010, 08:23 PM   #7
[XST]O_x
High-roller
 
[XST]O_x's Avatar
 
Join Date: Aug 2009
Posts: 1,960
Reputation: 94
Default Re: Problem with textdraws

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).
[XST]O_x is offline  
Old 29/05/2010, 08:35 PM   #8
Retardedwolf
High-roller
 
Retardedwolf's Avatar
 
Join Date: Jun 2009
Posts: 1,466
Reputation: 60
Default Re: Problem with textdraws

I recommend you to make the box transparent.
Retardedwolf is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[TEXTDRAWS] Textdraws mixed up KnooL Help Archive 22 23/06/2010 02:52 PM
random textdraws problem a-day Help Archive 6 20/06/2010 01:43 PM
Textdraws problem! Nyku Help Archive 0 03/06/2010 05:50 PM
Another textdraws problem [XST]O_x Help Archive 19 31/05/2010 06:42 PM
Textdraws Help RichyB Help Archive 1 14/04/2010 11:30 AM


All times are GMT. The time now is 06:43 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.