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 #468607 is a reply to message #468584] Fri, 08 June 2012 05:44 Go to previous messageGo to previous message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma:
General (3 Stars)
For starters:
char params[256];
sprintf(params, "%d,%s,%s,%s,%s,%s,%s,%s",params,Get_Parameter("0.0"),Get_Parameter("300.0"),Get_Parameter("10.0"),Get_Parameter("CnC_GDI_Orca"),Get_Parameter("CnC_GDI_Transport"),Get_Parameter("CnC_Nod_Apache"),Get_Parameter("CnC_Nod_Transport"));
Attach_Script_Once(nsam,"JFW_Base_Defence_Aircraft_Only",params);


Should pobably be like this:

char params[256];
sprint(params,"0.0,300.0,10.0,CnC_GDI_Orca, CnC_GDI_Transport,CnC_Nod_Apache,CnC_Nod_Transport");
Attach_Script_Once(nsam,"JFW_Base_Defence_Aircraft_Only",params);



Or even better
Attach_Script_Once(nsam,"JFW_Base_Defence_Aircraft_Only","0.0,300.0,10.0,CnC_GDI_Orca, CnC_GDI_Transport,CnC_Nod_Apache,CnC_Nod_Transport");



Also, feeding params back into params is a bad idea:
sprintf(params,"%d",params);

plus it won't work like that, because params is a char and %d is for int.

The only time feeding a string back into itself is useful is if you have the origial string set to something, otherwise you risk filling it with junk.

IE:
char params[256];
sprintf(params,"stuff");
sprintf(params,"%s is stuff",params);
Console_Input(params);

would give you:
stuff is stuff


[Updated on: Fri, 08 June 2012 05:52]

Report message to a moderator

 
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: Fri Nov 22 16:41:29 MST 2024

Total time taken to generate the page: 0.00607 seconds