28.07.2013, 00:09
Tenta assim:
Obs: Nгo testado.
pawn Код:
forward sismotor(playerid); // topo do gamemode
if (strcmp("/motor", cmdtext, true, 10) == 0)
{
new State;
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
if(carro != INVALID_VEHICLE_ID)
{
if(IsPlayerInAnyVehicle(playerid))
{
State=GetPlayerState(playerid);
if(State!=PLAYER_STATE_DRIVER)
{
MSGPLAYER(playerid,COLOR_GREY," Vocк nгo й o motorista/piloto do veнculo");
return 1;
}
if(motor[playerid] == 0)
{
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, 0xFFFFFFAA, "Veiculo {2F991A}Ligado, {FFFFFF}Digite /motor para desliga-lo");
}
else if(motor[playerid] == 1)
{
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, 0xFFFFFFAA, "Veiculo {E31919}Desligado, {FFFFFF}Digite /motor para liga-lo");
}
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
if(motor[playerid] == 1){ sismotor(playerid); }
}
else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
TextDrawHideForPlayer(playerid, MotorOnOFF[i]);
motor[playerid] = 0;
}
return 1;
}
public sismotor(playerid)
{
if(motor[i] == 1)
{
format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Ligado");
motor[playerid] = 1; // ligado
}
else if(motor[i] == 0)
{
format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Desligado");
motor[playerid] = 0; // desligado
}
TextDrawSetString(MotorOnOFF[i], velopet5);
return 1
}