Autoselect race (need help for coding)

Read log files for errors! If this fails, come here for help

Moderator: Forum Moderator

Post Reply
DesasterUK
WC3Mods Donor
WC3Mods Donor
Posts: 223
Joined: Thu Mar 09, 2006 6:05 pm
Location: Germany
Contact:

Autoselect race (need help for coding)

Post by DesasterUK » Wed Jun 06, 2007 2:41 am

Hi there.

First i will try to explain what i need and what i've done.

I wanted the Chameleon-race only for Admins/Users with a special admin flag.

I implemented a function to get a new flag only for enabling the race.
So far there are no problems.

Build in some code, that non-admin-users can't choose the cham directly in the changeracemenu and it works.

Now my problem.
If a non-admin-users choose random select in the changeracemenu they can access the cham-race.

Therefor i build in some more code.
[small]
if ( key == iAutoSelectKey )
{
if ( get_pcvar_num( CVAR_wc3_races ) == 9 && id && !( get_user_flags( id ) & XP_GetRaceFlag() ) )
{
iRace = random_num( 1, 8 );
}
else
{
iRace = random_num( 1, get_pcvar_num( CVAR_wc3_races ) );
}
}
[/small]

The "if"-function is nearly the same i used when someone trys to directly choose the race.

Now if i connect as admin to my server i can use the random choose.
But if i connect as non-admin and press the key (0) for randmon choose nothing happens.
I thought there was a problem within the "if"-function so i removed the ! in front of the user-flag-check.
But its still the same.
Admin can use random choose.
Non-admins can't.

Maybe someone has a clue what i've done wrong.

Kind regards
DUK

edit ---
The base-version i'm using is the CVS a few days before RC7B2
--- edit end
Image

Post Reply