AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   convert user index to userid (https://forums.alliedmods.net/showthread.php?t=194990)

Swear 09-02-2012 10:44

convert user index to userid
 
i have got players index it's 1-32. but userid is different. so i need to do something with player after typing amx_action 1 in servers console.

i tried this so far:

PHP Code:

public amxaction(id) {
    
    new 
target[128];
    
read_args(target127);
    
    new 
players[32], inum;
    
get_players(playersinum);
    new 
player players[target]; 

but it doesn't seem to work. it throws error 033: array must be indexed (variable "target")

it's because i need to manipulate with players from rcon. my php script got playerx index number and i need to activate command on him. i could use amx_action playerx but i think it could be buggy if others have similar nickname.

Swear 09-02-2012 11:13

Re: convert user index to userid
 
new index = str_to_num(target)-1;

i fixed it thanks for your support

ConnorMcLeod 09-02-2012 11:19

Re: convert user index to userid
 
This won't work.

Anyway, cmd_target supports name / userid / steamid

And to convert index to userid, use : userid = get_user_userid( index )


All times are GMT -4. The time now is 08:19.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.