Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » [script]!sellveh  () 3 Votes
Re: !sellveh [message #334879 is a reply to message #327514] Thu, 12 June 2008 09:36 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)
It was a nice way of suggesting you might want to try something easier, something that might not cause you too much trouble figuring out.
The offer stands, send it to me and I'll fix it for you, but I hope you perhaps try buying a book on C++ or something afterwards.



Re: !sellveh [message #334884 is a reply to message #334879] Thu, 12 June 2008 10:28 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 fixed the errors i had today, but still cant compile your code.
Here is the source.
http://files.filefront.com/sourcezip/;10609477;/fileinfo.html


This account is no longer being active.
Re: !sellveh [message #334886 is a reply to message #327514] Thu, 12 June 2008 10:32 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 don't have access to a compiler at work, but when I get home in around five-six hours time I will look over it and fix your mistakes.


[Updated on: Thu, 12 June 2008 10:33]

Report message to a moderator

Re: !sellveh [message #334889 is a reply to message #334886] Thu, 12 June 2008 10:50 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
Thanks mate.
And can you tell me what files you edited and put "//Done by REBORN" near the stuff that u put or edited. That way i could understand what was the problem.


This account is no longer being active.

[Updated on: Thu, 12 June 2008 10:56]

Report message to a moderator

Re: !sellveh [message #335052 is a reply to message #327514] Fri, 13 June 2008 03:18 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)
Link to source:
http://www.game-maps.net/staff/reborn/ferkat.zip

Edits and changes have been commented. I havn't been able to test it as I do not have a renegade server anymore, but I am pretty sure it will work Wink



Re: !sellveh [message #335104 is a reply to message #335052] Fri, 13 June 2008 09: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
Works now Smile
Thank you very much. I'm going to go see how u did it so then i woulld know how to do it Smile


This account is no longer being active.
Re: !sellveh [message #335127 is a reply to message #327514] Fri, 13 June 2008 12:19 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
Reborn which version of !sllveh is best for renegade

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: !sellveh [message #335129 is a reply to message #327514] Fri, 13 June 2008 12:35 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)
The last one, especially if you use temped vehicle presets.


Re: !sellveh [message #341643 is a reply to message #327514] Fri, 18 July 2008 17:25 Go to previous messageGo to next message
a000clown
Messages: 364
Registered: May 2005
Location: Canada
Karma: 0
Commander
I know this is a little old, but I noticed the team number is wrong in the first portion of the code, line 6.
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){

It should be (Type == 0) instead of (Type == 2)


Another thing, when you type !sellveh it says it will be sold for $0.000000 but after the 15 seconds it gets sold for the correct price.
I haven't figured out how to fix this.
Re: !sellveh [message #341985 is a reply to message #341643] Sun, 20 July 2008 05:29 Go to previous messageGo to next message
wittebolx is currently offline  wittebolx
Messages: 332
Registered: May 2007
Location: the netherlands
Karma: 0
Recruit
Clown wrote on Sat, 19 July 2008 02:25

I know this is a little old, but I noticed the team number is wrong in the first portion of the code, line 6.
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){

It should be (Type == 0) instead of (Type == 2)


Another thing, when you type !sellveh it says it will be sold for $0.000000 but after the 15 seconds it gets sold for the correct price.
I haven't figured out how to fix this.


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,"CnC_Nod_APC") == 0) VehValue = 250;
else if (stricmp(Preset,"CnC_GDI_APC") == 0) VehValue = 250;
else if (strstr(Preset,"CnC_GDI_Humm-vee") == 0) VehValue = 175;
else if (strstr(Preset,"CnC_GDI_MRLS") == 0) VehValue = 225;
else if (strstr(Preset,"CnC_Civilian_Pickup01_Secret") == 0) VehValue = 50;
else if (strstr(Preset,"CnC_Civilian_Sedan01_Secret") == 0) VehValue = 50;
else if (strstr(Preset,"CnC_Nod_Buggy") == 0) VehValue = 150;
else if (strstr(Preset,"CnC_Nod_Mobile Artillery") == 0) VehValue = 225;
else if (strstr(Preset,"Nod_Chameleon") == 0) VehValue = 100;
else if (strstr(Preset,"CnC_Nod_Recon_Bike") == 0) VehValue = 150;
else if (strstr(Preset,"CnC_Nod_Transport") == 0) VehValue = 400;
else if (strstr(Preset,"CnC_GDI_Transport") == 0) VehValue = 400;
else if (strstr(Preset,"CnC_GDI_Medium_Tank") == 0) VehValue = 400;
else if (strstr(Preset,"CnC_GDI_Mammoth_Tank") == 0) VehValue = 600;
else if (strstr(Preset,"CnC_Nod_Light_Tank") == 0) VehValue = 300;
else if (strstr(Preset,"CnC_Nod_Flame_Tank") == 0) VehValue = 400;
else if (strstr(Preset,"CnC_Nod_Stealth_Tank") == 0) VehValue = 450;
else if (strstr(Preset,"CnC_Nod_Apache") == 0) VehValue = 450;
else if (strstr(Preset,"CnC_GDI_Orca") == 0) VehValue = 450;
else if (strstr(Preset,"CnC_GDI_Harvester") == 0) VehValue = 500;
else if (strstr(Preset,"CnC_Nod_Harvester") == 0) VehValue = 500;

	return VehValue;
}

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 == 0){
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);

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);
	}
}
}



Re: !sellveh [message #341988 is a reply to message #341985] Sun, 20 July 2008 06:21 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
I would use Get_Cost(Commands->Get_Preset_Name(obj))/2 rarther than having to do it for each vehicle

goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Re: !sellveh [message #342237 is a reply to message #341988] Mon, 21 July 2008 08: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)
Hex wrote on Sun, 20 July 2008 09:21

I would use Get_Cost(Commands->Get_Preset_Name(obj))/2 rarther than having to do it for each vehicle


I did update the code to do this and posted it earlier in the thread:

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;
	}
	}
}
}


The only reason I don't rely on get_cost is because allot of the maps on my server use temped presets with varying costs, and that function will not work with them.
But for renegade that else would most likely never get called.



Re: !sellveh [message #342244 is a reply to message #327514] Mon, 21 July 2008 08:49 Go to previous message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
Was replying to wittebolx, didn't see your post Smile

goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Previous Topic: [script]Parachute function
Next Topic: BloodMod
Goto Forum:
  


Current Time: Mon Apr 28 01:29:40 MST 2025

Total time taken to generate the page: 0.01008 seconds