| Home » Renegade Discussions » Mod Release Forum » Vetach plugin 
	| 
		
			| Re: Vetach plugin [message #438039 is a reply to message #438008] | Sun, 17 October 2010 02:36   |  
			| 
				
				
					|  robbyke Messages: 348
 Registered: September 2010
 Location: Belgium
 
	Karma: 
 | Recruit |  |  |  
	| ok these are the scripts 
 
 Toggle Spoiler
/*	Renegade Scripts.dll
	Vetach Plugin Code
	Copyright 2010 Robby Driesen
	This file is part of the Renegade scripts.dll
	The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
	the terms of the GNU General Public License as published by the Free
	Software Foundation; either version 2, or (at your option) any later
	version. See the file COPYING for more details.
	In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
	Only the source code to the module(s) containing the licenced code has to be released.
*/
#include "includes.h"
void VT_CarryAll::Created(GameObject *obj)
{	
		GameObject *driver = Get_Vehicle_Occupant(obj, 0);
		int team = Get_Object_Type(driver);
		int pID = Get_Player_ID(driver);
		Vector3 CurPosition = Commands->Get_Position(obj);
		bool test=false;
		GenericSLNode *x = BaseGameObjList->HeadNode;
		while (x)
		{
			GameObject *o = (GameObject *)x->NodeData;
			if (o && Is_Vehicle(o) && o!=obj)
			{
				Vector3 CurPositiono = Commands->Get_Position(o);
				float Dist = Commands->Get_Distance(CurPosition, CurPositiono);
							
				GameObject *driver2 = Get_Vehicle_Occupant(o, 0);
				if(Dist <= 6.0f)
				{
					if(Is_VTOLVehicle(o)||Is_Script_Attached(o,"VT_CARRYALL_ATTACHED"))
					{
						Remove_Script(obj,"VT_CarryAll");
						return;
					}
					else
					{
						if(driver2)
						{
							if(Get_Object_Type(driver2) == team && (Is_Script_Attached(driver2,"VT_Carrytest")==false))
							{
								//do some shit
								Commands->Attach_To_Object_Bone(o, obj, "v_fuselage3");
								Commands->Disable_Physical_Collisions(o);
								Console_Input(StrFormat("CMSGP %d 208,104,0 You have attached a friendly vehicle",pID).c_str());
								test = true;
								return;
							
							}
							else{Remove_Script(obj,"VT_CarryAll");return;}
						}
						if (Is_Script_Attached(o,"VT_CARRYALL_ATTACHED" )== false)
						{
							//do some shit																																
							Commands->Attach_To_Object_Bone(o, obj, "v_fuselage3");
							Commands->Disable_Physical_Collisions(o);
							Console_Input(StrFormat("CMSGP %d 208,104,0 You have attached a neutral vehicle",pID).c_str());
							test = true;
							return;
						}
					}
				}
			}
			x = x->NodeNext;
		}
		if(test == false)
		{
			Remove_Script(obj,"VT_CarryAll");
		}
};
ScriptRegistrant<VT_CarryAll> VT_CarryAll_Reg("VT_CarryAll","");
void VT_Detach::Created(GameObject *obj)
{	
	int pID = Get_Player_ID(obj);
	Vector3 CurPosition = Commands->Get_Position(obj);
		GenericSLNode *x = BaseGameObjList->HeadNode;
		while (x)
		{
				
			GameObject *o = (GameObject *)x->NodeData;
			if (o &&  o!=obj && Is_Vehicle(o))
			{
					
				Console_Input("CMSGP %d 208,104,0 Found someone");
				Vector3 CurPositiono = Commands->Get_Position(o);
				float Dist = Commands->Get_Distance(CurPosition, CurPositiono);
					
				if(Dist <= 1.0f)
				{
					// lets make an obj below our attached veh
					Vector3 posdetobj = CurPositiono;
					posdetobj.Z -= 3.25f;
					GameObject *detobj = Commands->Create_Object("Invisible_Object",posdetobj);
					Commands->Attach_To_Object_Bone(o, o, "v_fuselage3");
					Commands->Set_Position(o,posdetobj);
					Commands->Attach_To_Object_Bone(o, detobj, "v_fuselage3"); //attach to the thing below our veh
					Commands->Destroy_Object(detobj); // destroy our thing there is no need for it
					Commands->Enable_Collisions(o); // ok you cant run trough me
					Remove_Script(obj,"VT_CarryAll");
					Console_Input(StrFormat("CMSGP %d 208,104,0 You have just detached a veh",pID).c_str());
					return;
				}
				else
				{
					Remove_Script(obj,"VT_CarryAll");
				}
			}
			x = x->NodeNext;
		}
		Remove_Script(obj,"VT_Detach");
	
}
ScriptRegistrant<VT_Detach> VT_Detach_Reg("VT_Detach","");
void VT_Carrytest :: Created(GameObject *obj)
{
// just to make an decision
};
ScriptRegistrant<VT_Carrytest> VT_Carrytest_Reg("VT_Carrytest","");
void VT_CARRYALL_ATTACHED :: Created(GameObject *obj)
{
// just to make an decision
};
ScriptRegistrant<VT_CARRYALL_ATTACHED> VT_CARRYALL_ATTACHED_Reg("VT_CARRYALL_ATTACHED","");
 
 some bugs i remember:
 
 if you just bought a vehicle and you vtach it without anyone in it it says it attaches a neutral vehicle but the veh doesnt attach
 
 if you bought a vehicle to attach and die sometimes you cant pick it up although he says you do
 
 ps: in plugin harvester pickup is secured
 
 Owner of kambot TT server
 
 kambot.freeforums.org
 [Updated on: Wed, 20 October 2010 07:06] Report message to a moderator |  
	|  |  | 
	Goto Forum:
	|  |  | Vetach plugin By: robbyke  on Sat, 16 October 2010 11:29 |  
	|  |  | Re: Vetach plugin |  
	|  |  | Re: Vetach plugin |  
	|  |  | Re: Vetach plugin By: robbyke  on Sun, 17 October 2010 09:24 |  
	|  |  | Re: Vetach plugin By: reborn  on Sun, 17 October 2010 01:42 |  
	|  |  | Re: Vetach plugin By: robbyke  on Sun, 17 October 2010 02:36 |  
	|  |  | Re: Vetach plugin By: Xpert  on Sun, 17 October 2010 23:13 |  
	|  |  | Re: Vetach plugin By: robbyke  on Mon, 18 October 2010 04:36 |  
	|  |  | Re: Vetach plugin |  
	|  |  | Re: Vetach plugin By: robbyke  on Mon, 18 October 2010 07:51 |  
	|  |  | Re: Vetach plugin |  
	|  |  | Re: Vetach plugin By: Omar007  on Tue, 19 October 2010 07:25 |  
	|  |  | Re: Vetach plugin By: robbyke  on Tue, 19 October 2010 08:51 |  
	|  |  | Re: Vetach plugin |  
	|  |  | Re: Vetach plugin By: robbyke  on Wed, 20 October 2010 08:43 |  
 
 Current Time: Fri Oct 31 05:53:46 MST 2025 
 Total time taken to generate the page: 0.00832 seconds |