PDA

View Full Version : COD4 self setPower() problem



genez_x
29th July 2017, 02:27
Hi, I am having a problem setting power to a player for command usage, the problem is that only works for me every time.
for example: I set the power for admins to(3), when they connect to the server they have the power set to (3) and cant use some commands that people with that power should can. (Its not my case because it works for me).
Here are some pictures of me with all the power cases.
power
1353
on connect
1354
when is admin and its me power(100)
1355
when is admin
1356


ps:Dont know why it doesnt work for other people.
ps2:They appear to have the power to use some commands but they cant because lack of power¿)

IzNoGoD
29th July 2017, 10:36
I dont see any evidence of "not being able to use certain commands". Looks like admin with level 3 can use all the up-to level 3 commands to me.

genez_x
29th July 2017, 16:40
with that image i am showing that it works well at least for me, but if i give admin to another players they cant use them even with power (3).
ill keep trying.

genez_x
29th July 2017, 22:20
is so weird that only works for me, example: i have the same rank as this player and same power but he cant use the commands.
1357
ps:i also tried changing the others players power on live server with a command but i cant, but guess what i can change my power...
what can i try? thank you

kung foo man
30th July 2017, 03:59
You can try to post all the relevant source code or debug it yourself (adding lovely print's)

kung foo man
30th July 2017, 15:02
Searched some relevant stuff together:

void PlayerCmd_SetPower(scr_entref_t arg)

https://github.com/callofduty4x/CoD4x_Server/blob/87fce9ee32247921c3a41fa603202fc5a9a8c24c/src/scr_vm_functions.c#L344

qboolean Cmd_AddCommandGeneric( const char *cmd_name, const char* helptext, xcommand_t function, qboolean warn, int power )

https://github.com/callofduty4x/CoD4x_Server/blob/9c8507f16bf17d8bc31cf0d385334bdfa24ed33b/src/cmd.c#L337

int Cmd_GetInvokerPower();

Seems to be statically compiled into the binary, so not available to debug... reason enough to debug the returned value for your different players

static void Cmd_List_f( void )

https://github.com/callofduty4x/CoD4x_Server/blob/9c8507f16bf17d8bc31cf0d385334bdfa24ed33b/src/cmd.c#L1149

Here is something interesting: Cmd_GetInvokerPower() < cmd->minPower, meaning ppl with power 3 can only use commands with minPower from 1 to 2, while I would expect it to be "including", so from 1 to 3.

Well, this is already way too much C aids. This kind of right management stuff should be done in a scripting language, for easy/fast explorative programming. I never worked with CoD4x, but probably there is a way to catch the player commands ingame and just handle the right management yourself? That will allow you to be much more fine grained aswell (e.g. use MySQL for user groups etc.). C should be used where it has to be used (and nowhere else).

Also the script reference (https://github.com/callofduty4x/CoD4x_Server/blob/master/scriptdocumentation/script_functions_reference.md) even states:


Not recommended to use. The overall behaviour is not known. Don't set non admins above level 9

genez_x
1st August 2017, 21:23
thanks for taking time answering this this kung foo, i just turned them to power(1).
So weird that before this change some people could use it and some not, thats unfortunate.

genez_x
8th January 2018, 18:24
the problem here was, (you must use steam while playing cod4) <- i didnt know that at that moment :D