SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 24/11/2012, 08:53 PM   #1
Fire_Hell
Big Clucker
 
Join Date: Oct 2011
Posts: 103
Reputation: 0
Default Velocimetro - HELP '-'

Gente, eu já peguei vários FS de velocimetro, mais a Gasolina está sempre errada...

Um não funciona, outra não atualiza...

Então gente, um que gostei foi esse: http://pastebin.com/Mn7tsD3T

Porém, ele não atualiza a gasolina, esse é o único erro dele, alguem pode me ajudar?

Obrigado.
__________________
_ _ _ _ _ _ _ _ _ _|INICIANTE EM PAWNO|_ _ _ _ _ _ _ _ _ _ _

Ajudei? Da um agradecer, não cai o dedo!
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Fire_Hell is offline   Reply With Quote
Old 25/11/2012, 12:56 AM   #2
Fire_Hell
Big Clucker
 
Join Date: Oct 2011
Posts: 103
Reputation: 0
Default Re: Velocimetro - HELP '-'

Up...
__________________
_ _ _ _ _ _ _ _ _ _|INICIANTE EM PAWNO|_ _ _ _ _ _ _ _ _ _ _

Ajudei? Da um agradecer, não cai o dedo!
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Fire_Hell is offline   Reply With Quote
Old 25/11/2012, 04:40 AM   #3
rjjj
Guest
 
Posts: n/a
Default Re: Velocimetro - HELP '-'

O percentual da gasolina muda, mas paulatinamente .



Você pode alterar esse comportamento modificando o operando direito deste decremento:


pawn Code:
Gas[vehicleID] -= 0.01;



Espero ter ajudado .
  Reply With Quote
Old 25/11/2012, 06:28 AM   #4
ipsBruno
Godfather
 
ipsBruno's Avatar
 
Join Date: Apr 2010
Location: Brazil, Caxias RS
Posts: 6,084
Reputation: 546
Default Respuesta: Velocimetro - HELP '-'

Na verdade é um erro que há no código rjj!


pawn Code:
_Pos[3] = GetPlayerDistanceFromPoint(playerid, x, y, z); // pega distancia anterior e checa com a distancia do jogador
 
        GetPlayerPos(playerid, _Pos[0], _Pos[1], _Pos[2]); // pega posição atual do jogador
 
   
 
        if(_Pos[3]) { // caso a distancia for maior que 0.0 ele diminui a gasolina
            Gas[vehicleID] -= 0.01;
        }
 
        SetTimerEx("VelocimeterUpdate", 200, false, "ifff", playerid, _Pos[0], _Pos[1], _Pos[2]); // envia a posicao do jogador

E as vezes _Pos[3] pode haver o valor zero devido a diferença da posição antiga do jogador ser muito pequena, logo o decréscimo não é executado

Então, basta aumentar o tempo de diferença para checagem de gasolina e aumentar o decréscimo de gasolina ao longo do tempo.

Para fixar isto, deixe mais ou menos assim:

pawn Code:
#include a_samp

/*
 *
 *   "Velocimetro"
 *  by [S]trong
 *
*/


#define COL_VEH_NAME 0xFF8C00FF
#define COL_VEH_INFO 0xE3E3E3FF

stock const
    vehicleNames[ 212 ][ 18 ] = {
        { !#Landstalker       }, { !#Bravura           }, { !#Buffalo           }, { !#Linerunner        }, // 400, 401, 402, 403
        { !#Perrenial         }, { !#Sentinel          }, { !#Dumper            }, { !#Firetruck         }, // 404, 405, 406, 407
        { !#Trashmaster       }, { !#Stretch           }, { !#Manana            }, { !#Infernus          }, // 408, 409, 410, 411
        { !#Voodoo            }, { !#Pony              }, { !#Mule              }, { !#Cheetah           }, // 412, 413, 414, 415
        { !#Ambulance         }, { !#Leviathan         }, { !#Moonbeam          }, { !#Esperanto         }, // 416, 417, 418, 419
        { !#Taxi              }, { !#Washington        }, { !#Bobcat            }, { !#Mr Whoopee        }, // 420, 421, 422, 423
        { !#BF Injection      }, { !#Hunter            }, { !#Premier           }, { !#Enforcer          }, // 424, 425, 426, 427
        { !#Securicar         }, { !#Banshee           }, { !#Predator          }, { !#Bus               }, // 428, 429, 430, 431
        { !#Rhino             }, { !#Barracks          }, { !#Hotknife          }, { !#Trailer 1         }, // 432, 433, 434, 435
        { !#Previon           }, { !#Coach             }, { !#Cabbie            }, { !#Stallion          }, // 436, 437, 438, 439
        { !#Rumpo             }, { !#RC Bandit         }, { !#Romero            }, { !#Packer            }, // 440, 441, 442, 443
        { !#Monster           }, { !#Admiral           }, { !#Squalo            }, { !#Seasparrow        }, // 444, 445, 446, 447
        { !#Pizzaboy          }, { !#Tram              }, { !#Trailer 2         }, { !#Turismo           }, // 448, 449, 450, 451
        { !#Speeder           }, { !#Reefer            }, { !#Tropic            }, { !#Flatbed           }, // 452, 453, 454, 455
        { !#Yankee            }, { !#Caddy             }, { !#Solair            }, { !#RC Van            }, // 456, 457, 458, 459
        { !#Skimmer           }, { !#PCJ-600           }, { !#Faggio            }, { !#Freeway           }, // 460, 461, 462, 463
        { !#RC Baron          }, { !#RC Raider         }, { !#Glendale          }, { !#Oceanic           }, // 464, 465, 466, 467
        { !#Sanchez           }, { !#Sparrow           }, { !#Patriot           }, { !#Quad              }, // 468, 469, 470, 471
        { !#Coastguard        }, { !#Dinghy            }, { !#Hermes            }, { !#Sabre             }, // 472, 473, 474, 475
        { !#Rustler           }, { !#ZR-350            }, { !#Walton            }, { !#Regina            }, // 476, 477, 478, 479
        { !#Comet             }, { !#BMX               }, { !#Burrito           }, { !#Camper            }, // 480, 481, 482, 483
        { !#Marquis           }, { !#Baggage           }, { !#Dozer             }, { !#Maverick          }, // 484, 485, 486, 487
        { !#News Chopper      }, { !#Rancher           }, { !#FBI Rancher       }, { !#Virgo             }, // 488, 489, 490, 491
        { !#Greenwood         }, { !#Jetmax            }, { !#Hotring           }, { !#Sandking          }, // 492, 493, 494, 495
        { !#Blista            }, { !#Police Maverick   }, { !#Boxville          }, { !#Benson            }, // 496, 497, 498, 499
        { !#Mesa              }, { !#RC Goblin         }, { !#Hotring A         }, { !#Hotring B         }, // 500, 501, 502, 503
        { !#Bloodring Banger  }, { !#Rancher           }, { !#Super GT          }, { !#Elegant           }, // 504, 505, 506, 507
        { !#Journey           }, { !#Bike              }, { !#Mountain Bike     }, { !#Beagle            }, // 508, 509, 510, 511
        { !#Cropdust          }, { !#Stuntplane        }, { !#Tanker            }, { !#Roadtrain         }, // 512, 513, 514, 515
        { !#Nebula            }, { !#Majestic          }, { !#Buccaneer         }, { !#Shamal            }, // 516, 517, 518, 519
        { !#Hydra             }, { !#FCR-900           }, { !#NRG-500           }, { !#HPV1000           }, // 520, 521, 522, 523
        { !#Cement Truck      }, { !#Tow Truck         }, { !#Fortune           }, { !#Cadrona           }, // 524, 525, 526, 527
        { !#FBI Truck         }, { !#Willard           }, { !#Forklift          }, { !#Tractor           }, // 528, 529, 530, 531
        { !#Combine           }, { !#Feltzer           }, { !#Remington         }, { !#Slamvan           }, // 532, 533, 534, 535
        { !#Blade             }, { !#Freight           }, { !#Streak            }, { !#Vortex            }, // 536, 537, 538, 539
        { !#Vincent           }, { !#Bullet            }, { !#Clover            }, { !#Sadler            }, // 540, 541, 542, 543
        { !#Firetruck LA      }, { !#Hustler           }, { !#Intruder          }, { !#Primo             }, // 544, 545, 546, 547
        { !#Cargobob          }, { !#Tampa             }, { !#Sunrise           }, { !#Merit             }, // 548, 549, 550, 551
        { !#Utility           }, { !#Nevada            }, { !#Yosemite          }, { !#Windsor           }, // 552, 553, 554, 555
        { !#Monster           }, { !#Monster           }, { !#Uranus            }, { !#Jester            }, // 556, 557, 558, 559
        { !#Sultan            }, { !#Stratum           }, { !#Elegy             }, { !#Raindance         }, // 560, 561, 562, 563
        { !#RC Tiger          }, { !#Flash             }, { !#Tahoma            }, { !#Savanna           }, // 564, 565, 566, 567
        { !#Bandito           }, { !#Freight Flat      }, { !#Streak Carriage   }, { !#Kart              }, // 568, 569, 570, 571
        { !#Mower             }, { !#Duneride          }, { !#Sweeper           }, { !#Broadway          }, // 572, 573, 574, 575
        { !#Tornado           }, { !#AT-400            }, { !#DFT-30            }, { !#Huntley           }, // 576, 577, 578, 579
        { !#Stafford          }, { !#BF-400            }, { !#Newsvan           }, { !#Tug               }, // 580, 581, 582, 583
        { !#Trailer 3         }, { !#Emperor           }, { !#Wayfarer          }, { !#Euros             }, // 584, 585, 586, 587
        { !#Hotdog            }, { !#Club              }, { !#Freight Carriage  }, { !#Trailer 3         }, // 588, 589, 590, 591
        { !#Andromada         }, { !#Dodo              }, { !#RC Cam            }, { !#Launch            }, // 592, 593, 594, 595
        { !#Police LS         }, { !#Police SF         }, { !#Police LV         }, { !#Police Ranger     }, // 596, 597, 598, 599
        { !#Picador           }, { !#S.W.A.T. Van      }, { !#Alpha             }, { !#Phoenix           }, // 600, 601, 602, 603
        { !#Glendale          }, { !#Sadler            }, { !#Luggage Trailer A }, { !#Luggage Trailer B }, // 604, 605, 606, 607
        { !#Stair Trailer     }, { !#Boxville          }, { !#Farm Plow         }, { !#Utility Trailer   }  // 608, 609, 610, 611
    }
;

enum E_TEXTDRAW
{
    Text:vehicleBox,
    Text:vehicleName[ MAX_PLAYERS ],
    Text:vehicleRight[ MAX_PLAYERS ],
    Text:vehicleLeft[ MAX_PLAYERS ],
};

stock
          textDraw[ E_TEXTDRAW ],
    Float:Gas[ MAX_VEHICLES ] = { 100.0, ... }
;

VelocimeterUpdate(playerid, Float:x, Float:y, Float:z);

public OnFilterScriptInit( ) {
    textsLoad( );
}

public OnFilterScriptExit( ) {
    TextDrawHideForAll(textDraw[vehicleBox]);
   
    for( new i = 0, s = GetMaxPlayers( ); i != s; ++ i) {
        TextDrawHideForAll(textDraw[vehicleName][i]);
        TextDrawHideForAll(textDraw[vehicleLeft][i]);
        TextDrawHideForAll(textDraw[vehicleRight][i]);
    }
}

public OnPlayerConnect(playerid) {
    for( new i = 0, s = GetMaxPlayers( ); i != s; ++ i) {
        TextDrawHideForPlayer(playerid, textDraw[vehicleName][i]);
        TextDrawHideForPlayer(playerid, textDraw[vehicleLeft][i]);
        TextDrawHideForPlayer(playerid, textDraw[vehicleRight][i]);
    }
}

stock textsLoad( ) {
    textDraw[ vehicleBox ] = TextDrawCreate( 555.0, 360.0, "LD_POKE:cd9d" );

    TextDrawLetterSize      ( textDraw[ vehicleBox ], -0.09, -8.3 ),
    TextDrawTextSize        ( textDraw[ vehicleBox ], -130.0, 40.0 ),
    TextDrawBoxColor        ( textDraw[ vehicleBox ], 0x0000000F ),
    TextDrawBackgroundColor ( textDraw[ vehicleBox ], 0x0000000F ),
    TextDrawColor           ( textDraw[ vehicleBox ], 0x0000000F ),
    TextDrawAlignment       ( textDraw[ vehicleBox ], 0x2 ),
    TextDrawFont            ( textDraw[ vehicleBox ], 0x4 ),
    TextDrawSetOutline      ( textDraw[ vehicleBox ], 0x1 ),
    TextDrawSetShadow       ( textDraw[ vehicleBox ], 0x0 ),
    TextDrawUseBox          ( textDraw[ vehicleBox ], 0x1 );

    for( new i = 0; i != MAX_PLAYERS; ++ i ) {
        textDraw[ vehicleName ][ i ] = TextDrawCreate( 490.0, 362.0, "~n~ ~n~" );

        TextDrawLetterSize      ( textDraw[ vehicleName ][ i ], 0.25, 1.1 ),
        TextDrawBackgroundColor ( textDraw[ vehicleName ][ i ], 0x0000000F ),
        TextDrawColor           ( textDraw[ vehicleName ][ i ], COL_VEH_NAME ),
        TextDrawAlignment       ( textDraw[ vehicleName ][ i ], 0x2 ),
        TextDrawFont            ( textDraw[ vehicleName ][ i ], 0x2 ),
        TextDrawSetOutline      ( textDraw[ vehicleName ][ i ], 0x1 ),
        TextDrawSetShadow       ( textDraw[ vehicleName ][ i ], 0x0 );

        textDraw[ vehicleLeft ][ i ] = TextDrawCreate( 433.0, 375.0, "~n~ ~n~" );

        TextDrawLetterSize      ( textDraw[ vehicleLeft ][ i ], 0.2, 0.8 ),
        TextDrawBackgroundColor ( textDraw[ vehicleLeft ][ i ], 0x0000001F ),
        TextDrawColor           ( textDraw[ vehicleLeft ][ i ], COL_VEH_INFO ),
        TextDrawAlignment       ( textDraw[ vehicleLeft ][ i ], 0x1 ),
        TextDrawFont            ( textDraw[ vehicleLeft ][ i ], 0x1 ),
        TextDrawSetOutline      ( textDraw[ vehicleLeft ][ i ], 0x1 ),
        TextDrawSetShadow       ( textDraw[ vehicleLeft ][ i ], 0x0 );

        textDraw[ vehicleRight ][ i ] = TextDrawCreate( 547.0, 375.0, "~n~ ~n~" );

        TextDrawLetterSize      ( textDraw[ vehicleRight ][ i ], 0.2, 0.8 ),
        TextDrawBackgroundColor ( textDraw[ vehicleRight ][ i ], 0x0000001F ),
        TextDrawColor           ( textDraw[ vehicleRight ][ i ], COL_VEH_INFO ),
        TextDrawAlignment       ( textDraw[ vehicleRight ][ i ], 0x3 ),
        TextDrawFont            ( textDraw[ vehicleRight ][ i ], 0x1 ),
        TextDrawSetOutline      ( textDraw[ vehicleRight ][ i ], 0x1 ),
        TextDrawSetShadow       ( textDraw[ vehicleRight ][ i ], 0x0 );
    }
}

public OnPlayerStateChange(playerid, newstate, oldstate) {
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) {
        new
            Float:_Pos[3]
        ;

        GetPlayerPos(playerid, _Pos[0], _Pos[1], _Pos[2]);

        VelocimeterUpdate(playerid, _Pos[0], _Pos[1], _Pos[2]);

        new
            _Name[18]
        ;

        strunpack(_Name, vehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400]);
        TextDrawSetString(textDraw[vehicleName][playerid], _Name);
       
        TextDrawShowForPlayer(playerid, textDraw[vehicleBox]);
        TextDrawShowForPlayer(playerid, textDraw[vehicleName][playerid]);
        TextDrawShowForPlayer(playerid, textDraw[vehicleLeft][playerid]);
        TextDrawShowForPlayer(playerid, textDraw[vehicleRight][playerid]);
    }

    if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) {
        TextDrawHideForPlayer(playerid, textDraw[vehicleBox]);
        TextDrawHideForPlayer(playerid, textDraw[vehicleName][playerid]);
        TextDrawHideForPlayer(playerid, textDraw[vehicleLeft][playerid]);
        TextDrawHideForPlayer(playerid, textDraw[vehicleRight][playerid]);
    }
}

public VelocimeterUpdate(playerid, Float:x, Float:y, Float:z) {
    if(IsPlayerInAnyVehicle(playerid)) {
        new
            Float:_Pos[5],
                  _String[45]
        ;

        _Pos[3] = GetPlayerDistanceFromPoint(playerid, x, y, z);

        GetPlayerPos(playerid, _Pos[0], _Pos[1], _Pos[2]);

        new
            vehicleID = GetPlayerVehicleID(playerid)
        ;

        if(_Pos[3]) {
            Gas[vehicleID] -= 0.50;
        }

        format(_String, sizeof(_String), "gasolina %d%%~n~altitude %0.2f m", floatround(Gas[vehicleID]), floatmul(_Pos[2], 0.3408));

        TextDrawSetString(textDraw[vehicleRight][playerid], _String);

        GetVehicleHealth(vehicleID, _Pos[4]);

        format(_String, sizeof(_String), "%d km/h~n~lataria %d%%", floatround(floatmul(_Pos[3], 10.0)), floatround(floatdiv(_Pos[4], 10.0)));

        TextDrawSetString(textDraw[vehicleLeft][playerid], _String);

        SetTimerEx("VelocimeterUpdate", 920, false, "ifff", playerid, _Pos[0], _Pos[1], _Pos[2]);
    }
}

Boa sorte
__________________
https://github.com/ipsBruno
ipsBruno is offline   Reply With Quote
Old 25/11/2012, 12:13 PM   #5
rjjj
Guest
 
Posts: n/a
Default Re: Velocimetro - HELP '-'

No meu último post, eu citei o termo "decremento" pelo código mostrado representar uma diminuição .



Entretanto, em Pawn, a operação dele seria classificada como de atribuição com subtração, não de decremento:


pawn Code:
x--;  //Operação de decremento.

--x;  //Operação de decremento.

x -= y;  //Operação de atribuição com subtração.



Quote:
Originally Posted by ipsBruno View Post
Na verdade é um erro que há no código rjj!


pawn Code:
_Pos[3] = GetPlayerDistanceFromPoint(playerid, x, y, z); // pega distancia anterior e checa com a distancia do jogador
 
        GetPlayerPos(playerid, _Pos[0], _Pos[1], _Pos[2]); // pega posição atual do jogador
 
   
 
        if(_Pos[3]) { // caso a distancia for maior que 0.0 ele diminui a gasolina
            Gas[vehicleID] -= 0.01;
        }
 
        SetTimerEx("VelocimeterUpdate", 200, false, "ifff", playerid, _Pos[0], _Pos[1], _Pos[2]); // envia a posicao do jogador

E as vezes _Pos[3] pode haver o valor zero devido a diferença da posição antiga do jogador ser muito pequena, logo o decréscimo não é executado

Então, basta aumentar o tempo de diferença para checagem de gasolina e aumentar o decréscimo de gasolina ao longo do tempo.

Para fixar isto, deixe mais ou menos assim:

pawn Code:
#include a_samp

/*
 *
 *   "Velocimetro"
 *  by [S]trong
 *
*/


#define COL_VEH_NAME 0xFF8C00FF
#define COL_VEH_INFO 0xE3E3E3FF

stock const
    vehicleNames[ 212 ][ 18 ] = {
        { !#Landstalker       }, { !#Bravura           }, { !#Buffalo           }, { !#Linerunner        }, // 400, 401, 402, 403
        { !#Perrenial         }, { !#Sentinel          }, { !#Dumper            }, { !#Firetruck         }, // 404, 405, 406, 407
        { !#Trashmaster       }, { !#Stretch           }, { !#Manana            }, { !#Infernus          }, // 408, 409, 410, 411
        { !#Voodoo            }, { !#Pony              }, { !#Mule              }, { !#Cheetah           }, // 412, 413, 414, 415
        { !#Ambulance         }, { !#Leviathan         }, { !#Moonbeam          }, { !#Esperanto         }, // 416, 417, 418, 419
        { !#Taxi              }, { !#Washington        }, { !#Bobcat            }, { !#Mr Whoopee        }, // 420, 421, 422, 423
        { !#BF Injection      }, { !#Hunter            }, { !#Premier           }, { !#Enforcer          }, // 424, 425, 426, 427
        { !#Securicar         }, { !#Banshee           }, { !#Predator          }, { !#Bus               }, // 428, 429, 430, 431
        { !#Rhino             }, { !#Barracks          }, { !#Hotknife          }, { !#Trailer 1         }, // 432, 433, 434, 435
        { !#Previon           }, { !#Coach             }, { !#Cabbie            }, { !#Stallion          }, // 436, 437, 438, 439
        { !#Rumpo             }, { !#RC Bandit         }, { !#Romero            }, { !#Packer            }, // 440, 441, 442, 443
        { !#Monster           }, { !#Admiral           }, { !#Squalo            }, { !#Seasparrow        }, // 444, 445, 446, 447
        { !#Pizzaboy          }, { !#Tram              }, { !#Trailer 2         }, { !#Turismo           }, // 448, 449, 450, 451
        { !#Speeder           }, { !#Reefer            }, { !#Tropic            }, { !#Flatbed           }, // 452, 453, 454, 455
        { !#Yankee            }, { !#Caddy             }, { !#Solair            }, { !#RC Van            }, // 456, 457, 458, 459
        { !#Skimmer           }, { !#PCJ-600           }, { !#Faggio            }, { !#Freeway           }, // 460, 461, 462, 463
        { !#RC Baron          }, { !#RC Raider         }, { !#Glendale          }, { !#Oceanic           }, // 464, 465, 466, 467
        { !#Sanchez           }, { !#Sparrow           }, { !#Patriot           }, { !#Quad              }, // 468, 469, 470, 471
        { !#Coastguard        }, { !#Dinghy            }, { !#Hermes            }, { !#Sabre             }, // 472, 473, 474, 475
        { !#Rustler           }, { !#ZR-350            }, { !#Walton            }, { !#Regina            }, // 476, 477, 478, 479
        { !#Comet             }, { !#BMX               }, { !#Burrito           }, { !#Camper            }, // 480, 481, 482, 483
        { !#Marquis           }, { !#Baggage           }, { !#Dozer             }, { !#Maverick          }, // 484, 485, 486, 487
        { !#News Chopper      }, { !#Rancher           }, { !#FBI Rancher       }, { !#Virgo             }, // 488, 489, 490, 491
        { !#Greenwood         }, { !#Jetmax            }, { !#Hotring           }, { !#Sandking          }, // 492, 493, 494, 495
        { !#Blista            }, { !#Police Maverick   }, { !#Boxville          }, { !#Benson            }, // 496, 497, 498, 499
        { !#Mesa              }, { !#RC Goblin         }, { !#Hotring A         }, { !#Hotring B         }, // 500, 501, 502, 503
        { !#Bloodring Banger  }, { !#Rancher           }, { !#Super GT          }, { !#Elegant           }, // 504, 505, 506, 507
        { !#Journey           }, { !#Bike              }, { !#Mountain Bike     }, { !#Beagle            }, // 508, 509, 510, 511
        { !#Cropdust          }, { !#Stuntplane        }, { !#Tanker            }, { !#Roadtrain         }, // 512, 513, 514, 515
        { !#Nebula            }, { !#Majestic          }, { !#Buccaneer         }, { !#Shamal            }, // 516, 517, 518, 519
        { !#Hydra             }, { !#FCR-900           }, { !#NRG-500           }, { !#HPV1000           }, // 520, 521, 522, 523
        { !#Cement Truck      }, { !#Tow Truck         }, { !#Fortune           }, { !#Cadrona           }, // 524, 525, 526, 527
        { !#FBI Truck         }, { !#Willard           }, { !#Forklift          }, { !#Tractor           }, // 528, 529, 530, 531
        { !#Combine           }, { !#Feltzer           }, { !#Remington         }, { !#Slamvan           }, // 532, 533, 534, 535
        { !#Blade             }, { !#Freight           }, { !#Streak            }, { !#Vortex            }, // 536, 537, 538, 539
        { !#Vincent           }, { !#Bullet            }, { !#Clover            }, { !#Sadler            }, // 540, 541, 542, 543
        { !#Firetruck LA      }, { !#Hustler           }, { !#Intruder          }, { !#Primo             }, // 544, 545, 546, 547
        { !#Cargobob          }, { !#Tampa             }, { !#Sunrise           }, { !#Merit             }, // 548, 549, 550, 551
        { !#Utility           }, { !#Nevada            }, { !#Yosemite          }, { !#Windsor           }, // 552, 553, 554, 555
        { !#Monster           }, { !#Monster           }, { !#Uranus            }, { !#Jester            }, // 556, 557, 558, 559
        { !#Sultan            }, { !#Stratum           }, { !#Elegy             }, { !#Raindance         }, // 560, 561, 562, 563
        { !#RC Tiger          }, { !#Flash             }, { !#Tahoma            }, { !#Savanna           }, // 564, 565, 566, 567
        { !#Bandito           }, { !#Freight Flat      }, { !#Streak Carriage   }, { !#Kart              }, // 568, 569, 570, 571
        { !#Mower             }, { !#Duneride          }, { !#Sweeper           }, { !#Broadway          }, // 572, 573, 574, 575
        { !#Tornado           }, { !#AT-400            }, { !#DFT-30            }, { !#Huntley           }, // 576, 577, 578, 579
        { !#Stafford          }, { !#BF-400            }, { !#Newsvan           }, { !#Tug               }, // 580, 581, 582, 583
        { !#Trailer 3         }, { !#Emperor           }, { !#Wayfarer          }, { !#Euros             }, // 584, 585, 586, 587
        { !#Hotdog            }, { !#Club              }, { !#Freight Carriage  }, { !#Trailer 3         }, // 588, 589, 590, 591
        { !#Andromada         }, { !#Dodo              }, { !#RC Cam            }, { !#Launch            }, // 592, 593, 594, 595
        { !#Police LS         }, { !#Police SF         }, { !#Police LV         }, { !#Police Ranger     }, // 596, 597, 598, 599
        { !#Picador           }, { !#S.W.A.T. Van      }, { !#Alpha             }, { !#Phoenix           }, // 600, 601, 602, 603
        { !#Glendale          }, { !#Sadler            }, { !#Luggage Trailer A }, { !#Luggage Trailer B }, // 604, 605, 606, 607
        { !#Stair Trailer     }, { !#Boxville          }, { !#Farm Plow         }, { !#Utility Trailer   }  // 608, 609, 610, 611
    }
;

enum E_TEXTDRAW
{
    Text:vehicleBox,
    Text:vehicleName[ MAX_PLAYERS ],
    Text:vehicleRight[ MAX_PLAYERS ],
    Text:vehicleLeft[ MAX_PLAYERS ],
};

stock
          textDraw[ E_TEXTDRAW ],
    Float:Gas[ MAX_VEHICLES ] = { 100.0, ... }
;

VelocimeterUpdate(playerid, Float:x, Float:y, Float:z);

public OnFilterScriptInit( ) {
    textsLoad( );
}

public OnFilterScriptExit( ) {
    TextDrawHideForAll(textDraw[vehicleBox]);
   
    for( new i = 0, s = GetMaxPlayers( ); i != s; ++ i) {
        TextDrawHideForAll(textDraw[vehicleName][i]);
        TextDrawHideForAll(textDraw[vehicleLeft][i]);
        TextDrawHideForAll(textDraw[vehicleRight][i]);
    }
}

public OnPlayerConnect(playerid) {
    for( new i = 0, s = GetMaxPlayers( ); i != s; ++ i) {
        TextDrawHideForPlayer(playerid, textDraw[vehicleName][i]);
        TextDrawHideForPlayer(playerid, textDraw[vehicleLeft][i]);
        TextDrawHideForPlayer(playerid, textDraw[vehicleRight][i]);
    }
}

stock textsLoad( ) {
    textDraw[ vehicleBox ] = TextDrawCreate( 555.0, 360.0, "LD_POKE:cd9d" );

    TextDrawLetterSize      ( textDraw[ vehicleBox ], -0.09, -8.3 ),
    TextDrawTextSize        ( textDraw[ vehicleBox ], -130.0, 40.0 ),
    TextDrawBoxColor        ( textDraw[ vehicleBox ], 0x0000000F ),
    TextDrawBackgroundColor ( textDraw[ vehicleBox ], 0x0000000F ),
    TextDrawColor           ( textDraw[ vehicleBox ], 0x0000000F ),
    TextDrawAlignment       ( textDraw[ vehicleBox ], 0x2 ),
    TextDrawFont            ( textDraw[ vehicleBox ], 0x4 ),
    TextDrawSetOutline      ( textDraw[ vehicleBox ], 0x1 ),
    TextDrawSetShadow       ( textDraw[ vehicleBox ], 0x0 ),
    TextDrawUseBox          ( textDraw[ vehicleBox ], 0x1 );

    for( new i = 0; i != MAX_PLAYERS; ++ i ) {
        textDraw[ vehicleName ][ i ] = TextDrawCreate( 490.0, 362.0, "~n~ ~n~" );

        TextDrawLetterSize      ( textDraw[ vehicleName ][ i ], 0.25, 1.1 ),
        TextDrawBackgroundColor ( textDraw[ vehicleName ][ i ], 0x0000000F ),
        TextDrawColor           ( textDraw[ vehicleName ][ i ], COL_VEH_NAME ),
        TextDrawAlignment       ( textDraw[ vehicleName ][ i ], 0x2 ),
        TextDrawFont            ( textDraw[ vehicleName ][ i ], 0x2 ),
        TextDrawSetOutline      ( textDraw[ vehicleName ][ i ], 0x1 ),
        TextDrawSetShadow       ( textDraw[ vehicleName ][ i ], 0x0 );

        textDraw[ vehicleLeft ][ i ] = TextDrawCreate( 433.0, 375.0, "~n~ ~n~" );

        TextDrawLetterSize      ( textDraw[ vehicleLeft ][ i ], 0.2, 0.8 ),
        TextDrawBackgroundColor ( textDraw[ vehicleLeft ][ i ], 0x0000001F ),
        TextDrawColor           ( textDraw[ vehicleLeft ][ i ], COL_VEH_INFO ),
        TextDrawAlignment       ( textDraw[ vehicleLeft ][ i ], 0x1 ),
        TextDrawFont            ( textDraw[ vehicleLeft ][ i ], 0x1 ),
        TextDrawSetOutline      ( textDraw[ vehicleLeft ][ i ], 0x1 ),
        TextDrawSetShadow       ( textDraw[ vehicleLeft ][ i ], 0x0 );

        textDraw[ vehicleRight ][ i ] = TextDrawCreate( 547.0, 375.0, "~n~ ~n~" );

        TextDrawLetterSize      ( textDraw[ vehicleRight ][ i ], 0.2, 0.8 ),
        TextDrawBackgroundColor ( textDraw[ vehicleRight ][ i ], 0x0000001F ),
        TextDrawColor           ( textDraw[ vehicleRight ][ i ], COL_VEH_INFO ),
        TextDrawAlignment       ( textDraw[ vehicleRight ][ i ], 0x3 ),
        TextDrawFont            ( textDraw[ vehicleRight ][ i ], 0x1 ),
        TextDrawSetOutline      ( textDraw[ vehicleRight ][ i ], 0x1 ),
        TextDrawSetShadow       ( textDraw[ vehicleRight ][ i ], 0x0 );
    }
}

public OnPlayerStateChange(playerid, newstate, oldstate) {
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) {
        new
            Float:_Pos[3]
        ;

        GetPlayerPos(playerid, _Pos[0], _Pos[1], _Pos[2]);

        VelocimeterUpdate(playerid, _Pos[0], _Pos[1], _Pos[2]);

        new
            _Name[18]
        ;

        strunpack(_Name, vehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400]);
        TextDrawSetString(textDraw[vehicleName][playerid], _Name);
       
        TextDrawShowForPlayer(playerid, textDraw[vehicleBox]);
        TextDrawShowForPlayer(playerid, textDraw[vehicleName][playerid]);
        TextDrawShowForPlayer(playerid, textDraw[vehicleLeft][playerid]);
        TextDrawShowForPlayer(playerid, textDraw[vehicleRight][playerid]);
    }

    if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) {
        TextDrawHideForPlayer(playerid, textDraw[vehicleBox]);
        TextDrawHideForPlayer(playerid, textDraw[vehicleName][playerid]);
        TextDrawHideForPlayer(playerid, textDraw[vehicleLeft][playerid]);
        TextDrawHideForPlayer(playerid, textDraw[vehicleRight][playerid]);
    }
}

public VelocimeterUpdate(playerid, Float:x, Float:y, Float:z) {
    if(IsPlayerInAnyVehicle(playerid)) {
        new
            Float:_Pos[5],
                  _String[45]
        ;

        _Pos[3] = GetPlayerDistanceFromPoint(playerid, x, y, z);

        GetPlayerPos(playerid, _Pos[0], _Pos[1], _Pos[2]);

        new
            vehicleID = GetPlayerVehicleID(playerid)
        ;

        if(_Pos[3]) {
            Gas[vehicleID] -= 0.50;
        }

        format(_String, sizeof(_String), "gasolina %d%%~n~altitude %0.2f m", floatround(Gas[vehicleID]), floatmul(_Pos[2], 0.3408));

        TextDrawSetString(textDraw[vehicleRight][playerid], _String);

        GetVehicleHealth(vehicleID, _Pos[4]);

        format(_String, sizeof(_String), "%d km/h~n~lataria %d%%", floatround(floatmul(_Pos[3], 10.0)), floatround(floatdiv(_Pos[4], 10.0)));

        TextDrawSetString(textDraw[vehicleLeft][playerid], _String);

        SetTimerEx("VelocimeterUpdate", 920, false, "ifff", playerid, _Pos[0], _Pos[1], _Pos[2]);
    }
}

Boa sorte

Isso é um bug das funções printf e format, lembra ?


http://forum.sa-mp.com/showthread.php?t=144744&page=188



Espero ter ajudado .
  Reply With Quote
Old 27/11/2012, 10:49 PM   #6
Fire_Hell
Big Clucker
 
Join Date: Oct 2011
Posts: 103
Reputation: 0
Default Re: Velocimetro - HELP '-'

Bom, então não tem como eu botar esse velocimetro? '-'

Se não der, alguem me manda outro ai? Porque outros nem gasolina não tem...

Vlw.
__________________
_ _ _ _ _ _ _ _ _ _|INICIANTE EM PAWNO|_ _ _ _ _ _ _ _ _ _ _

Ajudei? Da um agradecer, não cai o dedo!
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Fire_Hell is offline   Reply With Quote
Old 27/11/2012, 11:03 PM   #7
Zona_Sky
Gangsta
 
Zona_Sky's Avatar
 
Join Date: Sep 2012
Posts: 623
Reputation: 13
Default Re: Velocimetro - HELP '-'

http://forum.sa-mp.com/showthread.ph...ht=velocimetro

você pode acha mais procura no search ''Velocimetro'' algo do tipo.
Abraços ! .
__________________
espero ter ajudado
Zona_Sky is offline   Reply With Quote
Old 30/11/2012, 11:56 AM   #8
Fire_Hell
Big Clucker
 
Join Date: Oct 2011
Posts: 103
Reputation: 0
Default Re: Velocimetro - HELP '-'

Só tem velocimetro bugado no search, e esse ai NÃO MOSTRA GASOLINA
__________________
_ _ _ _ _ _ _ _ _ _|INICIANTE EM PAWNO|_ _ _ _ _ _ _ _ _ _ _

Ajudei? Da um agradecer, não cai o dedo!
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Fire_Hell is offline   Reply With Quote
Old 30/11/2012, 07:25 PM   #9
Fire_Hell
Big Clucker
 
Join Date: Oct 2011
Posts: 103
Reputation: 0
Default Re: Velocimetro - HELP '-'

Up...
__________________
_ _ _ _ _ _ _ _ _ _|INICIANTE EM PAWNO|_ _ _ _ _ _ _ _ _ _ _

Ajudei? Da um agradecer, não cai o dedo!
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Fire_Hell is offline   Reply With Quote
Old 02/12/2012, 03:40 PM   #10
Fire_Hell
Big Clucker
 
Join Date: Oct 2011
Posts: 103
Reputation: 0
Default Re: Velocimetro - HELP '-'

Up...²
__________________
_ _ _ _ _ _ _ _ _ _|INICIANTE EM PAWNO|_ _ _ _ _ _ _ _ _ _ _

Ajudei? Da um agradecer, não cai o dedo!
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Fire_Hell is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] Velocimetro Natan_silva Português/Portuguese 1 18/09/2012 05:42 AM
[Pedido] Velocimetro Yuri_xD Português/Portuguese 4 30/08/2012 08:57 PM
[Ajuda] Velocimetro felipe_mr Português/Portuguese 7 30/08/2012 04:51 PM
[FilterScript] DTP - Velocimetro v1 SlashPT Lançamentos/Releases 53 29/07/2011 03:59 AM
[FilterScript] Velocimetro oakley Lançamentos/Releases 6 18/10/2010 10:02 PM


All times are GMT. The time now is 01:00 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.