if(strcmp(cmd, "/motor", true) == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
//new Float:health;
//new veh;
//veh = GetPlayerVehicleID(playerid) - 1;
//health = GetVehicleHealth(veh, health);
new Float:Vehhp;
new VID;
VID = GetPlayerVehicleID(playerid);
GetVehicleHealth(VID, Vehhp);
new carro = GetPlayerVehicleID(playerid) - 1;
if(DynamicCars[carro][buy] == 0)
{
if(Vehhp > 400)
{
if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
{
if(DynamicCars[GetPlayerVehicleID(playerid)][avariado] == 0)
{
TogglePlayerControllable(playerid,0);
new enginer;
enginer = random(50);
if(enginer >= 10)
{
TogglePlayerControllable(playerid,1);
EngineStatus[GetPlayerVehicleID(playerid)] = 1;
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"roda a chave na igniзгo e liga o motor.");
}
else
PlayerActionMessage(playerid,15.0,"roda a chave na igniзгo e liga o motor.");
}
}
if(enginer < 10)
{
PlayerActionMessage(playerid,15.0,"roda a chave na igniзгo mas nгo consegue ligar o carro.");
}
}
else if(DynamicCars[GetPlayerVehicleID(playerid)][avariado] == 1)
{
PlayerActionMessage(playerid,15.0,"repara no уleo que escorre por baixo do veiculo.");
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "O teu veнculo estб danificado, chama um mecвnico!");
}
}
else
{
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
TogglePlayerControllable(playerid, 0);
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"roda a chave na igniзгo e desliga o motor.");
}
else
{
PlayerActionMessage(playerid,15.0,"roda a chave na igniзгo e desliga o motor.");
}
}
}
else
{
if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
{
TogglePlayerControllable(playerid,1);
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "O teu veiculo estб muito danificado, chama um mecвnico!");
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"tenta ligar o motor mas o veiculo nгo pega.");
}
else
{
PlayerActionMessage(playerid,15.0,"tenta ligar o motor mas o veнculo nгo pega.");
}
}
else
{
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
TogglePlayerControllable(playerid, 1);
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "O teu veiculo estб muito danificado, chama um mecвnico!");
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"repara que a chave do veiculo se partiu.");
}
else
{
PlayerActionMessage(playerid,15.0,"repara que a chave do veiculo se partiu.");
}
}
}
}
//new carro = GetPlayerVehicleID(playerid) - 1;
if(DynamicCars[carro][buy] == 1)
{
TogglePlayerControllable(playerid,1);
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
RemovePlayerFromVehicle(playerid);
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
{
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"Nгo estбs dentro dum veiculo.");
}
return 1;
}
public OnGameModeInit()
{
ManualVehicleEngineAndLights();
return 1;
}
pawn Код:
By ApolloRJ |
if(!strcmp(cmd,"/teste",true))
{
new z,x,c,v,b,n,m;
GetVehicleParamsEx(GetPlayerVehicleID(playerid),z,x,c,v,b,n,m);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),VEHICLE_PARAMS_ON,x,c,v,b,n,m);
SendClientMessage(playerid, -1, "Motor Ligado. Vai te embora *-*");
return 1;
}
Tenta assim, se der й porque seu comando tб errado '-'
pawn Код:
|
// topo
new Motor[MAX_PLAYERS];
new engine,lights,alarm,doors,bonnet,boot,objective;
// OnPlayerConnect(playerid)
Motor[playerid] = 0;
if(!strcmp(cmd,"/ligar",true))
{
if(Motor[playerid] == 0) {
Motor[playerid] = 1;
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, 0x0000FFAA, "[ Veiculo ] {FFFFFF}Veiculo Ligado!");
}
else
{
Motor[playerid] = 0;
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, 0x0000FFAA, "[ Veiculo ] {FFFFFF}Veiculo Desligado! ");
}
return true;
}
Assim jб funcionou ... Como posso alterar o meu comando para funcionar tambem?
|
if((newkeys == KEY_MOTOR) && (IsPlayerInAnyVehicle(playerid)))
{
if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
{
OnPlayerCommandText(playerid,"/motor");
}
}