SA-MP Forums Archive
Vehicle Anti-Spam - 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: Vehicle Anti-Spam (/showthread.php?tid=309430)



Vehicle Anti-Spam - lamarr007 - 07.01.2012

Hi, i have idea for my server (and for other too !).
If you exit an vehicle (as driver), car will be delete after 1 minute.
But, if you exit vehicle and then you enter it, car will not delete.
How can this works ?


Re: Vehicle Anti-Spam - BlackWolf120 - 07.01.2012

just use

pawn Код:
AddStaticVehicleEx ( 520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, /*1*/ );
//the green "1" is the value in minutes to respawn the certain vehicle.



Re: Vehicle Anti-Spam - lamarr007 - 07.01.2012

I know, but i mean something else. System, if you exit vehicle, timer start, but if you enter this vehicle, timer will stop. In timer will be script to destroy the vehicle.


Re: Vehicle Anti-Spam - Psymetrix - 07.01.2012

**Written on the forum**
pawn Код:
// Top of your script.
new bool:g_IsSpawnedVehicle[ MAX_VEHICLES char ];

// In spawning command.
new vehicleid = AddStaticVehicleEx( 552, 0.0000, 0.0000, 0.0000, 0.0000, -1, -1, 60 );
g_IsSpawnedVehicle{ vehicleid } = true;

// under OnVehicleSpawn
if ( g_IsSpawnedVehicle{ vehicleid } )
{
    DestroyVehicle( vehicleid );
    g_IsSpawnedVehicle{ vehicleid } = false;
}
This is just an example to get you going. If the player does not enter the vehicle it will not respawn and not be deleted. To fix this, put them in the vehicle as it is spawned and if they leave within the first 5 seconds, just destroy the vehicle then.


Re: Vehicle Anti-Spam - lamarr007 - 07.01.2012

I thinking something like if player enter any vehicle (spawned, or static)
Like if enter = KillTimer
And if eixt = SetTimer
But i donґt know how to do this...


Re: Vehicle Anti-Spam - BlackWolf120 - 07.01.2012

maybe i just missunderstand you but for me this is pointless...


Re: Vehicle Anti-Spam - lamarr007 - 07.01.2012

I just want to if player leave vehicle, timer start and after minute, vehicle destroy. If player leave vehicle, but in this minute enter again this vehicle, vehicleґll be not delete


Re: Vehicle Anti-Spam - Virtual1ty - 07.01.2012

As already pointed out, you actually do not need a timer for this.
Create the vehicle under OnGameModeInit with AddStaticVehicleEx, set it's respawn_delay parameter(last parameter) to 60(1 minute) and monitor for changes in OnVehicleSpawn.


Re: Vehicle Anti-Spam - lamarr007 - 07.01.2012

Hmm, thx to you How i can reduce 15 minut respawn delay if I using this system :
pawn Код:
public OnGameModeInit()
{
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/trains.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/pilots.txt");

    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_airport.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_gen.txt");

    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_gen.txt");

    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_inner.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_outer.txt");

    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/whetstone.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/bone.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/flint.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/tierra.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/red_county.txt");
    return 1;
    }



Re: Vehicle Anti-Spam - Virtual1ty - 07.01.2012

I believe the respawn time that function (LoadStaticVehiclesFromFile) sets is actually 30 minutes.
You can change that by editing the gl_common.inc file found in \include folder which comes by default with the SA-MP Server.