15.01.2017, 22:14
Fiz aqui para vocк й facil!
qualquer coisa falae!
qualquer coisa falae!
PHP код:
public OnGameModeInit()
{
ManualVehicleEngineAndLights();
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
switch(newkeys)
{
case KEY_YES:
{
if(GetVehicleDriverID(vehicleid)==playerid)
{
if(GetVehicleParams(vehicleid, VEHICLE_PARAMS_ENGINE)== VEHICLE_PARAMS_ON) ligarcarro(playerid,0);
else ligarcarro(playerid,1);
}
}
}
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetVehicleParams(vehicleid, VEHICLE_PARAMS_ENGINE)== VEHICLE_PARAMS_OFF) SendClientMessage(playerid, Branco, "Aperte [Y] Para desligar o veiculo!");
}
}
stock ligarcarro(playerid,ligado);
{
switch(opcao)
{
case 0:
{
SendClientMessage(playerid, Branco, "Carro desligado!");
SetVehicleParams(vehicleid, VEHICLE_PARAMS_ENGINE, VEHICLE_PARAMS_OFF);
SetVehicleParams(vehicleid, VEHICLE_PARAMS_LIGHTS, VEHICLE_PARAMS_OFF);
}
case 1:
{
//if(GetVehicleHealthEx(vehicleid) <= 0) return SendClientMessage(playerid, Amarelo, "Motor estб muito danificado!");
//if(code de combustivel) return SendClientMessage(playerid, Amarelo, "Sem combustivel");
SetVehicleParams(vehicleid, VEHICLE_PARAMS_ENGINE, VEHICLE_PARAMS_ON);
SetVehicleParams(vehicleid, VEHICLE_PARAMS_LIGHTS, VEHICLE_PARAMS_ON);
SendClientMessage(playerid, Verde, "Carro ligado!");
}
}
}
stock GetVehicleParams(vehicleid, type)
{
new params[7];
GetVehicleParamsEx(vehicleid, params[0], params[1], params[2], params[3], params[4], params[5], params[6]);
return params[type];
}
stock SetVehicleParams(vehicleid, type, set)
{
new params[7];
if(GetVehicleParamsEx(vehicleid, params[0], params[1], params[2], params[3], params[4], params[5], params[6]))
{
params[type] = set;
SetVehicleParamsEx(vehicleid, params[0], params[1], params[2], params[3], params[4], params[5], params[6]);
return true;
}
return false;
}