25.07.2016, 17:17
Hey guys,
i've written a command that should spawn a vehicle that does not get saved in the database just temp vehicles for events etc.
the command so far i got
However i wish i could fill in the vehicle name instead of the modelid, so for example
/vcreate NRG, and it picking random colors, is there anyone able to assist me with this?
I have the stock from another script, but it only says you have spawned a sultan if i use the ID,
If i use the vehicle name to spawn it gives me an error.
stock :
i've written a command that should spawn a vehicle that does not get saved in the database just temp vehicles for events etc.
the command so far i got
Код:
CMD:vcreate(playerid, params[]) { new vehicleid, model, color1, color2; if(sscanf(params, "k<vehicle>I(1)I(0)", model, color1, color2)) return SendClientMessage(playerid, COLOR_WHITE, "{ff0000}[Error]:{ffffff} /vcreate [vehicle name]"); else if(model == INVALID_VEHICLE_ID) return SendClientMessage(playerid, 0xFF0000FF, "{ff0000}[Error]:{ffffff} Invalid Vehicle."); else if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "{ff0000}[Error]:{ffffff} You are already in a vehicle."); new Float:x,Float:y,Float:z,Float:r,Float:nX,Float:nY,Float:nZ; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid,r); x += (3.0 * floatsin(-r, degrees)); y += (3.0 * floatcos(-r, degrees)); vehicleid = CreateVehicle(model, x, y, z+1.0, r+90, color1, color2, 5000); SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid)); new tmpstr[100]; format(tmpstr, sizeof(tmpstr), "You have spawned a %s.", GetVehicleName(vehicleid)); return SendClientMessage(playerid, COLOR_WHITE, tmpstr); }
/vcreate NRG, and it picking random colors, is there anyone able to assist me with this?
I have the stock from another script, but it only says you have spawned a sultan if i use the ID,
If i use the vehicle name to spawn it gives me an error.
stock :
Код:
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", "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" }; stock GetVehicleName(vehicleid) { new String[128]; format(String,sizeof(String),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]); return String; }