SA-MP Forums Archive
PROBLEM Vehicle Destroy [REPS] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PROBLEM Vehicle Destroy [REPS] (/showthread.php?tid=493271)



PROBLEM Vehicle Destroy [REPS] - Mahde - 07.02.2014

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 !


Re: PROBLEM Vehicle Destroy [REPS] - Mahde - 08.02.2014

Bump help please


Re: PROBLEM Vehicle Destroy [REPS] - ]Rafaellos[ - 08.02.2014

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.


Re: PROBLEM Vehicle Destroy [REPS] - Mahde - 08.02.2014

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.