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 #342237 is a reply to message #341988] Mon, 21 July 2008 08:22 Go to previous messageGo to previous message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma:
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.



 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [script]Parachute function
Next Topic: BloodMod
Goto Forum:
  


Current Time: Tue Nov 26 11:08:49 MST 2024

Total time taken to generate the page: 0.01109 seconds