07.02.2014, 22:15
hello iv a server and iv more than 50 players sometimes and you know when some people type /car [id] etc this will make flood cars wich lag game so iv tried to make command which destroy automaticlly vehicle when a player death or disconnecting or exit from vehicle but the bug which i saw now is when i drive a car its destroying with out any reason
Here is CODE:
OnPlayerDisconnect
OnPlayerDeath
Note: the flooding cars is caused by pick up vehicles
How to destroy all the cars except the vehicle which player are in its really a big problem please help !
Here is CODE:
Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
SetTimerEx("DesVeh", 60000, 0, "i", vehicleid);
return 1;
}
forward DesVeh(vehid);
public DesVeh(vehid)
{
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInVehicle(i, vehid)) return 1;
}
}
return DestroyVehicle(vehid);//SetVehicleToRespawn(vehid);
}
Код:
public OnPlayerDisconnect(playerid, reason)
{
new vehicleid = GetPlayerVehicleID(playerid);
DestroyVehicle(vehicleid);
return 1;
}
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
//vehicle destroy
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
return 1;
}
Код:
CreateVehicleEx(playerid,411, X,Y,Z+1, Angle, random(126), random(126), -1);


