Raised This Month: $ Target: $400
 0% 

convert user index to userid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Swear
Junior Member
Join Date: May 2009
Location: Latvia
Old 09-02-2012 , 10:44   convert user index to userid
Reply With Quote #1

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 is offline
Send a message via Skype™ to Swear
Swear
Junior Member
Join Date: May 2009
Location: Latvia
Old 09-02-2012 , 11:13   Re: convert user index to userid
Reply With Quote #2

new index = str_to_num(target)-1;

i fixed it thanks for your support
Swear is offline
Send a message via Skype™ to Swear
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-02-2012 , 11:19   Re: convert user index to userid
Reply With Quote #3

This won't work.

Anyway, cmd_target supports name / userid / steamid

And to convert index to userid, use : userid = get_user_userid( index )
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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