Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Turning on/off vehicle engine.
Turning on/off vehicle engine. [message #335882] Wed, 18 June 2008 20:45 Go to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Ok guys, here is a chat hook i made and i want to share it Smile
TurnON
class e_onChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
		GameObject *veh = Get_Vehicle(obj);
Console_Input(StrFormat("cmsg 166,149,56 [BSS: Engine is on!] ").c_str());
Commands->Enable_Engine(veh,1);

		}
};
ChatCommandRegistrant<e_onChatCommand> e_onChatCommandReg("!engine_on",CHATTYPE_ALL,0,GAMEMODE_AOW);

TurnOFF
class e_offChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
		GameObject *veh = Get_Vehicle(obj);
Console_Input(StrFormat("cmsg 166,149,56 [BSS: Engine is off!] ").c_str());
Commands->Enable_Engine(veh,0);

		}
};
ChatCommandRegistrant<e_offChatCommand> e_offChatCommandReg("!engine_off",CHATTYPE_ALL,0,GAMEMODE_AOW);


Just put them both in gmmain.cpp and it will work. (for begginers)
Usage: !engine_on = turn on the engine. !engine_off = turn off the engine!
Have fun Smile


This account is no longer being active.
Re: Turning on/off vehicle engine. [message #335884 is a reply to message #335882] Wed, 18 June 2008 21:45 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)
Cool, but try this...

class e_onChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {

if(Get_Vehicle(Get_GameObj(ID))){
Commands->Enable_Engine(Get_Vehicle(Get_GameObj(ID)),1);
Console_Input(StrFormat("cmsg 166,149,56 [BSS: Engine is on!] ").c_str());
}
else{
Console_Input(StrFormat("ppage %d You must be driving a vehicle to use this command.",ID).c_str());
}
		}
};
ChatCommandRegistrant<e_onChatCommand> e_onChatCommandReg("!engine_on",CHATTYPE_ALL,0,GAMEMODE_AOW);


You might also consider setting a boolean so you can use the same command to turn it on/off.



[Updated on: Wed, 18 June 2008 21:45]

Report message to a moderator

Re: Turning on/off vehicle engine. [message #335885 is a reply to message #335884] Wed, 18 June 2008 21:52 Go to previous message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Forgot about that part Razz
Thanks!


This account is no longer being active.
Previous Topic: scripts question
Next Topic: Any tutorials how to make commands in C++
Goto Forum:
  


Current Time: Tue Nov 19 11:16:10 MST 2024

Total time taken to generate the page: 0.01115 seconds