11.11.2012, 22:04
Coloquei um sistema no meu servidor q ao player apertar Alt o carro liga e desliga mais quando eu crio veiculos no /veh o carro nao liga
pawn Код:
if(strcmp(cmd, "/veh", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] < 1339)
{
SendClientMessage(playerid, COLOR_GRAD1, " Vocк nгo esta autorizado a usar este comando!");
return 1;
}
if(CreatedCar >= 200)
{
SendClientMessage(playerid, COLOR_GRAD1, "Jб criaram muitos carros, destrua alguns primeiro /destruirid");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /veh [IDCARRO] [COR1] [COR2]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, " Modelo Do Carro Tem Que Ser Entre 411 e 600 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /veh [IDCARRO] [COR1] [COR2]");
return 1;
}
new COLOR1;
COLOR1 = strval(tmp);
if(COLOR1 < 0 || COLOR1 > 236) { SendClientMessage(playerid, COLOR_GREY, " Nъmero Da Cor tem que ser entre 0 e 126 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /veh [IDCARRO] [COR1] [COR2]");
return 1;
}
new COLOR2;
COLOR2 = strval(tmp);
if(COLOR2 < 0 || COLOR2 > 236) { SendClientMessage(playerid, COLOR_GREY, " Nъmero Da Cor tem que ser entre 0 e 126 !"); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new carid = CreateVehicle(car, X,Y,Z, 0.0, COLOR1, COLOR2, 60000);
CreatedCars[CreatedCar] = carid;
CreatedCar ++;
format(string, sizeof(string), " Veiculo %d Criado.", carid);
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}
pawn Код:
if(strcmp("/motor",cmdtext,true,6)==0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(!IsPlayerInAnyVehicle(playerid))
{
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[playerid] = 1;
}
if(LigadoDesligado2[vid] == 0)
{
motor[playerid] = 0;
}
if(carro != INVALID_VEHICLE_ID)
{
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;
LigadoDesligado2[carro] = 1;
SendClientMessage(playerid, COLOR_WHITE, "Motor do veiculo {00eaff}ligado");
}
else
{
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
motor[playerid] = 0;
LigadoDesligado2[carro] = 0;
SendClientMessage(playerid, COLOR_WHITE, "Motor do veiculo {00eaff}desligado");
}
}
}
return 1;
}