18.02.2009, 01:39
Hey all scripters i have a question is there some one as know how i can do to turn of the engine on the cars ? help plzz
new engine[700]; //number of cars in the server (700 is maximum number of cars) public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmd, "/engine", true) == 0)//when they type /engine do this: { if (IsPlayerInAnyVehicle(playerid))//check if they are in a car { new vehicleId = GetPlayerVehicleID(playerid);//get the ID of the car the player is in if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)//if the player is not the driver { return SendClientMessage(playerid, , "You can't start/stop the engine, you're not the driver!"); } if (engine[vehicleId] == 1)//if the car is on { engine[vehicleId] = 0;//set the car as off TogglePlayerControllable(playerid, 0);//set the player to be unable move } else if (engine[carid] == 0)//if the car is off { engine[vehicleId] = 1;//set the car as on TogglePlayerControllable(playerid, 1);//set the player to be able to move } return 1; } } }
new engine[700]; //number of cars in the server (700 is maximum number of cars)
if(strcmp(cmd, "/engine", true) == 0)//when they type /engine do this: { if (IsPlayerInAnyVehicle(playerid))//check if they are in a car { new vehicleId = GetPlayerVehicleID(playerid);//get the ID of the car the player is in if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)//if the player is not the driver { return SendClientMessage(playerid, , "You can't start/stop the engine, you're not the driver!"); } if (engine[vehicleId] == 1)//if the car is on { engine[vehicleId] = 0;//set the car as off TogglePlayerControllable(playerid, 0);//set the player to be unable move } else if (engine[carid] == 0)//if the car is off { engine[vehicleId] = 1;//set the car as on TogglePlayerControllable(playerid, 1);//set the player to be able to move } return 1; } }