Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Having problems with Attach_Script_Once
Re: Having problems with Attach_Script_Once [message #468615 is a reply to message #468584] Fri, 08 June 2012 07:04 Go to previous message
Distrbd21 is currently offline  Distrbd21
Messages: 743
Registered: September 2008
Karma:
Colonel

Here's the fixed version just in case someone else wants to use it.
Big Grin
		if (wcsistr(Message,L"!sam") == Message)
		{
			GameObject *Player = Get_GameObj(PlayerID);
			{
				if(!Is_Map_Flying()) {
					Send_Message_Player(Player,255,255,127,"[DefBot] You need to be on a flying map to use !sam");
					return false;
				}
				float money = Commands->Get_Money(Player);
				float cost = 1000;
				if (money >= cost)
				{
					int team = Commands->Get_Player_Type(Player);
					if (Commands->Get_Money(Player)<1000)
					{
						Commands->Give_Money(Player,-1000,false);
						Vector3 pos = Commands->Get_Position(Player);
						pos.Z+=0.1f;
						GameObject *sam = Commands->Create_Object("Nod_SAM_Site",pos);
						Commands->Set_Player_Type(sam, team);
						Commands->Disable_Physical_Collisions(sam);
						Attach_Script_Once(sam,"JFW_Base_Defence_Aircraft_Only", "0.0,300.0,10.0,CnC_GDI_Orca,CnC_GDI_Transport,CnC_Nod_Apache,CnC_Nod_Transport");
						Send_Message_Player(Player,0,255,0,"[DefBot] %s You just bought a Samsite for your team.");
						Create_2D_WAV_Sound_Player(Player,"m00evan_dsgn0002i1evan_snd.wav");
					}
					else
					{
						Send_Message_Player(Player,0,255,0,"[DefBot] Insufficient Funds: Samsite cost 1000 credits.");
						Create_2D_Sound_Player(Player,"m00evan_dsgn0024i1evan_snd.wav");
					}
				}
			}
		}
		return false;
	}


Only one code and it works with both GDI and Nod. ;p


Live Your Life Not Some one Else's.| Sharing Is Caring

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: I don't get why it don't page the player...
Next Topic: Where can I find Jonwil's Level editor?
Goto Forum:
  


Current Time: Tue Nov 26 03:04:55 MST 2024

Total time taken to generate the page: 0.00675 seconds