22.01.2011, 23:15
Hello everyone, I have a speedometer I don't remember where I have found it.
This is it:
This on top of GM:
This is a Command:
This is under the GM:
Now, if I join the server I take a car and no dashboard
and if there is a mistake, I hope you correct it for me!
So I hope some experts help me
Please
~ Yassine
This is it:
This on top of GM:
pawn Код:
new Text:SPEEDOX;
new Speedox[MAX_PLAYERS];
pawn Код:
public OnGameModeExit()
{
TextDrawDestroy(Text:SPEEDOX);
return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
Speedox[playerid]=1;
UpdateSpeed();
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(Speedox[playerid]==1)
{
Speedox[playerid]=0;
TextDrawHideForPlayer(playerid, Text:SPEEDOX);
}
return 1;
}
pawn Код:
if(strcmp(cmdtext,"/dash",true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(Speedox[playerid] == 1){SendClientMessage(playerid, YELLOW, "SpeedoMeter desabled."); Speedox[playerid] = 0;}
else{SendClientMessage(playerid, YELLOW, "~ MSS: SpeedoMeter enabled."); Speedox[playerid] = 1;}
}else{
SendClientMessage(playerid, RED, "You're not in a car.");
}
return 1;
}
pawn Код:
public OnPlayerUpdate(playerid)
{
if(Speedox[playerid] == 1)
{
if(IsPlayerInAnyVehicle(playerid))
{
TextDrawShowForPlayer (playerid, Text:SPEEDOX);
}
else
{
TextDrawHideForPlayer(playerid, Text:SPEEDOX);
}
}
else
{
if(IsPlayerInAnyVehicle(playerid))
{
TextDrawHideForPlayer(playerid, Text:SPEEDOX);
}
else
{
TextDrawHideForPlayer(playerid, Text:SPEEDOX);
}
}
return 1;
}
pawn Код:
forward UpdateSpeed();
public UpdateSpeed()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
new Float:Sp_x, Float:Sp_y, Float:Sp_z, Float:f_speed, f_speed_int;
new S_string[256];
new Float:vh;
new vehicleid;
vehicleid = GetPlayerVehicleID(i);
GetVehicleHealth(vehicleid, vh);
GetVehicleVelocity(vehicleid,Sp_x,Sp_y,Sp_z);
f_speed = floatsqroot(((Sp_x*Sp_x)+(Sp_y*Sp_y))+(Sp_z*Sp_z))*136.666667; // & MPH = 85.4166672
f_speed_int = floatround(f_speed,floatround_round);
format(S_string,256,"~g~Vehicule : ~w~%s ~n~~g~~h~~h~Ping : ~w~%d / ~b~KM/H : ~w~%d ~n~~r~Vehicle Health:~w~ %.2f",Vehiclex[GetVehicleModel(vehicleid)-400],GetPlayerPing(i),f_speed_int,vh);
SPEEDOX = TextDrawCreate(320.00, 380.00, S_string);
TextDrawSetOutline(SPEEDOX, 0);
TextDrawFont(SPEEDOX, 3);
TextDrawSetProportional(SPEEDOX, 2);
TextDrawAlignment(SPEEDOX, 2);
}
return 1;
}
and if there is a mistake, I hope you correct it for me!
So I hope some experts help me
Please
~ Yassine