Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » [script]!sellveh  () 3 Votes
[script]!sellveh [message #327514] Wed, 23 April 2008 16:13 Go to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I have been writing some code for when the new patch of cnc_reborn comes out with vehicles. I wanted to ability to enable or disable the selling of vehicles in my server. I havn't tested it out very much, other then a couple of attempts. I thought the renegade community might like it and if someone does use it then they could also report back any issues/problems ahead of the reborn release so I might be able to resolve them before the patch release.

The code is based on SSGM, you will need to adapt it for renegade slightly, but I have made it clear in the comments where...

I will restate that I havn't tested it too much, there will most likely be issues, I am aware that after being ejected you can get back in, I will write code at some point to make sure that halts the sale of the vehicle, unless someone submits it...


Include this function somewhere, I chose GMMAIN.cpp
float GetValue(const char* Preset) {
	float VehValue = 0;
// These preset names need to be changed to renegade vehicle preset names, you also need to make the cost whatever you feel is the right amount to get for the sale of the vehicle
if (stricmp(Preset,"GDI_AAPC") == 0) VehValue = 3;
else if (stricmp(Preset,"GDI_Disruptor") == 0) VehValue = 100;

	return VehValue;
}



Here's the chat hook:
class sellvehChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *MyVeh = Find_My_Veh(Get_GameObj(ID));
		GameObject *Own = Get_GameObj(ID);
		float Value = GetValue(Commands->Get_Preset_Name(MyVeh));
		int Type = Commands->Get_Player_Type(Own);
		if (Type == 2){
float Dist = Commands->Get_Distance(Commands->Get_Position(Own),Commands->Get_Position(Find_War_Factory(0)));
		if (!MyVeh) {
			Console_Input(StrFormat("ppage %d You must have a vehicle bound to you to use this command. Type !bind in teamchat to bind the vehicle you are currently in.",ID).c_str());
		}
		if (MyVeh && Value > 0 && Dist <= 20.0f) {
			Force_Occupants_Exit(MyVeh);
            Commands->Send_Custom_Event(Own,MyVeh,1112,0,0);
			Commands->Attach_Script(Own,"reb_sell_veh","");
			Console_Input(StrFormat("ppage %d Your vehicle will be sold in 15 seconds for $%f, unless it is stolen/destroyed.",ID,GetValue(Commands->Get_Preset_Name(MyVeh))).c_str());
		}
		if (MyVeh && Value == 0) {
			Console_Input(StrFormat("ppage %d This vehicle is not supported by this command, please report this bug.",ID).c_str());
		}
				if (Dist > 20.0f) {
			Console_Input(StrFormat("ppage %d To use this command you must be in close proximity to the Nod WarFactory",ID).c_str());
		}
		}
		else{
float Dist = Commands->Get_Distance(Commands->Get_Position(Own),Commands->Get_Position(Find_War_Factory(1)));
		if (!MyVeh) {
			Console_Input(StrFormat("ppage %d You must have a vehicle bound to you to use this command. Type !bind in teamchat to bind the vehicle you are currently in.",ID).c_str());
		}
		if (MyVeh && Value > 0 && Dist <= 20.0f) {
			Force_Occupants_Exit(MyVeh);
            Commands->Send_Custom_Event(Own,MyVeh,1112,0,0);
			Commands->Attach_Script(Own,"reb_sell_veh","");
			Console_Input(StrFormat("ppage %d Your vehicle will be sold in 15 seconds for $%f, unless it is stolen/destroyed.",ID,GetValue(Commands->Get_Preset_Name(MyVeh))).c_str());
		}
		if (MyVeh && Value == 0) {
			Console_Input(StrFormat("ppage %d This vehicle is not supported by this command, please report this bug.",ID).c_str());
		}
				if (Dist > 20.0f) {
			Console_Input(StrFormat("ppage %d To use this command you must be in close proximity to the GDI WarFactory",ID).c_str());
		}
		}
	}
};
ChatCommandRegistrant<sellvehChatCommand> sellvehChatCommandReg("!sellveh",CHATTYPE_ALL,0,GAMEMODE_AOW);


Here's the script that does the selling:

void reb_sell_veh::Created(GameObject *obj) {
GameObject *MyVeh = Find_My_Veh(obj);
VehID = Commands->Get_ID(MyVeh);


Commands->Start_Timer(obj, this, 15.0f, 1);
}

void reb_sell_veh::Killed(GameObject *obj, GameObject *shooter){
Console_Input(StrFormat("ppage %d Your vehicle sale has been halted",Get_Player_ID(obj)).c_str());
}

void reb_sell_veh::Timer_Expired(GameObject *obj, int number){
if(number == 1){
	if(Commands->Find_Object(VehID)){
Commands->Destroy_Object(Find_My_Veh(obj));
Commands->Give_Money(obj,GetValue(Commands->Get_Preset_Name(Find_My_Veh(obj))), 0);
	}
}
}

ScriptRegistrant<reb_sell_veh> reb_sell_veh_Registrant("reb_sell_veh","");



class reb_sell_veh : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj, int number);
	void Killed(GameObject *obj, GameObject *shooter);
	int VehID;
};




[Updated on: Fri, 30 January 2009 14:31] by Moderator

Report message to a moderator

Re: !sellveh [message #327516 is a reply to message #327514] Wed, 23 April 2008 16:17 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
nice work
i heard that u made it possible that u could make renegade have 3 teams or it is some one else
was it u ?


This account is no longer being active.
Re: !sellveh [message #327518 is a reply to message #327516] Wed, 23 April 2008 16:22 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
HeavyX101 wrote on Wed, 23 April 2008 19:17

nice work
i heard that u made it possible that u could make renegade have 3 teams or it is some one else
was it u ?




I didn't really make the renegade engine support three teams, it could always do that really. I just wrote a team re-balancing script that worked on the player join event and map load event. Plus wrote a spawn manager because the start-up spawners don't really work for any other team besides GDI and Nod.

But yeah, the effect was three teams at the same time all playing together. The systems was not without flaws though, some assembly on the clients is required to display the endgame results properly and also make the clients on the third team not able to kill eachother. But it was all going well until I started focusing more time on cnc_reborn. I do intend to get back to it eventually...



Re: !sellveh [message #327521 is a reply to message #327518] Wed, 23 April 2008 16:26 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
kewl u sound like 1337 coder
i have asked every one this question but no one answered me
i have visual studio 2005 and i heard that it could modify renegade engine or the game.exe
do u kno if i could change the codings of game.exe like make a new button in the menu and make functions for it (using vs 2005)
lol dont worry i'm not going to ask u lots of stuff
this is only the thing i need to ask


This account is no longer being active.
Re: !sellveh [message #327522 is a reply to message #327521] Wed, 23 April 2008 16:30 Go to previous messageGo to next message
BlueThen is currently offline  BlueThen
Messages: 2402
Registered: February 2006
Karma: 0
General (2 Stars)
Can't you make a scrap building (a building where a player can sell him/herself/vehicle inside)? I mean, proffessional games aren't usually played via text...

[Updated on: Wed, 23 April 2008 16:30]

Report message to a moderator

Re: !sellveh [message #327524 is a reply to message #327522] Wed, 23 April 2008 16:32 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
a path beyond kinda supports that
but it is bit different then what u wanted


This account is no longer being active.
Re: !sellveh [message #327525 is a reply to message #327522] Wed, 23 April 2008 16:34 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Originally Blue wrote on Wed, 23 April 2008 19:30

Can't you make a scrap building (a building where a player can sell him/herself/vehicle inside)? I mean, proffessional games aren't usually played via text...


This is just a concept really, cnc_reborn will probably have a service depot where this kind of thing can happen, I just liked the feature in DA and was curious if I could reproduce it.
But for renegade it is a little too late to add a building such as this... I thought others might get some use from it really...



Re: !sellveh [message #327527 is a reply to message #327514] Wed, 23 April 2008 16:42 Go to previous messageGo to next message
Canadacdn is currently offline  Canadacdn
Messages: 1830
Registered: September 2005
Location: Temple of Nod
Karma: 0
General (1 Star)
PLECOS MASTER
I'm seeing problems with this. Couldn't someone sell their vehicle before it is killed? Getting money and denying the other player points?
Re: !sellveh [message #327528 is a reply to message #327527] Wed, 23 April 2008 16:52 Go to previous messageGo to next message
KobraOps is currently offline  KobraOps
Messages: 202
Registered: January 2007
Karma: 0
Recruit
I think it says u have to close to ur WF/AS
that you must be out of your veh
it takes 15 seconds
if u did or its stolen it stops the sell.
Seems fair.

[Updated on: Wed, 23 April 2008 16:53]

Report message to a moderator

Re: !sellveh [message #327529 is a reply to message #327527] Wed, 23 April 2008 17:03 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Canadacdn wrote on Wed, 23 April 2008 18:42

I'm seeing problems with this. Couldn't someone sell their vehicle before it is killed? Getting money and denying the other player points?

umm
that is no big deal if the code contains this
E.g
Medium Tank
300 health
300 armor
800 credits cost
if sell credits = 800/2=400$
Light tank damaged Medium tank
medium tank - 300 armour
= sell credits = 200$
sorry but that is how i could of explain Razz


This account is no longer being active.
Re: !sellveh [message #327560 is a reply to message #327527] Wed, 23 April 2008 23:09 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Canadacdn wrote on Wed, 23 April 2008 19:42

I'm seeing problems with this. Couldn't someone sell their vehicle before it is killed? Getting money and denying the other player points?


Sorry, I should of explained it a little better...

For a player to sue the command he has to be pretty close to his vehicle factory. He has to wait 15 seconds before the vehicle is destroyed and the money is granted to him. He cannot simply type it just before the enemy is about to blow him to kingdom come.



Re: !sellveh [message #327578 is a reply to message #327560] Thu, 24 April 2008 02:44 Go to previous messageGo to next message
CarrierII is currently offline  CarrierII
Messages: 3804
Registered: February 2006
Location: England
Karma: 0
General (3 Stars)

reborn wrote on Thu, 24 April 2008 07:09

Canadacdn wrote on Wed, 23 April 2008 19:42

I'm seeing problems with this. Couldn't someone sell their vehicle before it is killed? Getting money and denying the other player points?


Sorry, I should of explained it a little better...

For a player to sue the command he has to be pretty close to his vehicle factory. He has to wait 15 seconds before the vehicle is destroyed and the money is granted to him. He cannot simply type it just before the enemy is about to blow him to kingdom come.


That and it'd need some serious fast typing skills to get the command out in time.


Renguard is a wonderful initiative
Toggle Spoiler
Re: !sellveh [message #327596 is a reply to message #327514] Thu, 24 April 2008 04:25 Go to previous messageGo to next message
EA-DamageEverything
Messages: 423
Registered: January 2005
Location: Germany
Karma: 0
Commander
Nice code Reborn! I remember BC has (or had) the !sellveh command inside their scripts, is yours similar to that? At least I read something about this on their Wiki.
Re: !sellveh [message #327598 is a reply to message #327596] Thu, 24 April 2008 04:41 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
EA-DamageEverything wrote on Thu, 24 April 2008 07:25

Nice code Reborn! I remember BC has (or had) the !sellveh command inside their scripts, is yours similar to that? At least I read something about this on their Wiki.



Yeah, I created this based on my experiance in the Black-cell server. In my opinion it's always been, and still is the best renegade server out there.

I need to update this code at some point to make it halt the sale on the MDB_SSGM_Vehicle_Owner::Custom event, specifically on this conditional:
else if (message == CUSTOM_EVENT_VEHICLE_ENTER) {
so that it halts if the owner of the vehicle gets back in the vehicle. But other then that it works pretty much identically to DA (although DA doesn't restrict where you can sell it).

I feel bad posting code here sometimes, black-cell has done loads for the renegade scene, and I seem to always plaguerise there features. And WD is normally the first person i go to if I have a problem that I don't understand.
But I hope that the black-cell community see this more as a homage to DA's excellence ather then trying to be a stinky little butt-hole.



[Updated on: Thu, 24 April 2008 08:51]

Report message to a moderator

Re: !sellveh [message #327613 is a reply to message #327514] Thu, 24 April 2008 08:56 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Updated to halt the sale if you re-enter, and a sale message...


void reb_sell_veh::Created(GameObject *obj) {
GameObject *MyVeh = Find_My_Veh(obj);
VehID = Commands->Get_ID(MyVeh);


Commands->Start_Timer(obj, this, 15.0f, 1);
}

void reb_sell_veh::Killed(GameObject *obj, GameObject *shooter){
Console_Input(StrFormat("ppage %d Your vehicle sale has been halted",Get_Player_ID(obj)).c_str());
sellingveh = false;
}

void reb_sell_veh::Timer_Expired(GameObject *obj, int number){
if(number == 1){
	if(Commands->Find_Object(VehID)){
		float value = GetValue(Commands->Get_Preset_Name(Find_My_Veh(obj)));
Console_Input(StrFormat("ppage %d Your vehicle was successfully sold for $%f.",Get_Player_ID(obj),value).c_str());
Commands->Give_Money(obj,GetValue(Commands->Get_Preset_Name(Find_My_Veh(obj))), 0);
Commands->Destroy_Object(Find_My_Veh(obj));
sellingveh = false;
	}
}
}


class sellvehChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *MyVeh = Find_My_Veh(Get_GameObj(ID));
		GameObject *Own = Get_GameObj(ID);
		float Value = GetValue(Commands->Get_Preset_Name(MyVeh));
		int Type = Commands->Get_Player_Type(Own);
		if (Type == 2){
float Dist = Commands->Get_Distance(Commands->Get_Position(Own),Commands->Get_Position(Find_War_Factory(0)));
		if (!MyVeh) {
			Console_Input(StrFormat("ppage %d You must have a vehicle bound to you to use this command. Type !bind in teamchat to bind the vehicle you are currently in.",ID).c_str());
		}
		if (MyVeh && Value > 0 && Dist <= 20.0f) {
			Force_Occupants_Exit(MyVeh);
            Commands->Send_Custom_Event(Own,MyVeh,1112,0,0);
			Commands->Attach_Script(Own,"reb_sell_veh","");
			Console_Input(StrFormat("ppage %d Your vehicle will be sold in 15 seconds for $%f, unless you re-enter it or it is stolen/destroyed.",ID,GetValue(Commands->Get_Preset_Name(MyVeh))).c_str());
			sellingveh = true;
		}
		if (MyVeh && Value == 0) {
			Console_Input(StrFormat("ppage %d This vehicle is not supported by this command, please report this bug.",ID).c_str());
		}
				if (Dist > 20.0f) {
			Console_Input(StrFormat("ppage %d To use this command you must be in close proximity to the Nod WarFactory",ID).c_str());
		}
		}
		else{
float Dist = Commands->Get_Distance(Commands->Get_Position(Own),Commands->Get_Position(Find_War_Factory(1)));
		if (!MyVeh) {
			Console_Input(StrFormat("ppage %d You must have a vehicle bound to you to use this command. Type !bind in teamchat to bind the vehicle you are currently in.",ID).c_str());
		}
		if (MyVeh && Value > 0 && Dist <= 20.0f) {
			Force_Occupants_Exit(MyVeh);
            Commands->Send_Custom_Event(Own,MyVeh,1112,0,0);
			Commands->Attach_Script(Own,"reb_sell_veh","");
			Console_Input(StrFormat("ppage %d Your vehicle will be sold in 15 seconds for $%f, unless you re-enter it or it is stolen/destroyed.",ID,GetValue(Commands->Get_Preset_Name(MyVeh))).c_str());
			sellingveh = true;
		}
		if (MyVeh && Value == 0) {
			Console_Input(StrFormat("ppage %d This vehicle is not supported by this command, please report this bug.",ID).c_str());
		}
				if (Dist > 20.0f) {
			Console_Input(StrFormat("ppage %d To use this command you must be in close proximity to the GDI WarFactory",ID).c_str());
		}
		}
	}
};
ChatCommandRegistrant<sellvehChatCommand> sellvehChatCommandReg("!sellveh",CHATTYPE_ALL,0,GAMEMODE_AOW);



declare and initialise sellingveh at the top of your .cpp file (I choose GMMAIN.cpp).

bool sellingveh = false;


I also added this code to the "else if (message == CUSTOM_EVENT_VEHICLE_ENTER) {" conditional in the "void MDB_SSGM_Vehicle_Owner::Custom(GameObject *obj, int message, int param, GameObject *sender) {" script. I moved this script over to GMMAIN.cpp long ago, but if you do not want to do that then you must remember to externalise the sellingveh boolean.

 if (IsLocked && Commands->Get_ID(Get_Vehicle_Occupant(obj,0)) == Commands->Get_ID(sender) && Commands->Get_ID(sender) == MyOwner(3)) {
	 if(sellingveh){
Remove_Script(Get_GameObj(MyOwner(2)),"reb_sell_veh");
Console_Input(StrFormat("ppage %d Your vehicle sale has been halted because you re-entered your vehicle.",MyOwner(2)).c_str());
sellingveh = false;
	 }




Re: !sellveh [message #327615 is a reply to message #327522] Thu, 24 April 2008 09:02 Go to previous messageGo to next message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
Originally Blue wrote on Wed, 23 April 2008 18:30

Can't you make a scrap building (a building where a player can sell him/herself/vehicle inside)? I mean, proffessional games aren't usually played via text...

Runs on my Test Server...
Re: !sellveh [message #334801 is a reply to message #327615] Wed, 11 June 2008 22:13 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
I'm really really sorry that i'm posting on this old thread.
But i'm having problems with this code. When i compile the project, i get these errors:
Quote:

.\sell.cpp(14) : error C2228: left of '.c_str' must have class/struct/union
type is ''unknown-type''
.\sell.cpp(14) : error C3861: 'StrFormat': identifier not found
.\sell.cpp(15) : error C2065: 'sellingveh' : undeclared identifier
.\sell.cpp(21) : error C3861: 'GetValue': identifier not found
.\sell.cpp(22) : error C2228: left of '.c_str' must have class/struct/union
type is ''unknown-type''
.\sell.cpp(22) : error C3861: 'StrFormat': identifier not found
.\sell.cpp(23) : error C3861: 'GetValue': identifier not found

Can you guys please help me.


This account is no longer being active.
Re: !sellveh [message #334825 is a reply to message #327514] Thu, 12 June 2008 03:09 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I've actually changed that quite a bit now anyway, for cnc_reborn there have been some map releases with temped vehicles so it makes sense to do it the way I did with GetValue, however for renegade you can get the cost directly from the preset itself.
Actually this will still most likely work for renegade, and still allow you to adapt if you have temped vehicle presets in your server too. Here's my updated version.


class sellvehChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *MyVeh = Find_My_Veh(Get_GameObj(ID));
		GameObject *Own = Get_GameObj(ID);
		int Type = Commands->Get_Player_Type(Own);
		if (Type == 2){
float Dist = Commands->Get_Distance(Commands->Get_Position(Own),Commands->Get_Position(Find_Soldier_Factory(0)));
		if (!MyVeh) {
			Console_Input(StrFormat("ppage %d You must have a vehicle bound to you to use this command. Type !bind in teamchat to bind the vehicle you are currently in.",ID).c_str());
		}
		if (MyVeh && Dist <= 20.0f) {
			Force_Occupants_Exit(MyVeh);
            Commands->Send_Custom_Event(Own,MyVeh,1112,0,0);
			Commands->Attach_Script(Own,"reb_sell_veh","");
			Console_Input(StrFormat("ppage %d Your vehicle will be sold in 15 seconds for $%f, unless you re-enter it or it is stolen/destroyed.",ID,GetValue(Commands->Get_Preset_Name(MyVeh))).c_str());
			sellingveh = true;
		}
		if (Dist > 20.0f) {
			Console_Input(StrFormat("ppage %d To use this command you must be in close proximity to the Nod HON",ID).c_str());
		}
		}
		else{
float Dist = Commands->Get_Distance(Commands->Get_Position(Own),Commands->Get_Position(Find_Soldier_Factory(1)));
		if (!MyVeh) {
			Console_Input(StrFormat("ppage %d You must have a vehicle bound to you to use this command. Type !bind in teamchat to bind the vehicle you are currently in.",ID).c_str());
		}
		if (MyVeh && Dist <= 20.0f) {
			Force_Occupants_Exit(MyVeh);
            Commands->Send_Custom_Event(Own,MyVeh,1112,0,0);
			Commands->Attach_Script(Own,"reb_sell_veh","");
			Console_Input(StrFormat("ppage %d Your vehicle will be sold in 15 seconds for $%f, unless you re-enter it or it is stolen/destroyed.",ID,GetValue(Commands->Get_Preset_Name(MyVeh))).c_str());
			sellingveh = true;
		}
				if (Dist > 20.0f) {
			Console_Input(StrFormat("ppage %d To use this command you must be in close proximity to the GDI Barracks",ID).c_str());
		}
		}
	}
};
ChatCommandRegistrant<sellvehChatCommand> sellvehChatCommandReg("!sellveh",CHATTYPE_ALL,0,GAMEMODE_AOW);



This will now mean that it gets the vehicles value directly from the preset itself and halves it, unless the preset doesn't exist (i.e it's a temped preset you made yourself), then it will try to get the value from GetValue.
void reb_sell_veh::Timer_Expired(GameObject *obj, int number){
if(number == 1){
	if(Commands->Find_Object(VehID)){
unsigned int worth;
worth = (Get_Cost((Commands->Get_Preset_Name(Commands->Find_Object(VehID))))/2);
if (worth > 0){
Console_Input(StrFormat("ppage %d Your vehicle was successfully sold for $%i.",Get_Player_ID(obj),worth).c_str());
Commands->Give_Money(obj,GetValue(Commands->Get_Preset_Name(Find_My_Veh(obj))), 0);
Commands->Destroy_Object(Find_My_Veh(obj));
sellingveh = false;
}
else {
		float value = GetValue(Commands->Get_Preset_Name(Find_My_Veh(obj)));
Console_Input(StrFormat("ppage %d Your vehicle was successfully sold for $%f.",Get_Player_ID(obj),value).c_str());
Commands->Give_Money(obj,GetValue(Commands->Get_Preset_Name(Find_My_Veh(obj))), 0);
Commands->Destroy_Object(Find_My_Veh(obj));
sellingveh = false;
	}
	}
}
}


ScriptRegistrant<reb_sell_veh> reb_sell_veh_Registrant("reb_sell_veh","");



class reb_sell_veh : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj, int number);
	void Killed(GameObject *obj, GameObject *shooter);
	int VehID;
};


Had to change MDB_SSGM_Vehicle_Owner a little bit...

void MDB_SSGM_Vehicle_Owner::Custom(GameObject *obj, int message, int param, GameObject *sender) {
	if (message == 1111) {
		Commands->Destroy_Object(Commands->Find_Object(IconID));
		Commands->Destroy_Object(Commands->Find_Object(IconID2));
		Destroy_Script();
	}
	else if (message == 1112) {
		IsLocked = true;
		if (Commands->Get_ID(Get_Vehicle_Occupant(obj,0)) != MyOwner(3)) Force_Occupant_Exit(obj,0);
		if (GetIconBone(obj,1)) {
			Commands->Destroy_Object(Commands->Find_Object(IconID));
			GameObject *Icon = Commands->Create_Object_At_Bone(obj,"Invisible_Object",GetIconBone(obj,1));
			Commands->Set_Model(Icon,"p_keycrd_red");
			Commands->Attach_To_Object_Bone(Icon,obj,GetIconBone(obj,1));
			IconID = Commands->Get_ID(Icon);
		}
		if (GetIconBone(obj,2)) {
			Commands->Destroy_Object(Commands->Find_Object(IconID2));
			GameObject *Icon2 = Commands->Create_Object_At_Bone(obj,"Invisible_Object",GetIconBone(obj,2));
			Commands->Set_Model(Icon2,"p_keycrd_red");
			Commands->Attach_To_Object_Bone(Icon2,obj,GetIconBone(obj,2));
			IconID2 = Commands->Get_ID(Icon2);
		}
	}
	else if (message == 1113) {
		IsLocked = false;
		if (GetIconBone(obj,1)) {
			Commands->Destroy_Object(Commands->Find_Object(IconID));
			GameObject *Icon = Commands->Create_Object_At_Bone(obj,"Invisible_Object",GetIconBone(obj,1));
			Commands->Set_Model(Icon,"o_em_apc");
			Commands->Attach_To_Object_Bone(Icon,obj,GetIconBone(obj,1));
			IconID = Commands->Get_ID(Icon);
		}
		if (GetIconBone(obj,2)) {
			Commands->Destroy_Object(Commands->Find_Object(IconID2));
			GameObject *Icon2 = Commands->Create_Object_At_Bone(obj,"Invisible_Object",GetIconBone(obj,2));
			Commands->Set_Model(Icon2,"o_em_apc");
			Commands->Attach_To_Object_Bone(Icon2,obj,GetIconBone(obj,2));
			IconID2 = Commands->Get_ID(Icon2);
		}
	}
	else if (message == CUSTOM_EVENT_VEHICLE_ENTER) {
		if (Commands->Get_Player_Type(sender) != Team) {
			Console_Input(StrFormat("ppage %d The enemy has stolen your vehicle!",MyOwner(2)).c_str());
			Commands->Destroy_Object(Commands->Find_Object(IconID));
			Commands->Destroy_Object(Commands->Find_Object(IconID2));
			Destroy_Script();
		}
		else if (IsLocked && Commands->Get_ID(Get_Vehicle_Occupant(obj,0)) == Commands->Get_ID(sender) && Commands->Get_ID(sender) != MyOwner(3)) {
			Commands->Control_Enable(sender,false);
			Commands->Start_Timer(obj,this,0.5f,3);
			Console_Input(StrFormat("pamsg %d The vehicle you entered is locked and belongs to %ls.",Get_Player_ID(sender),Get_Wide_Player_Name_By_ID(MyOwner(2))).c_str());
		}
		else if (Commands->Get_ID(Get_Vehicle_Occupant(obj,0)) == Commands->Get_ID(sender) && Commands->Get_ID(sender) != MyOwner(3)) {
			Console_Input(StrFormat("ppage %d Warning! %ls has entered your bound vehicle. If you wish to remove them type !vkick in teamchat.",MyOwner(2),Get_Wide_Player_Name(sender)).c_str());
		}
 if (IsLocked && Commands->Get_ID(Get_Vehicle_Occupant(obj,0)) == Commands->Get_ID(sender) && Commands->Get_ID(sender) == MyOwner(3)) {
	 if(sellingveh){
Remove_Script(Get_GameObj(MyOwner(2)),"reb_sell_veh");
Console_Input(StrFormat("ppage %d Your vehicle sale has been halted because you re-entered your vehicle.",MyOwner(2)).c_str());
sellingveh = false;
	 }
}

	}
}



float GetValue(const char* Preset) {
	float VehValue = 0;

if (stricmp(Preset,"test") == 0) VehValue = 1;
else if (stricmp(Preset,"GDI Harvester MP2") == 0) VehValue = 300;
else if (stricmp(Preset,"GDI Harverster MP") == 0) VehValue = 300;
else if (stricmp(Preset,"GDI Titan") == 0) VehValue = 700;
else if (stricmp(Preset,"GDI Wolverine") == 0) VehValue = 300;
else if (stricmp(Preset,"GDI Orca") == 0) VehValue = 500;
else if (stricmp(Preset,"GDI Orca Bomber") == 0) VehValue = 500;
else if (stricmp(Preset,"NOD Harverster MP") == 0) VehValue = 300;
else if (stricmp(Preset,"Nod TickTank TS") == 0) VehValue = 550;
else if (stricmp(Preset,"Nod TickTank") == 0) VehValue = 525;
else if (stricmp(Preset,"Nod Buggy") == 0) VehValue = 200;
else if (stricmp(Preset,"GDI Titan TS") == 0) VehValue = 600;
else if (stricmp(Preset,"Nod TickTank TS") == 0) VehValue = 550;
else if (stricmp(Preset,"Nod Buggy TS") == 0) VehValue = 250;

	return VehValue;
}


You will need to change this to your renegade temped presets (if you have any, if not you should change the reb_sell_veh script and nt even bother with this at all.

float GetValue(const char* Preset) {
	float VehValue = 0;

if (stricmp(Preset,"test") == 0) VehValue = 1;
else if (stricmp(Preset,"GDI Harvester MP2") == 0) VehValue = 300;
else if (stricmp(Preset,"GDI Harverster MP") == 0) VehValue = 300;
else if (stricmp(Preset,"GDI Titan") == 0) VehValue = 700;
else if (stricmp(Preset,"GDI Wolverine") == 0) VehValue = 300;
else if (stricmp(Preset,"GDI Orca") == 0) VehValue = 500;
else if (stricmp(Preset,"GDI Orca Bomber") == 0) VehValue = 500;
else if (stricmp(Preset,"NOD Harverster MP") == 0) VehValue = 300;
else if (stricmp(Preset,"Nod TickTank TS") == 0) VehValue = 550;
else if (stricmp(Preset,"Nod TickTank") == 0) VehValue = 525;
else if (stricmp(Preset,"Nod Buggy") == 0) VehValue = 200;
else if (stricmp(Preset,"GDI Titan TS") == 0) VehValue = 600;
else if (stricmp(Preset,"Nod TickTank TS") == 0) VehValue = 550;
else if (stricmp(Preset,"Nod Buggy TS") == 0) VehValue = 250;

	return VehValue;
}


Also, you need to include this as a global variable

bool sellingveh = false;



Re: !sellveh [message #334854 is a reply to message #334825] Thu, 12 June 2008 07:39 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Worst. Now i got even more errors.
Quote:

------ Build started: Project: SSGM, Configuration: Debug Win32 ------
Compiling...
sell.cpp
.\sell.cpp(14) : error C2228: left of '.c_str' must have class/struct/union
type is ''unknown-type''
.\sell.cpp(14) : error C3861: 'StrFormat': identifier not found
.\sell.cpp(15) : error C2065: 'sellingveh' : undeclared identifier
.\sell.cpp(24) : error C2228: left of '.c_str' must have class/struct/union
type is ''unknown-type''
.\sell.cpp(24) : error C3861: 'StrFormat': identifier not found
.\sell.cpp(25) : error C3861: 'GetValue': identifier not found
.\sell.cpp(30) : error C3861: 'GetValue': identifier not found
.\sell.cpp(31) : error C2228: left of '.c_str' must have class/struct/union
type is ''unknown-type''
.\sell.cpp(31) : error C3861: 'StrFormat': identifier not found
.\sell.cpp(32) : error C3861: 'GetValue': identifier not found
dllmain.cpp
gmsettingsclass.cpp
gmscripts.cpp
.\gmscripts.cpp(1413) : error C2653: 'MDB_SSGM_Vehicle_Owner' : is not a class or namespace name
.\gmscripts.cpp(1414) : error C2065: 'IsLocked' : undeclared identifier
.\gmscripts.cpp(1415) : error C2065: 'Team' : undeclared identifier
.\gmscripts.cpp(1415) : error C3861: 'Get_Int_Parameter': identifier not found
.\gmscripts.cpp(1420) : error C2065: 'IconID' : undeclared identifier
.\gmscripts.cpp(1429) : error C2065: 'IconID2' : undeclared identifier
.\gmscripts.cpp(1436) : error C2653: 'MDB_SSGM_Vehicle_Owner' : is not a class or namespace name
.\gmscripts.cpp(1440) : error C3861: 'Destroy_Script': identifier not found
.\gmscripts.cpp(1444) : error C3861: 'MyOwner': identifier not found
.\gmscripts.cpp(1479) : error C2228: left of '.c_str' must have class/struct/union
.\gmscripts.cpp(1479) : error C3861: 'MyOwner': identifier not found
.\gmscripts.cpp(1482) : error C3861: 'Destroy_Script': identifier not found
.\gmscripts.cpp(1484) : error C3861: 'MyOwner': identifier not found
.\gmscripts.cpp(1486) : error C2673: 'Custom' : global functions do not have 'this' pointers
.\gmscripts.cpp(1487) : error C3861: 'MyOwner': identifier not found
.\gmscripts.cpp(1489) : error C3861: 'MyOwner': identifier not found
.\gmscripts.cpp(1490) : error C2228: left of '.c_str' must have class/struct/union
.\gmscripts.cpp(1490) : error C3861: 'MyOwner': identifier not found
.\gmscripts.cpp(1492) : error C3861: 'MyOwner': identifier not found
.\gmscripts.cpp(1493) : error C2065: 'sellingveh' : undeclared identifier
.\gmscripts.cpp(1494) : error C3861: 'MyOwner': identifier not found
.\gmscripts.cpp(1495) : error C2228: left of '.c_str' must have class/struct/union
.\gmscripts.cpp(1495) : error C3861: 'MyOwner': identifier not found
.\gmscripts.cpp(1503) : error C2653: 'MDB_SSGM_Vehicle_Owner' : is not a class or namespace name
.\gmscripts.cpp(1504) : error C2228: left of '.c_str' must have class/struct/union
.\gmscripts.cpp(1504) : error C3861: 'MyOwner': identifier not found
.\gmscripts.cpp(1507) : error C3861: 'Destroy_Script': identifier not found
.\gmscripts.cpp(1510) : error C2653: 'MDB_SSGM_Vehicle_Owner' : is not a class or namespace name
.\gmscripts.cpp(1515) : error C2653: 'MDB_SSGM_Vehicle_Owner' : is not a class or namespace name
.\gmscripts.cpp(1520) : error C2653: 'MDB_SSGM_Vehicle_Owner' : is not a class or namespace name
.\gmscripts.cpp(1525) : error C2653: 'MDB_SSGM_Vehicle_Owner' : is not a class or namespace name
.\gmscripts.cpp(1526) : error C3861: 'MyOwner': identifier not found
.\gmscripts.cpp(1531) : error C2653: 'MDB_SSGM_Vehicle_Owner' : is not a class or namespace name
.\gmscripts.cpp(1531) : error C2365: 'MyOwner' : redefinition; previous definition was 'formerly unknown identifier'
.\gmscripts.cpp(1533) : error C3861: 'Get_Int_Parameter': identifier not found
.\gmscripts.cpp(1536) : error C3861: 'Get_Int_Parameter': identifier not found
.\gmscripts.cpp(2158) : error C2065: 'MDB_SSGM_Vehicle_Owner' : undeclared identifier
.\gmscripts.cpp(2158) : error C2514: 'ScriptRegistrant' : class has no constructors
c:\westwood\renegadefds\server\scripts.h(480) : see declaration of 'ScriptRegistrant'
gmmain.cpp
gmkeyhook.cpp
gmgamelog.cpp
gmfunc.cpp
gmctf.cpp
gmcrate.cpp
gmcommandclass.cpp
engine_gm.cpp
Generating Code...
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 8.00.50727
Copyright (C) Microsoft Corporation. All rights reserved.
Build log was saved at "file://c:\Westwood\RenegadeFDS\Server\tmp\scripts\debug\BuildLog.htm"
SSGM - 48 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



This account is no longer being active.
Re: !sellveh [message #334860 is a reply to message #327514] Thu, 12 June 2008 08:04 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I said I had to edit 'MDB_SSGM_Vehicle_Owner', not create it. You need to edit the existing one.

I placed and migrated the the other existing scripts into gmmain.cpp to make it work.

You might want to try something a bit easier at first and build your confidence up a bit :-/



Re: !sellveh [message #334869 is a reply to message #334860] Thu, 12 June 2008 08:47 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Umm, i did modify it. I modifyed the one that is in the gmscrips.cpp

This account is no longer being active.
Re: !sellveh [message #334871 is a reply to message #334869] Thu, 12 June 2008 08:55 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Send me your entire solution and I'll fix it for you. But please take the advice and start smaller.


Re: !sellveh [message #334875 is a reply to message #334871] Thu, 12 June 2008 09:15 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
I'm getting problems with it, as i said in the other topic.

This account is no longer being active.
Re: !sellveh [message #334876 is a reply to message #334875] Thu, 12 June 2008 09:19 Go to previous messageGo to next message
cnc95fan is currently offline  cnc95fan
Messages: 1261
Registered: July 2007
Karma: 0
General (1 Star)
HeavyX101 wrote on Thu, 12 June 2008 11:15

I'm getting problems with it, as i said in the other topic.

Therefore you should..
reborn wrote on Thu, 12 June 2008 10:04

try something a bit easier at first and build your confidence up a bit :-/

Re: !sellveh [message #334878 is a reply to message #334876] Thu, 12 June 2008 09:31 Go to previous messageGo to previous message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
cnc95fan wrote on Thu, 12 June 2008 12:19

HeavyX101 wrote on Thu, 12 June 2008 11:15

I'm getting problems with it, as i said in the other topic.

Therefore you should..
reborn wrote on Thu, 12 June 2008 10:04

try something a bit easier at first and build your confidence up a bit :-/



What does he mean "build you confidence up a bit."


This account is no longer being active.
Previous Topic: [script]Parachute function
Next Topic: BloodMod
Goto Forum:
  


Current Time: Fri Nov 22 20:41:09 MST 2024

Total time taken to generate the page: 0.01427 seconds