07.05.2013, 15:40
Tenta ai
pawn Код:
//Topo
new motor[MAX_VEHICLES];
new LigadoDesligado2[MAX_VEHICLES] = 0;
stock LigadoDesligado(carid)//desativado
{
new txt[20];
if(LigadoDesligado2[carid] == 0)
{
format(txt, sizeof(txt),"~r~Desligado");
}
else if(LigadoDesligado2[carid] == 1)
{
format(txt, sizeof(txt),"Ligado");
}
return txt;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
motor[playerid] = 0;
new string[256];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s Entrou no Veнculo.", sendername);
ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(Trancado[vehicleid] >= 1)
{
if(PlayerInfo[playerid][pAdmin] > 0 || ispassenger) { }
else
{
new Float:x,Float:y,Float:z,Float:a;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
SetPlayerPos(playerid, x, y, z+0.3);
SetPlayerFacingAngle(playerid, a);
SendClientMessage(playerid, COLOR_YELLOW, "Veiculo Trancado!");
}
}
return true;
}
//Comando
if(strcmp("/motor",cmdtext,true,6)==0)
{
new motorista = GetPlayerState(playerid);
if(!IsPlayerInAnyVehicle(playerid) && motorista != PLAYER_STATE_DRIVER))
{
SendClientMessage(playerid,COLOR_GREY,"Vocк precisa estar em um veнculo!");
return 1;
}
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
new vid = GetPlayerVehicleID(playerid);
if(Gas[vid] == 0)
return SendClientMessage(playerid,COLOR_GRAD2," Veiculo sem Combustivel");
if(LigadoDesligado2[vid] == 1)
{
motor[carro] = 1;
}
if(LigadoDesligado2[vid] == 0)
{
motor[carro] = 0;
}
if(carro != INVALID_VEHICLE_ID)
{
if(motor[carro] == 0)
{
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
motor[carro] = 1;
LigadoDesligado2[carro] = 1;
SendClientMessage(playerid, COLOR_WHITE, "Motor do veiculo ligado");
}
else
{
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
motor[carro] = 0;
LigadoDesligado2[carro] = 0;
SendClientMessage(playerid, COLOR_WHITE, "Motor do veiculo desligado");
}
}
return 1;
}