29.09.2014, 04:28
Ola eu coloquei um sistema de motor no meu server sу que tem um porem quando entra nele digita /motor paw e liga normal mais se vc sair do veiculo e entrar dinovo vc tem que digitar dinovo e eu queria que se deixasse o veiculo ligado e saнsse e voltasse pra ele, ele ja ficava ligado.
codigos
codigos
PHP код:
if(newstate == PLAYER_STATE_DRIVER)
{
new vid = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
if(EngineCarro[vid] == 0 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,COLOR_WHITE, "* {00CD00}Para Ligar{FFFFFF} ou {EE0000}Desligar{FFFFFF} o Veiculo aperte {00CD00}'CTRL'{FFFFFF} ou digite: /motor.");
}
PHP код:
if(strcmp(cmd, "/motor",true) == 0)//na public OnPlayerCommandText
{
new vid = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
if(IsPlayerInAnyVehicle(playerid))
{
if(EngineCarro[vid] == 0 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new viados[MAX_PLAYER_NAME];
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, 0xFFFFFFAA, "Motor {2F991A}Ligado!");
EngineCarro[vid] = 1;
GetPlayerName(playerid, viados, sizeof(viados));
format(string, sizeof(string), "* %s Girou a chave e ligou o veiculo.", viados);
ProxDetector(20.0, playerid, string, ROXO,ROXO,ROXO,ROXO,ROXO);
}
else if(EngineCarro[vid] == 1 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new viados[MAX_PLAYER_NAME];
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, 0xFFFFFFAA, "Motor {E31919}Desligado!");
EngineCarro[vid] = 0;
GetPlayerName(playerid, viados, sizeof(viados));
format(string, sizeof(string), "* %s Girou a chave e desligou o veiculo.", viados);
ProxDetector(20.0, playerid, string, ROXO,ROXO,ROXO,ROXO,ROXO);
}
}
return 1;
}