Speedometer..... - 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: Speedometer..... (
/showthread.php?tid=189804)
Speedometer..... -
Gh0sT_ - 13.11.2010
Why, when i enter car, i didnt see any speedo textdraw? Speedometer using timer...
SetTimer("SPEEDO", 1000, true);
and..
pawn Код:
public SPEEDO()
{
foreach(Player, ID)
{
if(IsPlayerInAnyVehicle(ID))
{
new MasinosID = GetPlayerVehicleID(ID);
Stringas[71];
new Float:vX, Float:vY, Float:vZ, Float:Speed;
GetVehicleVelocity(GetPlayerVehicleID(ID), vX, vY, vZ);
Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(vX, 2), floatpower(vY, 2)), floatpower(vZ, 2))), 100.0);
if(MasinosID == BMX || MasinosID == MTBIKE || MasinosID == BIKE)
{
format(Stringas,35,"~w~Greitis KM/H: ~y~%i~n~",aVehicleNames[GetVehicleModel(GetPlayerVehicleID(ID))-400], floatround(Speed, floatround_floor));
TextDrawSetString(VHS[ID], Stringas[ID]);
}
else
{
format(Stringas,70,"~w~Greitis KM/H: ~y~%i~n~~w~Degalai: ~y~%iL~n~",floatround(Speed, floatround_floor),vehicleDB[GetPlayerVehicleID(ID)][gas]);
TextDrawSetString(VHS[ID], Stringas[ID]);
}
}
}
return 1;
}
ongamemodeinit:
LoadTD();
than..
pawn Код:
KrautiTextDrawus()
{
foreach(Player, i)
{
VHS[i] = TextDrawCreate(495.000000,122.000000,"0");
TextDrawAlignment(VHS[i], 0);
TextDrawBackgroundColor(VHS[i], 0x000000ff);
TextDrawFont(VHS[i], 1);
TextDrawLetterSize(VHS[i], 0.299999,1.000000);
TextDrawColor(VHS[i], 0xCCA129FF);
TextDrawSetOutline(VHS[i], 0);
TextDrawSetProportional(VHS[i], 1);
TextDrawSetShadow(VHS[i], 1);
TextDrawShowForPlayer(i, VHS[i]);
}
return 1;
}
Re: Speedometer..... -
Gh0sT_ - 14.11.2010
Bump <.>
Re: Speedometer..... -
SampStunta - 14.11.2010
I'm on my phone at the moment so I can't help.
However, I can help tomorrow morning GMT +8
Re: Speedometer..... -
Gh0sT_ - 14.11.2010
Bump. <...>
Re: Speedometer..... -
dark_clown - 14.11.2010
OnPlayerConnect do you have showtextdraw?
Re: Speedometer..... -
Gh0sT_ - 14.11.2010
No. I don't need it. Because, im creating it on gamemdoeinit, and setting string, when player are in car..
Re: Speedometer..... -
SampStunta - 14.11.2010
Try adding sonething to OnPlayerEnterVehicle
(I can help later, I'm still on phone (4:40 am) )
Re: Speedometer..... -
Mean - 14.11.2010
SetTimerEx ?
Re: Speedometer..... -
SampStunta - 14.11.2010
Add this under your defines and includes:
pawn Код:
enum PlayerStatistics
{
Speedo
);
Add this with your stocks:
pawn Код:
stock Reset(playerid)
{
Player[playerid][Speedo] = 1;
return 1;
}
Add this somewhere in your script:
pawn Код:
if(IsPlayerInAnyVehicle(i) && Player[i][Speedo] == 1)
{
new string[60];
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~ ~R~%d KM/H", GetPlayerSpeed(i, 0));
GameTextForPlayer(i, string, 1000, 3);
}
Then that shall do it!