SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 25/11/2018, 04:28 PM   #1
GuiKommander
Gangsta
 
GuiKommander's Avatar
 
Join Date: Dec 2016
Posts: 791
Reputation: 21
Default Retornar o Nome do Veículo

Tou rachando a cabeça pra tentar retornar o NOME do veículo, Como vocês viram eu criei a varíavel modelid para tentar pegar o id do VEÌCULO, mas aí que tá o problema, como eu retorno o id do veículo para se transformar em Nome do veículo? A parte que tenta retornar o nome do VEÍCULO é nessa linha:
PHP Code:
format(vsizesizeof(vsize), "%s"GetVehicleModelName(GetPlayerVehicleID(GetVehicleModel(modelid)))); // Nome do Veículo 
Código mais COMPLETO:

PHP Code:
forward AtualizarInformacaoVeiculo(playerid);
public 
AtualizarInformacaoVeiculo(playerid)
{
    new
        
vsize[20],
        
vsize_2[20],
        
vsize_3[20],
        
vsize_4[20],
        
veiculo GetPlayerVehicleID(playerid),
        
modelid
    
;
    
format(vFilesizeof(vFile),"Veiculos/%i.ini"veiculo);
    
    new
        
Float:km DOF2_GetFloat(vFile"KM_Rodado_Veiculo"),
        
Blindagem DOF2_GetInt(vFile"BlindagemVeiculo")
    ;
    
format(vsizesizeof(vsize), "%s"GetVehicleModelName(GetPlayerVehicleID(GetVehicleModel(modelid)))); // Nome do Veículo
    
PlayerTextDrawSetString(playeridVelocimetroPlayer[playerid][0], vsize);
    
    
format(vsize_2sizeof(vsize_2), "%d KM/h"GetPlayerSpeed(playeridtrue)); // Kilometragem
    
PlayerTextDrawSetString(playeridVelocimetroPlayer[playerid][1], vsize_2);
    
    
format(vsize_3sizeof(vsize_3), "%0.3f KM Percorrido"km); // KM_Percorrido
    
PlayerTextDrawSetString(playeridVelocimetroPlayer[playerid][2], vsize_3);
    
    
format(vsize_4sizeof(vsize_4), "Blindagem: 100"Blindagem); // Blindagem
    
PlayerTextDrawSetString(playeridVelocimetroPlayer[playerid][3], vsize_4);

    
    return 
1;

@EDIT

Quando eu cito o id do veículo, seria o MODELO dele mesmo, tipo: 411 - Infernus
GuiKommander is offline   Reply With Quote
Old 25/11/2018, 05:12 PM   #2
DarkBr
Huge Clucker
 
Join Date: Feb 2017
Location: ∫ f(x) dx
Posts: 366
Reputation: 11
Default Re: Retornar o Nome do Veículo

PHP Code:
GetVehicleModelName(GetVehicleModel(GetPlayerVehicleID(playerid))) 
DarkBr is offline   Reply With Quote
Old 25/11/2018, 05:18 PM   #3
Ermanhaut
Gangsta
 
Ermanhaut's Avatar
 
Join Date: Apr 2016
Location: Curitiba
Posts: 635
Reputation: 47
Default Re: Retornar o Nome do Veículo

pawn Code:
GetVehicleModelFromID(const vehiclemodel) {
  if(400 <= vehiclemodel <= 611) {
    return vehicleNames[vehiclemodel - 400];
  } else return 0;
}

new vehicleNames[][] = {
    {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
    {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
    {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
    {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
    {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
    {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
    {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
    {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
    {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
    {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
    {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
    {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
    {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
    {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
    {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
    {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
    {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
    {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
    {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
    {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
    {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
    {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
    {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
    {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
    {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
    {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
    {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
    {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
    {"Utility Trailer"}
};

//Uso:

printf("Player entrou no veículo %s", GetVehicleNameFromID(GetPlayerVehicleID(playerid));
__________________
try, try and try again
Ermanhaut is offline   Reply With Quote
Old 25/11/2018, 05:24 PM   #4
RiqueP
Gangsta
 
RiqueP's Avatar
 
Join Date: Jan 2014
Posts: 749
Reputation: 52
Default Re: Retornar o Nome do Veículo

Quote:
Originally Posted by Ermanhaut View Post
pawn Code:
GetVehicleModelFromID(const vehiclemodel) {
  if(400 <= vehiclemodel <= 611) {
    return vehicleNames[vehiclemodel - 400];
  } else return 0;
}

new vehicleNames[][] = {
    {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
    {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
    {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
    {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
    {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
    {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
    {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
    {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
    {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
    {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
    {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
    {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
    {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
    {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
    {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
    {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
    {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
    {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
    {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
    {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
    {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
    {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
    {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
    {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
    {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
    {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
    {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
    {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
    {"Utility Trailer"}
};

//Uso:

printf("Player entrou no veículo %s", GetVehicleNameFromID(GetPlayerVehicleID(playerid));
GetPlayerVehicleID retorna o ID do veículo que um jogador está. Uso correto:
PHP Code:
printf("Player entrou no veículo %s"GetVehicleNameFromID(GetVehicleModel(GetPlayerVehicleID(playerid))); 
RiqueP is offline   Reply With Quote
Old 25/11/2018, 05:28 PM   #5
Ermanhaut
Gangsta
 
Ermanhaut's Avatar
 
Join Date: Apr 2016
Location: Curitiba
Posts: 635
Reputation: 47
Default Re: Retornar o Nome do Veículo

Quote:
Originally Posted by RiqueP View Post
GetPlayerVehicleID retorna o ID do veículo que um jogador está. Uso correto:
PHP Code:
printf("Player entrou no veículo %s"GetVehicleNameFromID(GetVehicleModel(GetPlayerVehicleID(playerid))); 
Você só errou o nome da função, mas você realmente está correto.
__________________
try, try and try again
Ermanhaut 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
[Pedido] Função retornar nome de rua pedrotvr Português/Portuguese 2 07/01/2018 05:31 PM
[Pedido] Colocar nome no veículo JoaoBorges Português/Portuguese 2 01/10/2017 05:28 PM
[Ajuda] Nome do Veiculo BWCALLEf Português/Portuguese 2 30/11/2014 07:02 PM
[Pedido] Nome do veiculo AdrianoStk Português/Portuguese 4 05/08/2014 12:48 AM
[DUV]Retornar nome da gang frenetico Português/Portuguese 11 29/08/2010 01:04 AM


All times are GMT. The time now is 06:20 AM.


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