27.04.2013, 11:56
(
Последний раз редактировалось FuZzYey; 27.04.2013 в 13:24.
)
Boas, gostava que me podessem ajudar aqui.
Quando ligo o motor (CTRL) ele liga, mas quando desligo o motor (CTRL denovo) nao dб, tenho de escrever o /motor para desligar.
Estб aqui o code (й grande):
Quando ligo o motor (CTRL) ele liga, mas quando desligo o motor (CTRL denovo) nao dб, tenho de escrever o /motor para desligar.
Estб aqui o code (й grande):
PHP код:
//=================================[DEFINES]==============================================
#define VEHICLE_PARAMS_UNSET -1 //This sets if your using the params
#define VEHICLE_PARAMS_OFF 0 //This will set your params OFF
#define VEHICLE_PARAMS_ON 1 //This will set your params ON
#define KEY_SEATBELT 4
#define KEY_MOTOR 1
#define KEY_LIGTH 65536
#define KEY_LIGHT 65536
#define Key_Open 128
PHP код:
if(strcmp(cmd, "/motor", true) == 0)
{
new sendername[MAX_PLAYER_NAME];
new carro = GetPlayerVehicleID(playerid) - 1;
new carid = GetPlayerVehicleID(playerid);
new Float:health;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, health);
new succeed = 1 + random(2);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
{
if(Batery[carid] >= 1)
{
if(DynamicCars[carro][comprado] == 1)
{
if(PlayerInfo[playerid][pChave] == carid || PlayerInfo[playerid][pChave2] == carid || PlayerInfo[playerid][pChave3] == carid || PlayerInfo[playerid][pChave4] == carid || PlayerInfo[playerid][pChave5] == carid || PlayerInfo[playerid][pChave6] == carid)
{
if(health >= 600.0)
{
PlayerActionMessage(playerid,15.0,"acabou de ligar o motor.");
TogglePlayerControllable(playerid,1);
EngineStatus[GetPlayerVehicleID(playerid)] = 1;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
else if((health <= 600.0) && (health >= 300.0))
{
if(succeed == 1)
{
format(string, sizeof(string), "*%s tenta ligar o motor consegue*.", GetPlayerNameEx(playerid));
ProxDetector(10.0, playerid, string, 0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF);
TogglePlayerControllable(playerid,1);
EngineStatus[GetPlayerVehicleID(playerid)] = 1;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
else if(succeed == 2)
{
format(string, sizeof(string), "*%s tenta ligar o motor e falha*.", GetPlayerNameEx(playerid));
ProxDetector(10.0, playerid, string, 0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF);
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(playerid,"~r~Carro Avariado.",90000,5);
}
}
if(health <= 300.0)
{
if(succeed == 1)
{
format(string, sizeof(string), "*%s tenta ligar o motor consegue*.", GetPlayerNameEx(playerid));
ProxDetector(10.0, playerid, string, 0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF);
TogglePlayerControllable(playerid,1);
EngineStatus[GetPlayerVehicleID(playerid)] = 1;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
else if(succeed == 2)
{
format(string, sizeof(string), "*%s tenta ligar o motor e falha*.", GetPlayerNameEx(playerid));
ProxDetector(10.0, playerid, string, 0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF);
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(playerid,"~r~Carro Avariado.",90000,5);
}
}
Batery[carid] -= 1;
}
else
{
if(AdminDuty[playerid] == 0)
{
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
RemovePlayerFromVehicle(playerid);
}
TogglePlayerControllable(playerid,1);
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo podes ligar o carro nгo tens as chaves.");
PlayerActionMessage(playerid,15.0,"tenta ligar o carro.");
}
}
if(DynamicCars[carro][buy] == 1)
{
if(AdminDuty[playerid] == 0)
{
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
RemovePlayerFromVehicle(playerid);
}
TogglePlayerControllable(playerid,1);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "O jogador %s tentou ligar um carro do stand!!", sendername);
AdministratorMessage(COLOR_ORANGE, string,1);
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo podes ligar o carro nгo tens as chaves.");
PlayerActionMessage(playerid,15.0,"tenta ligar o carro.");
}
else
{
if(DynamicCars[carro][comprado] == 0)
{
if(health >= 600.0)
{
PlayerActionMessage(playerid,15.0,"acabou de ligar o motor.");
TogglePlayerControllable(playerid,1);
EngineStatus[GetPlayerVehicleID(playerid)] = 1;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
else if((health <= 600.0) && (health >= 300.0))
{
if(succeed == 1)
{
format(string, sizeof(string), "*%s tenta ligar o motor consegue*.", GetPlayerNameEx(playerid));
ProxDetector(10.0, playerid, string, 0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF);
TogglePlayerControllable(playerid,1);
EngineStatus[GetPlayerVehicleID(playerid)] = 1;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
else if(succeed == 2)
{
format(string, sizeof(string), "*%s tenta ligar o motor e falha*.", GetPlayerNameEx(playerid));
ProxDetector(10.0, playerid, string, 0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF);
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(playerid,"~r~Carro Avariado.",90000,5);
}
}
if(health <= 300.0)
{
if(succeed == 1)
{
format(string, sizeof(string), "*%s tenta ligar o motor consegue*.", GetPlayerNameEx(playerid));
ProxDetector(10.0, playerid, string, 0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF);
TogglePlayerControllable(playerid,1);
EngineStatus[GetPlayerVehicleID(playerid)] = 1;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
else if(succeed == 2)
{
format(string, sizeof(string), "*%s tenta ligar o motor e falha*.", GetPlayerNameEx(playerid));
ProxDetector(10.0, playerid, string, 0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF);
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(playerid,"~r~Carro Avariado.",90000,5);
}
}
Batery[carid] -= 1;
}
}
}
else
{
format(string, sizeof(string), "*%s tenta ligar o motor e falha*.", GetPlayerNameEx(playerid));
ProxDetector(10.0, playerid, string, 0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF,0x9501C6FF);
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
}
}
else
{
if(DynamicCars[carro][comprado] == 1)
{
if(PlayerInfo[playerid][pChave] == carid || PlayerInfo[playerid][pChave2] == carid || PlayerInfo[playerid][pChave3] == carid || PlayerInfo[playerid][pChave4] == carid || PlayerInfo[playerid][pChave5] == carid || PlayerInfo[playerid][pChave6] == carid)
{
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"acabou de desligar o motor.");
}
else
{
PlayerActionMessage(playerid,15.0,"acabou de desligar o motor.");
}
}
else
{
if(AdminDuty[playerid] == 0)
{
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
RemovePlayerFromVehicle(playerid);
}
TogglePlayerControllable(playerid,1);
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo podes desligar o carro nгo tens as chaves.");
PlayerActionMessage(playerid,15.0,"tenta desligar o carro.");
}
}
if(DynamicCars[carro][buy] == 1)
{
if(AdminDuty[playerid] == 0)
{
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
RemovePlayerFromVehicle(playerid);
}
TogglePlayerControllable(playerid,1);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "O jogador %s tentou desligar um carro do stand!!", sendername);
AdministratorMessage(COLOR_ORANGE, string,1);
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo podes desligar o carro nгo tens as chaves.");
PlayerActionMessage(playerid,15.0,"tenta desligar o carro.");
}
else
{
if(DynamicCars[carro][comprado] == 0)
{
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"acabou de desligar o motor.");
}
else
{
PlayerActionMessage(playerid,15.0,"acabou de desligar o motor.");
}
}
}
}
}
}
else
{
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERRO:] Nao estas em nenhum veiculo!");
}
return 1;
}