Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Stealth command help
Re: Stealth command help [message #408016 is a reply to message #408012] Thu, 22 October 2009 13:44 Go to previous messageGo to previous message
Hubba is currently offline  Hubba
Messages: 40
Registered: October 2009
Karma:
Recruit
reborn wrote on Thu, 22 October 2009 15:38

And you changed the chat hook?

You should post the code really. To be honest, I was writing that at work from my head, it was more to give you the direction than anything else...


Join_hook
void Player_Join_Hook(int i,const char *Nick) {
		
	for (int a = 1; a < 128; a++){
	if(IsPlayerStealth[a] == true){
	Commands->Enable_Stealth(Get_GameObj(a),true);
            }
}
	VetAddPlayer(i);			
	if (!Data->Plugins.empty()) {
		std::vector<PluginInfo*>::const_iterator it;
		for (it = Data->Plugins.begin();it != Data->Plugins.end(); ++it) {
			if ((*it)->Type == Plugin) {
				if ((*it)->PlayerJoinHookHandle) {
					(*it)->PlayerJoinHookHandle(i,Nick);	
				}
			}
		}
	}
	if (Settings->GameMode == 2) {
		CTF_Player_Join(i);
	}
}


Level_loaded
void Level_Loaded() {
	strncpy(Data->CurrMap,The_Game()->MapName,29);
	Settings->Load();

	Attach_Script_All_Buildings_Team(2,"MDB_SSGM_Building","",true);
	Attach_Script_All_Turrets_Team(2,"MDB_SSGM_Base_Defense","",true);

	for (int a = 1; a < 128; a++){
	IsPlayerStealth[a] = false;
	}
	if (Settings->EnableNewCrates) {
		Crate_Level_Loaded();
	}
	if (Settings->Gamelog) {
		Gamelog_Level_Loaded();
	}
	if (Settings->GameMode == 2) {
		CTF_Level_Loaded();
	}
	if (Settings->LogPlayerPurchase) {
		Data->PlayerPurchaseHookID = AddCharacterPurchaseMonHook(SSGM_Purchase_Hook,0);
	}
	if (Settings->LogPowerupPurchase) {
		Data->PowerupPurchaseHookID = AddPowerupPurchaseMonHook(SSGM_Purchase_Hook,0);
	}
	if (Settings->LogVehiclePurchase) {
		Data->VehiclePurchaseHookID = AddVehiclePurchaseMonHook(SSGM_Purchase_Hook,0);
	}

	if (!Data->Plugins.empty()) {
		std::vector<PluginInfo*>::const_iterator it;
		for (it = Data->Plugins.begin();it != Data->Plugins.end(); ++it) {
			if ((*it)->Type == Plugin) {
				if ((*it)->LevelLoadedHookHandle) {
					(*it)->LevelLoadedHookHandle();	
				}
			}
		}
	}
}


Gmmain.h
class Hubba_Stealth : public ScriptImpClass {
void  Created(GameObject *obj);
void Killed(GameObject *obj,GameObject *shooter);
};


The command:
class StealthChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
	GameObject *obj = Get_GameObj(ID);
	float Credits = Commands->Get_Money(obj);

	if(Credits >= 1000){	
		Commands->Give_Money(obj,-1000,false);
			char message[256];
				sprintf(message,"msg %s bought a Stealthsuit", Get_Player_Name_By_ID(ID));
				Console_Input(message); 
					//Commands->Enable_Stealth(obj,true);
					Commands->Attach_Script(obj,"Hubba_Stealth","");
		}
	else {
	Console_Input(StrFormat("ppage %d You need $1000.",ID).c_str());  
	}
}
};
ChatCommandRegistrant<StealthChatCommand> StealthChatCommandReg("!ss;!StealthSuit;!SS;!stealthsuit",CHATTYPE_ALL,0,GAMEMODE_AOW);



void Hubba_Stealth::Created(GameObject *obj)
{
Commands->Enable_Stealth(obj,true);
IsPlayerStealth[Get_Player_ID(obj)] = true;
}	

void Hubba_Stealth::Killed(GameObject *obj,GameObject *shooter)
{
IsPlayerStealth[Get_Player_ID(obj)] = false;
}
ScriptRegistrant<Hubba_Stealth> Hubba_Stealth_Registrant("Hubba_Stealth","");

[Updated on: Thu, 22 October 2009 20:48]

Report message to a moderator

 
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
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: I need of a modified scripts.dll
Next Topic: Level Edit Problem
Goto Forum:
  


Current Time: Sat Dec 21 08:41:57 MST 2024

Total time taken to generate the page: 0.01261 seconds