Textdraw strange - 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: Textdraw strange (
/showthread.php?tid=230954)
Textdraw strange -
Criss_Angel - 24.02.2011
I want it to show the speed, but for some strange reason it only shows my current speed when im on foot running, when i enter a vehicle it stays at 0 :S
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
speedo[playerid] = TextDrawCreate(241,428,"Speed: 0/kmh"); //create the textdraw at position
TextDrawFont(speedo[playerid],3); //font type of textdraw
TextDrawLetterSize(speedo[playerid],0.699999,1.700000); //size...
TextDrawColor(speedo[playerid],COLOR_GREY); //color
SetTimerEx("Speed", 1000, true, "");
TextDrawShowForPlayer(playerid,speedo[playerid]);
if(IsPlayerInBoat(playerid))
{
///
}
else
{
SetTimerEx("LongDriver", 3600000, false, "i"); // One Hour
}
return 1;
}
Speed:
pawn Код:
public Speed(playerid)
{
GetPlayerSpeed(playerid);
new speed[88];
format(speed, sizeof(speed),"Speed: %i/kmh", GetPlayerSpeed(playerid));
TextDrawSetString(speedo[playerid], speed);
TextDrawShowForPlayer(playerid, speedo[playerid]);
return 1;
}
Speed:
pawn Код:
stock GetPlayerSpeed(playerid)
{
new Float:x, Float:y, Float:z, Float:rst;
GetPlayerVelocity(playerid, x, y, z);
rst = ((x*x) + (y*y));
return floatround(rst * 200, floatround_round);
}
Re: Textdraw strange -
LZLo - 24.02.2011
Speed:
pawn Code:
PHP код:
public Speed(playerid)
{
GetPlayerSpeed(playerid);
new speed[88];
format(speed, sizeof(speed),"Speed: %i/kmh", GetPlayerSpeed(playerid));
TextDrawSetString(speedo[playerid], speed);
//TextDrawShowForPlayer(playerid, speedo[playerid]);
return 1;
}
try that
Re: Textdraw strange -
Criss_Angel - 25.02.2011
Okay...But that does not really help my issue with it only showing on foot....
Re: Textdraw strange -
Finn - 25.02.2011
Just have a timer, loop through all players and check if they're in a vehicle and show the speed if they are.
Re: Textdraw strange -
Criss_Angel - 25.02.2011
But The simple question is, Why won't it work anyway?It should work if your in vehicle or on foot.But it's only working on foot.WHY?
Re: Textdraw strange -
Criss_Angel - 26.02.2011
24 HOUR BUMP!!
Re: Textdraw strange -
MadeMan - 26.02.2011
pawn Код:
stock GetPlayerSpeed(playerid)
{
new Float:x, Float:y, Float:z, Float:rst;
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
}
else
{
GetPlayerVelocity(playerid, x, y, z);
}
rst = ((x*x) + (y*y));
return floatround(rst * 200, floatround_round);
}
Re: Textdraw strange -
Criss_Angel - 16.03.2011
This doesn't work accurate its way off, does anyone know of a legit GetPlayerSpeed.