02.01.2012, 10:16
Right, I have a vehicle command on my server, and it works perfectly fine, it shows the car ModelID and car UID next to it.
But, when I try to convert car ModelID in to car name. The command doesnt work (SERVER: Uknown Command)
This is the new command with getting vehicle name from id.
And this is getttingid function:
pawn Код:
if(strcmp(cmd, "/v", true) == 0)
{
if(PlayerInfo[playerid][pCarKey1] == 999 && PlayerInfo[playerid][pCarKey2] == 999)
{
SendClientMessage(playerid, COLOR_WHITE,"Nie masz zadnego samochodu");
return 0;
}
new stringV[256];
new CarFile[35];
new CarFile2[35];
format(CarFile,sizeof(CarFile),"Auta/%d.ini",PlayerInfo[playerid][pCarKey1]);
format(CarFile2,sizeof(CarFile2),"Auta/%d.ini",PlayerInfo[playerid][pCarKey2]);
new model1;
new model2;
model1 = dini_Int(CarFile,"ModelID");
model2 = dini_Int(CarFile2,"ModelID");
format(globalcar1,sizeof(globalcar1),"%d [UID: %d]",model1,PlayerInfo[playerid][pCarKey1]);
format(globalcar2,sizeof(globalcar2),"%d [UID: %d]",model2,PlayerInfo[playerid][pCarKey2]);
format(stringV,sizeof(stringV),"%s\n%s",globalcar1,globalcar2);
ShowPlayerDialog(playerid, VCMD, DIALOG_STYLE_LIST, "Twoje pojazdy:", stringV, "Wybierz", "Zamknij");
return 1;
}
This is the new command with getting vehicle name from id.
pawn Код:
if(strcmp(cmd, "/v", true) == 0)
{
if(PlayerInfo[playerid][pCarKey1] == 999 && PlayerInfo[playerid][pCarKey2] == 999)
{
SendClientMessage(playerid, COLOR_WHITE,"Nie masz zadnego samochodu");
return 0;
}
new stringV[256];
new CarFile[35];
new CarFile2[35];
format(CarFile,sizeof(CarFile),"Auta/%d.ini",PlayerInfo[playerid][pCarKey1]);
format(CarFile2,sizeof(CarFile2),"Auta/%d.ini",PlayerInfo[playerid][pCarKey2]);
new model1;
new model2;
model1 = dini_Int(CarFile,"ModelID");
model2 = dini_Int(CarFile2,"ModelID");
format(globalcar1,sizeof(globalcar1),"%s [UID: %d]",GetVehicleName(model1),PlayerInfo[playerid][pCarKey1]);
format(globalcar2,sizeof(globalcar2),"%s [UID: %d]",GetVehicleName(model2),PlayerInfo[playerid][pCarKey2]);
format(stringV,sizeof(stringV),"%s\n%s",globalcar1,globalcar2);
ShowPlayerDialog(playerid, VCMD, DIALOG_STYLE_LIST, "Twoje pojazdy:", stringV, "Wybierz", "Zamknij");
return 1;
}
pawn Код:
stock GetVehicleName(vehicleid)
{
new String[64];
format(String,sizeof(String),"%s",aVehicleNames[GetVehicleModel(vehicleid) - 400]);
return String;
}
new aVehicleNames[][] =
{
"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", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
"Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
"Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
"Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
"Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
"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", "Police Car",
"Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
"Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
"Tiller", "Utility Trailer"
};