21.11.2016, 22:15
o serve conta com um respawn de carros, que e pra deletar os carros a cada 1hr, mas nao cumpri sua funзao, apaga o carro em alguns segundos q o player ta fora do veiculo.
OnGameModeInit
Comando de criar o veiculo
Stock de criar o veiculo
resetador de veiculos
OnGameModeInit
PHP код:
SetTimer("RespawnVeh", 5000000, true);
PHP код:
CMD:car(playerid,params[])
{
new
veh[30],
vehid,
cor1,
cor2
;
if(AFKP[playerid] == true) return SendClientMessage(playerid, Cinza, "[ERRO] Vocк estб ausente.");
if(Logado[playerid] == false) return SendClientMessage(playerid, Cinza, "[ERRO] Vocк deve logar primeiro.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Cinza, "[ERRO] Vocк jб esta em um veнculo.");
if(sscanf(params,"s[30]dd",veh,cor1,cor2)) return SendClientMessage(playerid, Azul,"{FF0000}[ERRO] {C3C3C3} /car [nome ou ID] [cor1] [cor2]");
if(IsNumeric(veh)) vehid = strval(veh);
else vehid = ReturnVehicleModelID(veh);
if(vehid < 400 || vehid > 611) return SendClientMessage(playerid,-1,"{FF0000}[AVISO]{FFFFFF} Veнculo invalido");
{
if(vehid == 520 || vehid == 432 || vehid == 592 || vehid == 425 ||
vehid == 464 || vehid == 406 || vehid == 476 || vehid == 447) return SendClientMessage(playerid, Vermelho, "[INFO] Este veнculo so pode ser usado no {556B2F}Mundo Mata-mata{FFFFFF}!");
}
GiveVehicle(playerid, vehid, cor1, cor2);
return 1;
}
PHP код:
GiveVehicle(playerid, vehicleid, color1, color2)
{
if(!IsPlayerInAnyVehicle(playerid))
{
if(CreatedVehicle[playerid])
{
DestroyVehicle(CreatedVehicle[playerid]);
CreatedVehicle[playerid] = 0;
}
new Float:x, Float:y, Float:z, string2[85];
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, Angle);
CreatedVehicle[playerid] = CreateVehicle(vehicleid, x, y, z, Angle, color1, color2, -1);
SetVehicleVirtualWorld(CreatedVehicle[playerid], GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(CreatedVehicle[playerid], GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, CreatedVehicle[playerid], 0);
format(string2,sizeof(string2),"{FF0000}[AVISO]{FFFFFF}Vocк criou o veнculo %s ID: {FF0000}%d", VehicleNames[vehicleid-400],vehicleid);
SendClientMessage(playerid, -1, string2);
return 1;
}
return 0;
}
//==============================================================================
ReturnVehicleModelID(Name[])
{
for(new i; i != 211; i++) if(strfind(VehicleNames[i], Name, true) != -1) return i + 400;
return INVALID_VEHICLE_ID;
}
PHP код:
forward RespawnVeh();
public RespawnVeh()
{
new bool:vehicle[MAX_VEHICLES];
for(new j = 1; GetVehicleModel(j); ++j)
{
vehicle[j] = false;
for(new i, p = GetMaxPlayers(); i < p; ++i)
{
if(!IsPlayerInAnyVehicle(i) || !IsPlayerConnected(i)) continue;
if(IsPlayerInVehicle(i, j))
{
vehicle[j] = true;
break;
}
}
if(!vehicle[j]) SetVehicleToRespawn(j);
}
SendClientMessageToAll(VerdeC, "[AVISO] Todos os veнculos, foram resetados automaticamente.");
return 1;
}