public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys == 256)) // Q para ligar o carro.
{
if (IsPlayerInAnyVehicle(playerid))
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if (carro != INVALID_VEHICLE_ID)
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
motor[playerid] = 1;
SendClientMessage(playerid, Branco, "Veiculo {2F991A}Ligado!");
}
}
if ((newkeys == 256)) // Q para desligar o carro.
{
if (IsPlayerInAnyVehicle(playerid))
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if (carro != INVALID_VEHICLE_ID)
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
motor[playerid] = 0;
SendClientMessage(playerid, Branco, "Veiculo {E31919}Desligado!");
}
}
if ((newkeys == 132)) // Ctrl para Ligar o Farol.
{
if (IsPlayerInAnyVehicle(playerid))
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if (carro != INVALID_VEHICLE_ID)
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, mot, VEHICLE_PARAMS_ON, alar, por, cap, porma, ob);
luz[playerid] = 1;
SendClientMessage(playerid, Branco, "Farol {2F991A}Ligado!");
}
}
if ((newkeys == 132)) // Ctrl para Desligar o Farol.
{
if (IsPlayerInAnyVehicle(playerid))
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if (carro != INVALID_VEHICLE_ID)
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, mot, VEHICLE_PARAMS_OFF, alar, por, cap, porma, ob);
luz[playerid] = 0;
SendClientMessage(playerid, Branco, "Farol {E31919}Desligado!");
}
}
return 1;
}
if ((newkeys == 256 )) // Q para ligar o carro.
{
if (IsPlayerInAnyVehicle(playerid) & motor[playerid] == 0)
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if (carro != INVALID_VEHICLE_ID)
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, 1, lu, alar, por, cap, porma, ob);
motor[playerid] = 1;
SendClientMessage(playerid, -1, "Veiculo {2F991A}Ligado!");
return true;
}
}
if ((newkeys == 256 )) // Q para ligar o carro.
{
if (IsPlayerInAnyVehicle(playerid) & motor[playerid] == 1)
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if (carro != INVALID_VEHICLE_ID)
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, 0, lu, alar, por, cap, porma, ob);
motor[playerid] = 0;
SendClientMessage(playerid, -1, "Veiculo {E31919}Desligado!");
return true;
}
}
if ((newkeys == 132 )) // Ctrl para Ligar o Farol.
{
if (IsPlayerInAnyVehicle(playerid) & luz[playerid] == 0)
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if (carro != INVALID_VEHICLE_ID)
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, mot, 1, alar, por, cap, porma, ob);
luz[playerid] = 1;
SendClientMessage(playerid, -1, "Farol {2F991A}Ligado!");
return true;
}
}
if ((newkeys == 132 )) // Ctrl para Ligar o Farol.
{
if (IsPlayerInAnyVehicle(playerid) & luz[playerid] == 1)
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if (carro != INVALID_VEHICLE_ID)
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, mot, 0, alar, por, cap, porma, ob);
luz[playerid] = 0;
SendClientMessage(playerid, -1, "Farol {E31919}Desligado!");
return true;
}
}
if ((newkeys == 256)) // Q para ligar o carro.
{
if (IsPlayerInAnyVehicle(playerid) && motor[playerid] == 0)
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if (carro != INVALID_VEHICLE_ID)
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
motor[playerid] = 1;
SendClientMessage(playerid, Branco, "Veiculo {2F991A}Ligado!");
return 1;
}
if (IsPlayerInAnyVehicle(playerid) && motor[playerid] == 1)
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if (carro != INVALID_VEHICLE_ID)
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
motor[playerid] = 0;
SendClientMessage(playerid, Branco, "Veiculo {E31919}Desligado!");
return 1;
}
}
editei o topico acima
Sу foi usado o Operador & e as variaveis do seu gm luz[playerid] e motor[playerid] qual parte vc nгo entendeu? |