Speedometer problem
#1

Does anyone know where I went wrong in this code so the vehicle's statistics appear up to whoever is in the passenger seat or ride?
Well, until you're not driving, the speedometer and ...
How can I solve this?

pawn Код:
public Velocimetro()
{
foreach(Player, i)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(i, aname, MAX_PLAYER_NAME);
if(IsPlayerInAnyVehicle(i)) {
new Float:X, Float:Y, Float:Z, Float:Speed;
GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)),  floatpower(Z, 2))), 170.0);
new Float:vcarro;
GetVehicleHealth(GetPlayerVehicleID(i), vcarro);
new velocid;
velocid = floatround(Speed, floatround_floor);
new string[128];
new PlayerVehicleModelID = GetVehicleModel(GetPlayerVehicleID(i));
PlayerVehicleModelID -= 400;
new ncarro[30];


if(velocid == 300){
SetTimerEx("remove it", 1000, false, "i", i);
}
if(velocid == 350){
SetTimerEx("remove it", 1000, false, "i", i);
}
if(velocid == 380){
SetTimerEx("remove it", 1000, false, "i", i);
}
if(velocid > 385){
SetTimerEx("banspeed", 100, false, "i", i);
}

format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string, 128,"%i",velocid); //~y~Km/h
TextDrawSetString(velo[i],string);
// PLAYER VEHICLE
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string,sizeof(string),"~b~%s",PlayerVehicle[PlayerVehicleModelID]);
TextDrawSetString(Veiculo[i], string);
// PLAYER VEHICLE
// LOCATION SPEEDOMETER
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string,sizeof(string),"~w~%s", zone);
TextDrawSetString(Localidades[i], string);
// KM / H
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string,sizeof(string),"~y~KM/H"); //~y~~i~/~y~
TextDrawSetString(Kmh, string);
Radar(i);
TextDrawShowForPlayer(i, velo[i]);
TextDrawShowForPlayer(i, Veiculo[i]);
TextDrawShowForPlayer(i, Localidades[i]);
TextDrawShowForPlayer(i, Kmh);
}else{
TextDrawHideForPlayer(i, velo[i]),TextDrawHideForPlayer(i, Veiculo[i]),TextDrawHideForPlayer(i, Kmh),TextDrawHideForPlayer(i, Localidades[i]);
}
}
return 1;
}
Reply
#2

PHP код:
public Velocimetro()
{
    foreach(
Playeri)
    {
        new 
aname[MAX_PLAYER_NAME];
        
GetPlayerName(ianameMAX_PLAYER_NAME);
        if(
IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            new 
Float:XFloat:YFloat:ZFloat:Speed;
            
GetVehicleVelocity(GetPlayerVehicleID(i), XYZ);
            
Speed floatmul(floatsqroot(floatadd(floatadd(floatpower(X2), floatpower(Y2)),  floatpower(Z2))), 170.0);
            new 
Float:vcarro;
            
GetVehicleHealth(GetPlayerVehicleID(i), vcarro);
            new 
velocid;
            
velocid floatround(Speedfloatround_floor);
            new 
string[128];
            new 
PlayerVehicleModelID GetVehicleModel(GetPlayerVehicleID(i));
            
PlayerVehicleModelID -= 400;
            new 
ncarro[30];


            if(
velocid == 300)
            {
                
SetTimerEx("remove it"1000false"i"i);
            }
            if(
velocid == 350)
            {
                
SetTimerEx("remove it"1000false"i"i);
            }
            if(
velocid == 380)
            {
                
SetTimerEx("remove it"1000false"i"i);
            }
            if(
velocid 385)
            {
                
SetTimerEx("banspeed"100false"i"i);
            }

            
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
            
GetPlayer2DZone(izoneMAX_ZONE_NAME);
            
format(string128,"%i",velocid); //~y~Km/h
            
TextDrawSetString(velo[i],string);
            
// PLAYER VEHICLE
            
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
            
GetPlayer2DZone(izoneMAX_ZONE_NAME);
            
format(string,sizeof(string),"~b~%s",PlayerVehicle[PlayerVehicleModelID]);
            
TextDrawSetString(Veiculo[i], string);
            
// PLAYER VEHICLE
            // LOCATION SPEEDOMETER
            
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
            
GetPlayer2DZone(izoneMAX_ZONE_NAME);
            
format(string,sizeof(string),"~w~%s"zone);
            
TextDrawSetString(Localidades[i], string);
            
// KM / H
            
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
            
GetPlayer2DZone(izoneMAX_ZONE_NAME);
            
format(string,sizeof(string),"~y~KM/H"); //~y~~i~/~y~
            
TextDrawSetString(Kmhstring);
            
Radar(i);
            
TextDrawShowForPlayer(ivelo[i]);
            
TextDrawShowForPlayer(iVeiculo[i]);
            
TextDrawShowForPlayer(iLocalidades[i]);
            
TextDrawShowForPlayer(iKmh);
            }else{
            
TextDrawHideForPlayer(ivelo[i]),TextDrawHideForPlayer(iVeiculo[i]),TextDrawHideForPlayer(iKmh),TextDrawHideForPlayer(iLocalidades[i]);
        }
    }
    return 
1;

Reply
#3

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
PHP код:
public Velocimetro()
{
    foreach(
Playeri)
    {
        new 
aname[MAX_PLAYER_NAME];
        
GetPlayerName(ianameMAX_PLAYER_NAME);
        if(
IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            new 
Float:XFloat:YFloat:ZFloat:Speed;
            
GetVehicleVelocity(GetPlayerVehicleID(i), XYZ);
            
Speed floatmul(floatsqroot(floatadd(floatadd(floatpower(X2), floatpower(Y2)),  floatpower(Z2))), 170.0);
            new 
Float:vcarro;
            
GetVehicleHealth(GetPlayerVehicleID(i), vcarro);
            new 
velocid;
            
velocid floatround(Speedfloatround_floor);
            new 
string[128];
            new 
PlayerVehicleModelID GetVehicleModel(GetPlayerVehicleID(i));
            
PlayerVehicleModelID -= 400;
            new 
ncarro[30];
            if(
velocid == 300)
            {
                
SetTimerEx("remove it"1000false"i"i);
            }
            if(
velocid == 350)
            {
                
SetTimerEx("remove it"1000false"i"i);
            }
            if(
velocid == 380)
            {
                
SetTimerEx("remove it"1000false"i"i);
            }
            if(
velocid 385)
            {
                
SetTimerEx("banspeed"100false"i"i);
            }
            
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
            
GetPlayer2DZone(izoneMAX_ZONE_NAME);
            
format(string128,"%i",velocid); //~y~Km/h
            
TextDrawSetString(velo[i],string);
            
// PLAYER VEHICLE
            
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
            
GetPlayer2DZone(izoneMAX_ZONE_NAME);
            
format(string,sizeof(string),"~b~%s",PlayerVehicle[PlayerVehicleModelID]);
            
TextDrawSetString(Veiculo[i], string);
            
// PLAYER VEHICLE
            // LOCATION SPEEDOMETER
            
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
            
GetPlayer2DZone(izoneMAX_ZONE_NAME);
            
format(string,sizeof(string),"~w~%s"zone);
            
TextDrawSetString(Localidades[i], string);
            
// KM / H
            
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
            
GetPlayer2DZone(izoneMAX_ZONE_NAME);
            
format(string,sizeof(string),"~y~KM/H"); //~y~~i~/~y~
            
TextDrawSetString(Kmhstring);
            
Radar(i);
            
TextDrawShowForPlayer(ivelo[i]);
            
TextDrawShowForPlayer(iVeiculo[i]);
            
TextDrawShowForPlayer(iLocalidades[i]);
            
TextDrawShowForPlayer(iKmh);
            }else{
            
TextDrawHideForPlayer(ivelo[i]),TextDrawHideForPlayer(iVeiculo[i]),TextDrawHideForPlayer(iKmh),TextDrawHideForPlayer(iLocalidades[i]);
        }
    }
    return 
1;

thank you friend.
That solved! <3
+ RP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)