Jokerboy Posted June 6, 2020 Report Share Posted June 6, 2020 Salut, vreau si eu un tutorial cum as putea face ca pe tasta 2 sa fie modul Engine ON/OFF. Pe MTB, BMX si Bike sa nu fie engine Quote Link to comment Share on other sites More sharing options...
BaFFyJunior Posted June 6, 2020 Report Share Posted June 6, 2020 (edited) new bool:VehicleEngine[MAX_VEHICLES]; // definim variabila care verifica daca motorul este pornit sau nu. public OnPlayerStateChange(playerid, newstate, oldstate) { switch(newstate) { case PLAYER_STATE_DRIVER: // verificam daca jucatorul este intr-un vehicul { new vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective; // definim variabilele if(IsABike(vehicleid)) //verificam daca vehiculul in care e jucatorul este o bicicleta { GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective); // setam engine pe ON VehicleEngine[vehicleid] = true; } else { GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective); // setam engine pe OFF VehicleEngine[vehicleid] = false; } } } return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & KEY_SUBMISSION) // verificam daca jucatorul a apasat tasta 2 { if(IsPlayerInAnyVehicle(playerid)) { new vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;//definim variabilele switch(VehicleEngine[vehicleid]) { case false: // daca motorul este oprit { GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective); // setam engine pe ON VehicleEngine[vehicleid] = true; SCM(playerid, -1, "Ai pornit motorul vehiculului."); } case true: // daca motorul este pornit { GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective); // setam engine pe OFF VehicleEngine[vehicleid] = false; SCM(playerid, -1, "Ai oprit motorul vehiculului."); } } } } return 1; } stock IsABike(vehicleid) { if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return 1; // vehiculul e bicicleta return 0; //vehiculul nu e bicicleta } Posibil sa mai fie loc de optimizari pe ici pe colo. Edited June 6, 2020 by BaFFyJunior Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.