03.03.2017, 15:06
Vocк precisa colocar para quando ele ligar o veнculo alterar a variбvel Motor[playerid] = 1, e para quando o veнculo desligar Motor[playerid] = 0;
Acho que й isso. Tenta aн, acho que vai funcionar.
Acho que й isso. Tenta aн, acho que vai funcionar.
Код:
if (strcmp("/motorc", cmdtext, true, 10) == 0) { if(Motor[playerid] == 0) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid,x,y,z); if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COR_ERRO, "Vocк deve ser o motorista."); new rands = random(2)+1; new vid = GetPlayerVehicleID(playerid); new Float:vidacarro; GetVehicleHealth(GetPlayerVehicleID(playerid),vidacarro); if(IsPlayerNPC(playerid)) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); return 0x01; } if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) { return 0x01; } if(vid != INVALID_VEHICLE_ID) { if(rands == 1) { format(string, sizeof(string), "* %s liga o motor.", GetName(playerid, true)); TogglePlayerControllable(playerid, true); Motor[playerid] = 1; SetVehicleEngineOn(vid); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); GameTextForPlayer(playerid,"~g~MOTOR LIGADO", 1000,3); } else { format(string, sizeof(string), "* %s tenta mas nгo consegue.", GetName(playerid, true)); } ProxDetector(10.0, playerid, string, COR_PURPLE); } } else if(Motor[playerid] == 1) { if(!IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COR_ERRO, "Vocк deve ser o motorista."); return 0x01; } if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) { return 0x01; } new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective); GameTextForPlayer(playerid,"~r~MOTOR DESLIGADO", 2000,3); Motor[playerid] = 0; } } return 1; }