Lunchbox

Cleanup Bikes Script

18 posts in this topic

8 minutes ago, happydayz said:

u should be able to use either. theres no real need for it to be in a server pbo tho as its a tiny amount of code.

So if I am using the default exile bike spawns is this something good to have?

Share this post


Link to post
Share on other sites
Advertisement
35 minutes ago, g0thic_ice_cre said:

I actually put the player's uid on the bike, then when they spawn a new one, delete all existing bikes that have their uid on it.

Still don't forget to check if someone else uses it. 

E.g if you steel it from someone they can just build a new one to mess with you. This is only relevant if it costs material to build it. 

Can easily be fixed with an eventHandler applied on the bike that updates the attached playerUID

  • Like 1

Share this post


Link to post
Share on other sites
33 minutes ago, Janski said:

Still don't forget to check if someone else uses it. 

E.g if you steel it from someone they can just build a new one to mess with you. This is only relevant if it costs material to build it. 

Can easily be fixed with an eventHandler applied on the bike that updates the attached playerUID

Hmm, that's a good idea, I think I'll add that even handler too :) and of course check the crew :)

Share this post


Link to post
Share on other sites
On ‎04‎/‎06‎/‎2016 at 5:54 AM, happydayz said:

WHY WHY WHY??? Exile has a beautiful thread system for a reason!

Run this in InitServer.sqf in your mission file.



Private ["_time"];

_time = 3600; //How often you want this to run (time in sec)

_function = {

{		
	_position = position _x; 
	if ((typeOf _x) in ["Exile_Bike_MountainBike","Exile_Bike_OldBike"]) then 
	{
		if([_position, 100] call ExileClient_util_world_isAlivePlayerInRange) exitwith {};
		deleteVehicle _x;
	};
} forEach vehicles;

};

[_time, _function, [], true] call ExileServer_system_thread_addTask;	

Thats just a quick example of your code run by exile in an efficient manner :)

Hey @happydayz

 

I put the code into the initServer.sqf but when I start the server I see the below in my RPT file and bikes don't clean up, I tested the main delete function in the debug console and it works fine, just wont add the task

 

17:40:04 Error in expression <thread_threadAdjust.sqf"

 

 

 

 

 

if (ExileSystemThreadDelays isEqualTo []) th>
17:40:04   Error position: <ExileSystemThreadDelays isEqualTo []) th>
17:40:04   Error Undefined variable in expression: exilesystemthreaddelays
17:40:04 File exile_server\code\ExileServer_system_thread_threadAdjust.sqf, line 12
17:40:04 Error in expression <hreadID = param [4, false];
_threadId = ExileSystemThreadID;
if(_pushBackThreadI>
17:40:04   Error position: <ExileSystemThreadID;
if(_pushBackThreadI>
17:40:04   Error Undefined variable in expression: exilesystemthreadid
17:40:04 File exile_server\code\ExileServer_system_thread_addTask.sqf, line 18

 

have I done something wrong or has stuff changed since this was posted?

 

Cheers

Share this post


Link to post
Share on other sites

Hey Guys,

this script is working. I use it to cleanup spawned quads.

Only Problem is, it doesnt check if the quad is locked/owned or if it is freshly spawned. After Restart, all quads get deleted.

Is someone there, who can add a check for a playeruid to the script? This should solve the problem with bought quads. Does it fix the problem with spawned quads too?

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.