14.12.2012, 18:52
When writing / car engine, it becomes sometimes it starts sometimes failar the one I want to remove failen and how is it done?
Quote:
CMD:engine(playerid, params[]) { new engine,lights,alarm,doors,bonnet,boot,objective,ve hicleid; new string[128]; vehicleid = GetPlayerVehicleID(playerid); if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle."); GetVehicleParamsEx(vehicleid,engine,lights,alarm,d oors,bonnet,boot,objective); if(engine == VEHICLE_PARAMS_ON) { SetVehicleEngine(vehicleid, playerid); } else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)) { SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait..."); new rand = random(4); if(rand == 0) { SetTimerEx("SetVehicleEngine", 1000, 0, "dd", vehicleid, playerid); SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine started"); format(string, sizeof(string), "* %s has started his vehicle's engine", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); } if(rand == 1) { SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine failed to start"); format(string, sizeof(string), "* %s struggles to start the engine but fails", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); } if(rand == 2) { SetTimerEx("SetVehicleEngine", 1000, 0, "dd", vehicleid, playerid); SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine started"); format(string, sizeof(string), "* %s has started his vehicle's engine", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); } if(rand == 3) { SetTimerEx("SetVehicleEngine", 1000, 0, "dd", vehicleid, playerid); SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine started"); format(string, sizeof(string), "* %s has started his vehicle's engine", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); } } return 1; } |