Why my textdraw dont show? - 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)
+--- Thread: Why my textdraw dont show? (
/showthread.php?tid=339341)
Why my textdraw dont show? -
Admigo - 03.05.2012
Heey all,
I made a speedo with a timer(lol every speedo needs a timer)
But i changed the settimer to settimerex because the timer was detecting it for all players.
But know my textdraw dont show up.
Код:
//onplayerconnect:
SetTimerEx("SpeedoUpdate",100,1,"i",playerid);
public SpeedoUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPVarInt(playerid,"Speedo")==0)
{
TextDrawHideForPlayer(playerid,TextDraw90[playerid]);
}
else if(GetPVarInt(playerid,"Speedo")==1)
{
new Float:x,Float:y,Float:z,Float:hp,string[24],vehicleid = GetPlayerVehicleID(playerid);
//TextDrawShowForPlayer(i,box[i]);
TextDrawShowForPlayer(playerid,TextDraw90[playerid]);
//TextDrawShowForPlayer(i,health[i]);
GetVehicleVelocity(vehicleid,x,y,z);
GetVehicleHealth(vehicleid,hp);
format(string,sizeof(string),"MPH : %d",floatround(floatsqroot(((x*x)+(y*y))+(z*z))*156.666667));
TextDrawSetString(TextDraw90[playerid],string);
}
else if(GetPVarInt(playerid,"Speedo")==2)
{
new Float:x,Float:y,Float:z,Float:hp,string[24],vehicleid = GetPlayerVehicleID(playerid);
//TextDrawShowForPlayer(i,box[i]);
TextDrawShowForPlayer(playerid,TextDraw90[playerid]);
//TextDrawShowForPlayer(i,health[i]);
GetVehicleVelocity(vehicleid,x,y,z);
GetVehicleHealth(vehicleid,hp);
format(string,sizeof(string),"KPH : %d",floatround(floatsqroot(((x*x)+(y*y))+(z*z))*250.666667));
TextDrawSetString(TextDraw90[playerid],string);
}
}
if(!IsPlayerInAnyVehicle(playerid))
{
TextDrawHideForPlayer(playerid,TextDraw90[playerid]);
}
}
Problem 2:
I made a key for hiding a textdraw but when i press the key its hiding my speedo to and i didnt placed the hidetextdraw code for the speedo.
How can i fix those problems?
Thanks Admigo
Re: Why my textdraw dont show? -
MonsterFreeroam - 03.05.2012
public OnPlayerSpawn
TextDrawShowForPlayer(playerid, TextDraw90);
Re: Why my textdraw dont show? -
MadeMan - 03.05.2012
1) use [ pawn ] tags instead of [ code ] to show code (syntax highlighting makes it easier to read)
2) how do you set the "Speedo" PVar ?
3) showing the code for problem 2 would be good