Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » C++ error
C++ error [message #363028] Sat, 13 December 2008 12:43 Go to next message
YazooGang is currently offline  YazooGang
Messages: 742
Registered: August 2008
Location: US
Karma: 0
Colonel
i wanted to make something quick for my renegade server and i made this simple command so in the future, it might be useful to like modify it and use it for something else:
class weaponmodChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
		if (state == WeaponClass::Firing)
		{
		
	Commands->Give_Points(obj,10,false);
				Commands->Give_Money(obj,10,false);
		}
		else 
		{
			//nothing 
		}
	}

};
ChatCommandRegistrant<weaponmodChatCommand> weaponmodChatCommandReg("!modw",CHATTYPE_ALL,0,GAMEMODE_AOW);



well, unfortunatly, i got errors:


Quote:

Error 1 error C2065: 'state' : undeclared identifier c:\Westwood\RenegadeFDS\Server\gmmain.cpp 1302



Quote:

Error 2 error C2597: illegal reference to non-static member 'WeaponClass::Firing' c:\Westwood\RenegadeFDS\Server\gmmain.cpp 1302



Quote:

Error 3 error C3867: 'WeaponClass::Firing': function call missing argument list; use '&WeaponClass::Firing' to create a pointer to member c:\Westwood\RenegadeFDS\Server\gmmain.cpp 1302



Quote:

Error 4 error C2568: '==' : unable to resolve function overload c:\Westwood\RenegadeFDS\Server\gmmain.cpp 1302



Quote:

Error 5 error BK1506 : cannot open file '.\tmp\scripts\debug\gmmain.sbr': No such file or directory BSCMAKE



help?

[Updated on: Sat, 13 December 2008 12:43]

Report message to a moderator

Re: C++ error [message #363031 is a reply to message #363028] Sat, 13 December 2008 12:47 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
Did you follow the steps in this post,
http://www.renegadeforums.com/index.php?t=msg&th=26642&start=0&rid=2 2699
Re: C++ error [message #363035 is a reply to message #363028] Sat, 13 December 2008 12:54 Go to previous messageGo to next message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma: 0
Colonel
What is "state" in your code?

Bückstabü!
Re: C++ error [message #363036 is a reply to message #363035] Sat, 13 December 2008 12:58 Go to previous messageGo to next message
YazooGang is currently offline  YazooGang
Messages: 742
Registered: August 2008
Location: US
Karma: 0
Colonel
Like the weapon i'm currently holding.
i think thats the problem lol
Re: C++ error [message #363037 is a reply to message #363036] Sat, 13 December 2008 13:06 Go to previous messageGo to next message
YazooGang is currently offline  YazooGang
Messages: 742
Registered: August 2008
Location: US
Karma: 0
Colonel
i dont even understand lol, should it be a script or aa command?
Re: C++ error [message #363038 is a reply to message #363028] Sat, 13 December 2008 13:24 Go to previous messageGo to next message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma: 0
Colonel
Quote:

Like the weapon i'm currently holding.
i think thats the problem lol


?? state is nothing in your code = undeclared identifier

And wtf is a "aa command"?


Bückstabü!
Re: C++ error [message #363039 is a reply to message #363038] Sat, 13 December 2008 13:31 Go to previous messageGo to next message
YazooGang is currently offline  YazooGang
Messages: 742
Registered: August 2008
Location: US
Karma: 0
Colonel
cAmpa wrote on Sat, 13 December 2008 14:24

Quote:

Like the weapon i'm currently holding.
i think thats the problem lol


?? state is nothing in your code = undeclared identifier

And wtf is a "aa command"?

A commands like !help !buy !kick ect...
and i got the state thing from the this code

	if (state == WeaponClass::WS_RELOADING){
		barx = (float)draw.Draw_Single_Line(D3DCOLOR_XRGB(255,255,0), 0, 0, L"Charging... ");
		barx *= draw.GetScalar();
		DrawChargeBar(barx, 0.003f, 0.02f, 0.004f, 1.0f-(1.0f/reloadtime*statetime), D3DCOLOR_XRGB(255,255,0), D3DCOLOR_XRGB(255,255,0), D3DCOLOR_XRGB(0,0,0));
	} else if (maxammo == 0 && _ammo == 0)
		draw.Draw_Single_Line(D3DCOLOR_XRGB(255,0,0), 0, 0, L"Battery depleted.");
	else
		draw.Draw_Single_Line(D3DCOLOR_XRGB(0,255,0), 0, 0, L"Charged.");
		


	if (g_pPICBatch->Serialize())
		g_pPICBatch->Render();
Re: C++ error [message #363040 is a reply to message #363028] Sat, 13 December 2008 13:38 Go to previous messageGo to next message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma: 0
Colonel
-.-

Bückstabü!
Re: C++ error [message #363041 is a reply to message #363028] Sat, 13 December 2008 13:41 Go to previous messageGo to next message
Ethenal is currently offline  Ethenal
Messages: 2532
Registered: January 2007
Location: US of A
Karma: 0
General (2 Stars)

I don't know where the "state" variable is coming from... find out what you're attempting to do there then worry about the rest.

-TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29

Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade Thumbs Up

Re: C++ error [message #363042 is a reply to message #363041] Sat, 13 December 2008 13:43 Go to previous messageGo to next message
YazooGang is currently offline  YazooGang
Messages: 742
Registered: August 2008
Location: US
Karma: 0
Colonel
ok basicly i wanted to make a code that gives u 10 credits and 10 points when ur firing.

nvm, it was just for fun.
Re: C++ error [message #363044 is a reply to message #363028] Sat, 13 December 2008 14:19 Go to previous messageGo to next message
saberhawk
Messages: 1068
Registered: January 2006
Location: ::1
Karma: 0
General (1 Star)
...



This is wrong on soooo many levels.
Re: C++ error [message #363050 is a reply to message #363028] Sat, 13 December 2008 15:05 Go to previous messageGo to next message
YazooGang is currently offline  YazooGang
Messages: 742
Registered: August 2008
Location: US
Karma: 0
Colonel
so then how would i make a command that gives me money and points each time i fire a bullet?
Re: C++ error [message #363052 is a reply to message #363050] Sat, 13 December 2008 15:14 Go to previous messageGo to next message
saberhawk
Messages: 1068
Registered: January 2006
Location: ::1
Karma: 0
General (1 Star)
You can't. SK's code which you blindly copied and modified works only on the client as a RenderObject using alot of code that SSGM simply doesn't have access to. Due to the client side nature of the code, even if SSGM did have access to that code, it wouldn't be able to actually *do* anything because the server is not your client.
Re: C++ error [message #363110 is a reply to message #363050] Sun, 14 December 2008 05:09 Go to previous message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
YazooGang wrote on Sat, 13 December 2008 17:05

so then how would i make a command that gives me money and points each time i fire a bullet?



You can check the ammo count in a persons weapon clip, if you attached a timer script to the person that checked there ammo count for the weapon they're holding it could work. You'd have to constantly check the ammo count and if it is less then the previous time you checked, you can assume they're firing a weapon and grant them points and money.
To make it a chat hook command, you could simply attach this script to the player only when they type that command.

There are flaws in this idea though. You could pick up crates that remove the weapons or ammo. You would also have to make sure it is counting the ammo of the current weapon, and account for them switching weapons too.
It'd be a little work, and a totally crappy way of doing it, but it'd probably work.



Previous Topic: problem with hud.ini
Next Topic: Nod Turret Skins
Goto Forum:
  


Current Time: Thu Dec 19 09:36:16 MST 2024

Total time taken to generate the page: 0.01520 seconds