About getting vehicle's name
#1

the point is that Im trying to grab the vehicle's name, but it keeps to show "None".

here is the engine CMD:

PHP код:
CMD:engine(playeridparams[])
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if (!
IsEngineVehicle(vehicleid))
        return 
SendErrorMessage(playerid"You are not in any vehicle.");
    if (
GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
        return 
SendErrorMessage(playerid"You can't do this as you're not the driver.");
    if (
CoreVehicles[vehicleid][vehFuel] < 1)
        return 
SendErrorMessage(playerid"The fuel tank is empty.");
    if (
ReturnVehicleHealth(vehicleid) <= 300)
        return 
SendErrorMessage(playerid"This vehicle is totalled and can't be started.");
    switch (
GetEngineStatus(vehicleid))
    {
        case 
false:
        {
            
SetEngineStatus(vehicleidtrue);
            
ShowPlayerFooter(playerid"You have ~g~started~w~ the engine!");
            
SendNearbyMessage(playerid30.0COLOR_PURPLE"> %s takes the keys and starts the %s engine up."ReturnName(playerid0), ReturnVehicleModelName(playerid));
        }
        case 
true:
        {
            
SetEngineStatus(vehicleidfalse);
            
ShowPlayerFooter(playerid"You have ~r~stopped~w~ the engine!");
            
SendNearbyMessage(playerid30.0COLOR_PURPLE"> %s takes out the keys and turns the %s engine off."ReturnName(playerid0),ReturnVehicleModelName(playerid));
        }
    }
    return 
1;

Here is the ReturnVehicleModelName:

PHP код:
ReturnVehicleModelName(model)
{
    new
        
name[32] = "None";
    if (
model 400 || model 611)
        return 
name;
    
format(namesizeof(name), g_arrVehicleNames[model 400]);
    return 
name;

And here is the vehicles array -

PHP код:
new stock g_arrVehicleNames[][] = {
    
"Landstalker""Bravura""Buffalo""Linerunner""Perrenial""Sentinel""Dumper""Firetruck""Trashmaster",
    
"Stretch""Manana""Infernus""Voodoo""Pony""Mule""Cheetah""Ambulance""Leviathan""Moonbeam",
    
"Esperanto""Taxi""Washington""Bobcat""Whoopee""BF Injection""Hunter""Premier""Enforcer",
    
"Securicar""Banshee""Predator""Bus""Rhino""Barracks""Hotknife""Trailer""Previon""Coach",
    
"Cabbie""Stallion""Rumpo""RC Bandit""Romero""Packer""Monster""Admiral""Squalo""Seasparrow",
    
"Pizzaboy""Tram""Trailer""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""Cropduster""Stunt""Tanker""Roadtrain",
    
"Nebula""Majestic""Buccaneer""Shamal""Hydra""FCR-900""NRG-500""HPV1000""Cement Truck""Tow Truck",
    
"Fortune""Cadrona""SWAT Truck""Willard""Forklift""Tractor""Combine""Feltzer""Remington""Slamvan",
    
"Blade""Streak""Freight""Vortex""Vincent""Bullet""Clover""Sadler""Firetruck""Hustler""Intruder",
    
"Primo""Cargobob""Tampa""Sunrise""Merit""Utility""Nevada""Yosemite""Windsor""Monster""Monster",
    
"Uranus""Jester""Sultan""Stratum""Elegy""Raindance""RC Tiger""Flash""Tahoma""Savanna""Bandito",
    
"Freight Flat""Streak Carriage""Kart""Mower""Dune""Sweeper""Broadway""Tornado""AT-400""DFT-30",
    
"Huntley""Stafford""BF-400""News Van""Tug""Trailer""Emperor""Wayfarer""Euros""Hotdog""Club",
    
"Freight Box""Trailer""Andromada""Dodo""RC Cam""Launch""LSPD Car""SFPD Car""LVPD Car",
    
"Police Rancher""Picador""S.W.A.T""Alpha""Phoenix""Glendale""Sadler""Luggage""Luggage""Stairs",
    
"Boxville""Tiller""Utility Trailer"
}; 
I don't get whats the problem, it always shows 'None' at the vehicle's name.
exmple - takes out the keys and turns the None engine off.
Reply
#2

Getting model from playerid? no chance xd
pawn Код:
ReturnVehicleModelName(GetVehicleModel(vehicleid))
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Getting model from playerid? no chance xd
pawn Код:
ReturnVehicleModelName(GetVehicleModel(vehicleid))
oh fail, crap. thanks mate. xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)