Boa madrugada pessoal.
Код:
// Sistema feito por felipe Melo
// nao tire os creditos!!!!
#define FILTERSCRIPT
#define LARANJA 0xFF6600AA
#define Verde 0x33AA33AA
#define COR_AZUL 0x0000FFAA
#define COR_CINZA 0xAFAFAFAA
#define COR_VERDE 0x33AA33AA
#define COR_VERMELHO2 0xAA3333AA
#define COR_AMARELO 0xFFFF00AA
#define COR_BRANCO 0xFFFFFFAA
#define COR_ROXO 0x9900FFAA
#define COR_MARROM 0x993300AA
#define COR_LARANJA 0xFF9933AA
#define BRANCO 0xFFFFFFAA
#include <a_samp>
#if defined FILTERSCRIPT
new luz[MAX_PLAYERS];
public OnFilterScriptInit()
{
/*print("\n--------------------------------------");
print(" Fs de Ligar ou Desligar Motor/Farol");
print(" By:Felipe Melo");
print("--------------------------------------\n");
*/
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
//SendClientMessage(playerid, Verde, "Sistema de Ligar/Desligar carro.By Felipe Melo");
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid, Verde, "Para Ligar o Carro Aperte '{FFFF00}+{FFFFFF}' ou {FFFF00}2");
SendClientMessage(playerid, Verde, "Para Ligar o Farol Aperte {FFFF00}Y");
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_YES && IsPlayerInAnyVehicle(playerid))
{
new engine, lights, alarm, doors, bonnet, boot, objective;
if(luz[playerid] == 0)
{
new veh = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(veh, engine, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
luz[playerid] = 1;
SendClientMessage(playerid, Verde, "Farol ligado");
PlayerPlaySound(playerid, 1054 , 0.0, 0.0, 10.0);
}
else if(luz[playerid] == 1)
{
new veh = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(veh, engine, lights, alarm,doors, bonnet, boot, objective);
SetVehicleParamsEx(veh, engine, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
luz[playerid] = 0;
SendClientMessage(playerid, LARANJA, "Farol Desligado");
PlayerPlaySound(playerid, 1054 , 0.0, 0.0, 10.0);
}
}
if(newkeys == KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid))
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
if(mot == VEHICLE_PARAMS_OFF)
{
SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
SendClientMessage(playerid, Verde, "Motor ligado");
PlayerPlaySound(playerid, 1054 , 0.0, 0.0, 10.0);
}else{
SendClientMessage(playerid,LARANJA, "Motor Desligado");
PlayerPlaySound(playerid, 1054 , 0.0, 0.0, 10.0);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)//funcao que deteta que o jogador esta a entrar num veiculo
{
return 1;
}
#endif
o Problema dele й o Seguinte : ele FUnciona quase perfeitamente. a nгo ser por um detalhe.
quem entra no carro como passageiro tambйm pode Ligar/desligar o veiculo como se fosse o motorista..
.
bom, eu queria que isto acabasse jб !. e emtгo pessoal podem me ajudar ?.
Coloca uma condiзгo pro motor ser ligado/desligado sу pelo motorista.