PROBLEM Vehicle Destroy [REPS]
#1

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:
Код:
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);
}
OnPlayerDisconnect
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    DestroyVehicle(vehicleid);
return 1;
}
OnPlayerDeath
Код:
public OnPlayerDeath(playerid, killerid, reason)
{

    //vehicle destroy
    SetVehicleToRespawn(GetPlayerVehicleID(playerid));
return 1;
}
Note: the flooding cars is caused by pick up vehicles
Код:
CreateVehicleEx(playerid,411, X,Y,Z+1, Angle, random(126), random(126), -1);
How to destroy all the cars except the vehicle which player are in its really a big problem please help !
Reply
#2

Bump help please
Reply
#3

Why don't you destroy the car when he Exit the server or when he create other one? Setting a timer will cause more lagg when 50+ players exit the vehicle at the same time.
Reply
#4

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
Why don't you destroy the car when he Exit the server or when he create other one? Setting a timer will cause more lagg when 50+ players exit the vehicle at the same time.
Really? , i wasnt know :/ , but my function working well? i need a function which respawn vehicles not destroy , because iv cars in my gamemodeinit , so if i destroyed it wont back again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)