Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Script Request
Re: Script Request [message #315126 is a reply to message #314997] Sat, 02 February 2008 10:29 Go to previous messageGo to previous message
Genesis2001
Messages: 1397
Registered: August 2006
Karma:
General (1 Star)
#include "engine.h"
#include "scripts.h"
#include "zbl.h"

void zbl_MVP_Script::Created(GameObject *obj)
{
	timeLeft = The_Game()->TimeRemaining_Seconds;
	Commands->Start_Timer(obj, this, 1.0f, 123); //every 30seconds check for time remaining
}
void zbl_MVP_Script::Timer_Expired(GameObject *obj, int number)
{
	if (number == 123)
	{
		timeLeft = The_Game()->TimeRemaining_Seconds;
		if (timeLeft <= 2) {
			float score; int ID;
			for (GenericSLNode* PlayerIter = PlayerList->HeadNode; (PlayerIter != NULL); PlayerIter = PlayerIter->NodeNext)
			{
				GameObject *Player = (GameObject *)PlayerIter->NodeData;
				int i = Get_Player_ID(Player);
				score = Get_Score(i);
				if (Get_Score(i) > score) {
					ID = i;
				}
			}
			
			for (GenericSLNode* PlayerIter = PlayerList->HeadNode; (PlayerIter != NULL); PlayerIter = PlayerIter->NodeNext)
			{
				GameObject *Player = (GameObject *)PlayerIter->NodeData;
				int i = Get_Player_ID(Player);

				if (i == ID) {
					Change_Team_By_ID(i, 1);
					char Msg1[150];
					sprintf(Msg1, "ppage %d You are being changed to team GDI for being the current MVP", i);
					Console_Input(Msg1);
					delete []Msg1;
				}
				else {
					Change_Team_By_ID(i, 0);
					char Msg1[150];
					sprintf(Msg1, "ppage %d You are being changed to team Nod for not being the MVP for the current map.", i);
					Console_Input(Msg1);
					delete []Msg1;
				}
			}

		}
		else {
			Commands->Start_Timer(obj, this, 1.0f,123);
		}
	}
}

ScriptRegistrant<zbl_MVP_Script> zbl_MVP_Script_Registrant("zbl_MVP_Script", "");


----------------------------------

class zbl_MVP_Script : public ScriptImpClass {
	void Created(GameObject *obj);
	void Destroyed(GameObject *obj);
	void Timer_Expired(GameObject *obj, int number);
	float timeLeft;
};



----------------------------------

**Note: Untested.

Usage: Create an invisible object or a dave's arrow on every map you want to use this script on and attach this script to it.

If it doesn't work, which I doubt Satisfied, I'm sure reborn will help you out. Big Ups

~Zack

[Updated on: Sat, 02 February 2008 10:32]

Report message to a moderator

 
Read Message icon1.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help
Next Topic: Battle For Dune update 10
Goto Forum:
  


Current Time: Thu Dec 26 22:02:42 MST 2024

Total time taken to generate the page: 0.00772 seconds