16.03.2017, 12:24
Quote:
That would not make any sense.
Код:
new VehicleName[212] PHP код:
|
The code is right, there is no problem with this. The problem is GetVehicleModel return 0. It mean, the vehicle doesn't exist.
Add on the top of your script after includes.:
PHP код:
native IsValidVehicle(vehicleid);
PHP код:
public Speed()
{
for(new p = 0; p < GetMaxPlayers(); p++) if(IsPlayerConnected(p) && !IsPlayerNPC(p))
{
new vehicleid = GetPlayerVehicleID(p);
if(!IsValidVehicle(vehicleid))
continue;
if(vehicleid)
{
new string[128], Float:X, Float:Y, Float:Z, Float:PointToPoint, Float:vhealth;
GetVehicleVelocity(vehicleid, X, Y, Z);
PointToPoint = (floatsqroot(floatpower(X, 2) + floatpower(Y, 2) + floatpower(Z, 2)))*100;
GetVehicleHealth(vehicleid,vhealth);
format(string,sizeof string ,"{00D1FF}Vehнculo: {FFFFFF}%s\n{00D1FF}Vida: {FFFFFF}%.2f\n{00D1FF}Velocidad: {FFFFFF}%ikm/h", VehicleName[GetVehicleModel(vehicleid)-400], vhealth, floatround(PointToPoint, floatround_floor));
DeletePlayer3DTextLabel(p, speedo3Dtext);
speedo3Dtext = CreatePlayer3DTextLabel(p, string, speedcolor, 0.0,-1.6,-0.35,20.0, INVALID_PLAYER_ID, vehicleid);
} else if(p) { DeletePlayer3DTextLabel(p, speedo3Dtext); }
}
}