API_DOCS: Flag controll functions

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

API_DOCS: Flag controll functions

Post by JeffM »

I know I'm horrible about keeping updated docs on API functions, so I figure I'd try to keep them here, so at least we have a somewhat "live" set of docs that people can use. Maybe every so often someone who is better at the English then I can go and update the real docs from this info.

So here we go.

I've added some new API functions for more info and control over the flags in a game to both 2.1 and 2.0.x.

All flags are addressed by a flagID. This id is a number from 0 to the total number of flags in the game.

Code: Select all

BZF_API unsigned int bz_getNumFlags( void );
Returns the total number of flags in the game.

Code: Select all

BZF_API const bz_ApiString bz_getName( int flag );
Returns the flag abbreviation code for the specified flag.

Code: Select all

BZF_API bool bz_resetFlag ( int flag );
Reset ("zaps") the specified flag, if the flag is on a player, the player looses the flag.

Code: Select all

BZF_API int bz_flagPlayer ( int flag );
Returns the player ID of the player who has the specified flag. If the flag is on the uncarried then the ID will be -1;

Code: Select all

BZF_API bool bz_getFlagPosition ( int flag, float* pos );
Copys the the current position of the specified flag into pos ( float pos[3]). If the flag is carried, the last known position of the player is used.

2.0.x.

Code: Select all

BZF_API bool bz_moveFlag( int flag, float pos[3] );
Reset ("zaps") the specified flag, but also sets it's spawn point, if the flag is on a player, the player looses the flag, and the flag is STILL moved to the specified point.

2.1.x.

Code: Select all

BZF_API bool bz_moveFlag( int flag, float pos[3], bool reset = true );
Moves the specified flag. If the flag is carried, it is drooped. If reset is true, the flag is also "zapped" to the new location.

The 2.0.x API version uses bzApiString instead of bz_ApiString.

These changes are in CVS right now. Please let me know if you have any questions or problems.
Last edited by JeffM on Tue Aug 14, 2007 3:52 am, edited 3 times in total.
ImageJeffM
meeba
Master Sergeant
Master Sergeant
Posts: 507
Joined: Sun Mar 12, 2006 10:49 pm
Location: N. Sanity Beach

Post by meeba »

Thank you for this, Jeff! Most useful indeed. :D
User avatar
LouMan
Chief Sgt. of Cartography
Chief Sgt. of Cartography
Posts: 338
Joined: Mon Jan 31, 2005 3:05 am
Location: Michigan, USA

Post by LouMan »

Yes, absolutely. Already used them ;)

Thanks so much!
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

if you need anymore just let me know
ImageJeffM
Theme97
Private First Class
Private First Class
Posts: 221
Joined: Fri Nov 11, 2005 8:04 pm
Contact:

Post by Theme97 »

How about a bz_setFlagPosition()?
Last edited by Theme97 on Fri Feb 02, 2007 12:56 am, edited 1 time in total.
Image
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

I've been looking into that, it's a little more complex.
ImageJeffM
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

added, BZF_API bool bz_moveFlag ( int flag, float pos[3] ) to the descriptions. It is in both 2.0.x and 2.1 cvs as of now.

*note*
for 2.0.x, moving a flag, forces it to be reset, and it will appear to be "zapped", but it'll spawn where you want it to. In 2.1.x you can just move it.
ImageJeffM
Enigma
Private First Class
Private First Class
Posts: 212
Joined: Sat Apr 23, 2005 3:13 am

Post by Enigma »

Can there be a standard way to deal with flag names? bz_BasePlayerRecord has currentFlag, which is a string that is similar to "Red team flag" or "Low Gravity (+LG)," while bz_getName returns "R*" for the red flag and "LG" for the low gravity flag.
Post Reply