26.01.2018, 13:03
Hmm, guys I have this vehicle system in my script, well its suppose to be for Admins, the problem is when they create a vehicle and lets say the vehicle is destroyed, its suppose to not respawn, instead it does to exactly the first location to where the Admin spawned it to. Kinda checked the code, At Create vehicle, I used -1 to prevent it from respawning, but it still does. I post the code below..... Any help is appreciated.
I'm using Dialogs, so I have already defined it. Here's the dialog response...
Any help will be much appreciated. Thank you.
Код:
enum eVehicleInfo { vehicle_info_name[20], vehicle_info_seats, bool:vehicle_info_lowrider }; static const aVehicleInfo[][eVehicleInfo] = { {"Landstalker", 4, false}, {"Bravura", 2, false}, {"Buffalo", 2, false}, {"Linerunner", 2, false}, {"Perenniel", 4, false}, {"Sentinel", 4, false}, {"Dumper", 1, false}, {"Firetruck", 2, false}, {"Trashmaster", 2, false}, {"Stretch", 4, false}, {"Manana", 2, false}, {"Infernus", 2, false}, {"Voodoo", 2, true}, {"Pony", 4, false}, {"Mule", 2, false}, {"Cheetah", 2, false}, {"Ambulance", 4, false}, {"Leviathan", 2, false}, {"Moonbeam", 4, false}, {"Esperanto", 2, false}, {"Taxi", 4, false}, {"Washington", 4, false}, {"Bobcat", 2, false}, {"Mr Whoopee", 2, false}, {"BF Injection", 2, false}, {"Hunter", 1, false}, {"Premier", 4, false}, {"Enforcer", 4, false}, {"Securicar", 4, false}, {"Banshee", 2, false}, {"Predator", 1, false}, {"Bus", 9, false}, {"Rhino", 1, false}, {"Barracks", 2, false}, {"Hotknife", 2, false}, {"Trailer 1", 1, false}, {"Previon", 2, false}, {"Coach", 9, false}, {"Cabbie", 4, false}, {"Stallion", 2, false}, {"Rumpo", 4, false}, {"RC Bandit", 1, false}, {"Romero", 2, false}, {"Packer", 2, false}, {"Monster", 2, false}, {"Admiral", 4, false}, {"Squalo", 1, false}, {"Seasparrow", 2, false}, {"Pizzaboy", 1, false}, {"Tram", 6, false}, {"Trailer 2", 1, false}, {"Turismo", 2, false}, {"Speeder", 1, false}, {"Reefer", 1, false}, {"Tropic", 1, false}, {"Flatbed", 2, false}, {"Yankee", 2, false}, {"Caddy", 2, false}, {"Solair", 4, false}, {"Berkley's RC Van", 4, false}, {"Skimmer", 2, false}, {"PCJ-600", 2, false}, {"Faggio", 2, false}, {"Freeway", 2, false}, {"RC Baron", 2, false}, {"RC Raider", 2, false}, {"Glendale", 4, false}, {"Oceanic", 4, false}, {"Sanchez", 2, false}, {"Sparrow", 2, false}, {"Patriot", 4, false}, {"Quad", 2, false}, {"Coastguard", 1, false}, {"Dinghy", 1, false}, {"Hermes", 2, false}, {"Sabre", 2, false}, {"Rustler", 1, false}, {"ZR-350", 2, false}, {"Walton", 2, false}, {"Regina", 4, false}, {"Comet", 2, false}, {"BMX", 1, false}, {"Burrito", 4, false}, {"Camper", 3, false}, {"Marquis", 1, false}, {"Baggage", 1, false}, {"Dozer", 1, false}, {"Maverick", 4, false}, {"News Chopper", 2, false}, {"Rancher", 2, false}, {"FBI Rancher", 4, false}, {"Virgo", 2, false}, {"Greenwood", 4, false}, {"Jetmax", 1, false}, {"Hotring", 2, false}, {"Sandking", 2, false}, {"Blista Compact", 2, false}, {"Police Maverick", 4, false}, {"Boxville", 4, false}, {"Benson", 2, false}, {"Mesa", 2, false}, {"RC Goblin", 2, false}, {"Hotring Racer A", 2, false}, {"Hotring Racer B", 2, false}, {"Bloodring Banger", 2, false}, {"Rancher", 2, false}, {"Super GT", 2, false}, {"Elegant", 4, false}, {"Journey", 2, false}, {"Bike", 1, false}, {"Mountain Bike", 1, false}, {"Beagle", 2, false}, {"Cropdust", 1, false}, {"Stunt", 1, false}, {"Tanker", 2, false}, {"Roadtrain", 2, false}, {"Nebula", 4, false}, {"Majestic", 2, false}, {"Buccaneer", 2, false}, {"Shamal", 1, false}, {"Hydra", 1, false}, {"FCR-900", 2, false}, {"NRG-500", 2, false}, {"HPV1000", 2, false}, {"Cement Truck", 2, false}, {"Tow Truck", 2, false}, {"Fortune", 2, false}, {"Cadrona", 2, false}, {"FBI Truck", 2, false}, {"Willard", 4, false}, {"Forklift", 1, false}, {"Tractor", 1, false}, {"Combine", 1, false}, {"Feltzer", 2, false}, {"Remington", 2, true}, {"Slamvan", 2, true}, {"Blade", 2, true}, {"Freight", 0, false}, {"Streak", 0, false}, {"Vortex", 1, false}, {"Vincent", 4, false}, {"Bullet", 2, false}, {"Clover", 2, false}, {"Sadler", 2, false}, {"Firetruck LA", 2, false}, {"Hustler", 2, false}, {"Intruder", 4, false}, {"Primo", 4, false}, {"Cargobob", 2, false}, {"Tampa", 2, false}, {"Sunrise", 4, false}, {"Merit", 4, false}, {"Utility", 2, false}, {"Nevada", 1, false}, {"Yosemite", 2, false}, {"Windsor", 2, false}, {"Monster A", 2, false}, {"Monster B", 2, false}, {"Uranus", 2, false}, {"Jester", 2, false}, {"Sultan", 4, false}, {"Stratum", 4, false}, {"Elegy", 2, false}, {"Raindance", 2, false}, {"RC Tiger", 1, false}, {"Flash", 2, false}, {"Tahoma", 4, true}, {"Savanna", 4, true}, {"Bandito", 1, false}, {"Freight Flat", 0, false}, {"Streak Carriage", 0, false}, {"Kart", 1, false}, {"Mower", 1, false}, {"Dune", 2, false}, {"Sweeper", 1, false}, {"Broadway", 2, true}, {"Tornado", 2, true}, {"AT-400", 2, false}, {"DFT-30", 2, false}, {"Huntley", 4, false}, {"Stafford", 4, false}, {"BF-400", 2, false}, {"Newsvan", 4, false}, {"Tug", 1, false}, {"Trailer 3", 1, false}, {"Emperor", 4, false}, {"Wayfarer", 2, false}, {"Euros", 2, false}, {"Hotdog", 2, false}, {"Club", 2, false}, {"Freight Carriage", 6, false}, {"Trailer 3", 1, false}, {"Andromada", 2, false}, {"Dodo", 2, false}, {"RC Cam", 2, false}, {"Launch", 1, false}, {"LSPD Police Car", 4, false}, {"SFPD Police Car", 4, false}, {"LVPD Police Car", 4, false}, {"Police Ranger", 2, false}, {"Picador", 2, false}, {"SWAT Van", 2, false}, {"Alpha", 2, false}, {"Phoenix", 2, false}, {"Glendale", 4, false}, {"Sadler", 2, false}, {"Luggage Trailer A", 1, false}, {"Luggage Trailer B", 1, false}, {"Stair Trailer", 1, false}, {"Boxville", 4, false}, {"Farm Plow", 1, false}, {"Utility Trailer", 1, false} };
Код:
CMD:vehiclespawn(playerid, params[]) { if(!IsPlayerLoggedIn(playerid)) { SendClientMessage(playerid, COLOR_RED, "You must be logged in to use this command."); } else if(GetPlayerAdminLevel(playerid) < ADMIN_LEVEL_ADMINISTRATOR) { SendClientMessage(playerid, COLOR_RED, "You're not an Administrator!"); } else { ShowVehicleSpawnDialog(playerid); } return 1; } CMD:spawnvehicle(playerid, params[]) return cmd_vehiclespawn(playerid, params);
Код:
case DIALOG_VEHICLE_SPAWN: { if(response) { new vehicle[128]; if(sscanf(inputtext, "s[128]", vehicle)) { ShowVehicleSpawnDialog(playerid); SendClientMessage(playerid, COLOR_RED, "Please enter a valid vehicle id/name."); } else { new model_id; if(IsNumeric(vehicle)) { model_id = strval(vehicle); if(!(LOWEST_VEHICLE_ID <= model_id <= HIGHEST_VEHICLE_ID)) { ShowVehicleSpawnDialog(playerid); return SendClientMessage(playerid, COLOR_RED, "You have entered an invalid vehicle ID."); } } else { model_id = GetVehicleModelFromName(vehicle); if(!(LOWEST_VEHICLE_ID <= model_id <= HIGHEST_VEHICLE_ID)) { ShowVehicleSpawnDialog(playerid); return SendClientMessage(playerid, COLOR_RED, "You have entered an invalid vehicle name."); } } new string[144], Float:x, Float:y, Float:z, Float:angle, vehicle_id; GetPlayerPos(playerid, x, y, z); if(IsPlayerInAnyVehicle(playerid)) { GetCoordsInFrontOfPlayer(playerid, x, y, 8.0); GetVehicleZAngle(GetPlayerVehicleID(playerid), angle); } else { GetCoordsInFrontOfPlayer(playerid, x, y, 5.0); GetPlayerFacingAngle(playerid, angle); } vehicle_id = CreateVehicle(model_id, x, y, z, (angle + 90.0), -1, -1, -1); LinkVehicleToInterior(vehicle_id, GetPlayerInterior(playerid)); format(string, sizeof (string), "You have spawned a vehicle (%s, %d)!", GetVehicleName(model_id), model_id); SendClientMessage(playerid, GetPlayerAdminLevelColor(playerid), string); } } }