is g_cmds.c the right place for a weapon selecter command?
Posted: Sat May 01, 2010 11:59 pm
I'm coding a weapon selecting command that works like this: /BIND 1 "weapselect [weapon type] [(optional) weapon type]". The mod has various classes of guns. So, some acceptable values for "weapon type" are grenade, sidearm, primary. The command also allows you to switch back and forth between the two weapon types you entered each time you press the bind.
There are several sidearms, several pistols, and several grenades, but you can only have one of each at a time (which is why this weapon selector makes sense instead of using weapon 11, weapon 6, etc
I'm following bits and peices from this tut: http://www.quake3hut.co.uk/q3coding/mor ... %20Mod.htm
There under Adding A New Command they add a command to g_cmds.c Since it's on the game it has no access to the client, and their command needs to get access to iCurrentWeapon, so they added iCurrentWeapon to the Client Struct in g_local.h
Now I'm making my function in g_cmds.c and now I need to be able to check *what guns the player has* and *what gun the player is currently using* to do what I need the function to do. So is it sensible that I would add those things to the Client Struct too???
It just made me pause because I'm thinking, this is really only a client side action (isn't it?) so why should I be making the command on the server (g_cmds.c) [keeping in mind I'm somewhat of a noob about q3 mod coding]
So am I going in the right direction?? I can keep coding but it's not really going to tell me if I'm doing this improperly.
There are several sidearms, several pistols, and several grenades, but you can only have one of each at a time (which is why this weapon selector makes sense instead of using weapon 11, weapon 6, etc
I'm following bits and peices from this tut: http://www.quake3hut.co.uk/q3coding/mor ... %20Mod.htm
There under Adding A New Command they add a command to g_cmds.c Since it's on the game it has no access to the client, and their command needs to get access to iCurrentWeapon, so they added iCurrentWeapon to the Client Struct in g_local.h
Now I'm making my function in g_cmds.c and now I need to be able to check *what guns the player has* and *what gun the player is currently using* to do what I need the function to do. So is it sensible that I would add those things to the Client Struct too???
It just made me pause because I'm thinking, this is really only a client side action (isn't it?) so why should I be making the command on the server (g_cmds.c) [keeping in mind I'm somewhat of a noob about q3 mod coding]
So am I going in the right direction?? I can keep coding but it's not really going to tell me if I'm doing this improperly.