Raised This Month: $ Target: $400
 0% 

Multiple get_user_name's under low performance make problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bug
Senior Member
Join Date: Nov 2007
Old 09-13-2009 , 11:19   Multiple get_user_name's under low performance make problems
Reply With Quote #1

Since it looks for me this is a strange behavior from Amxx, I post this problem here. I have a menu, an array of index IDs, and a for-loop where each of that get's translated to a player name and added to the menu. Here's the snippet:
Code:
    for(new i=0;i<iNum;i++) {
        new player=iPlayers[i];
        get_user_name(player, playername, 31);
        num_to_str(player, playerid, 2);
        menu_additem(menu, playername, playerid);
    }
(Note: The index IDs are correct, and get added correct as third parameter to the menu)

Now, this is the menu I get on my local testserver and when there are less player on the other server:
1: Player1
2: Player2
3: Player3
4: Player4

And this is the menu I get at day, when there are much players on the servers (there are 6 servers at one machine, so performance is often really bad):
1: Player1
2:
3:
4:

Note again, the index ID's are still correct, after choosing 3 in such a case, the script processes correct. Only the multiple playername lookup in this for-loop fails. In later functions, I make lookups again, but only two times in a row - no problems.

I don't really get Amxx there, why isn't the script halted until the playername lookup is really finished? Do I have to make a 0.1 second sleep after the get_user_name's?
bug is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-13-2009 , 20:41   Re: Multiple get_user_name's under low performance make problems
Reply With Quote #2

This really belongs in Scripting Help. You need to debug your code. Add something like the following to your for loop as the last thing:

PHP Code:
server_print(">>%s<<||>>%s<<"playernameplayerid
And see if the data actually retrieved is correct.
__________________
fysiks is online now
justincase
Senior Member
Join Date: Dec 2008
Old 11-05-2009 , 20:49   Re: Multiple get_user_name's under low performance make problems
Reply With Quote #3

I know this topic is over one month old, but since this problem isn't solved yet, I would appreciate further comments.

Concerning the posting above, this is the output:
Code:
Name: >>lelle LOOK IM A GIRLLLLLL not<< ID: >>8<<
Name: >><< ID: >>13<<
Name: >><< ID: >>20<<
Name: >><< ID: >>23<<
Name: >><< ID: >>27<<
justincase is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-05-2009 , 22:42   Re: Multiple get_user_name's under low performance make problems
Reply With Quote #4

Show the whole code. This should really be in Scripting Help.
__________________
fysiks is online now
justincase
Senior Member
Join Date: Dec 2008
Old 11-06-2009 , 10:35   Re: Multiple get_user_name's under low performance make problems
Reply With Quote #5

Hello,
I orientated myself on the tutorial about the new amxx menu system, so the structure should be pretty much the same. This is the whole code of the submenu:
Code:
SubMenu(id)
 {    
    new iPlayers[32], iNum, playername[32], playerid[2], player;
    get_players(iPlayers, iNum, "ae", "CT");
    
    if (iNum == 0) {
        client_print(id, print_chat, "[LR] No alive CTs present.");
        return PLUGIN_HANDLED;
    }
    
    new menu = menu_create("\rChoose your opponent:", "submenu_handler");
    
    for(new i=0;i<iNum;i++) {
        player=iPlayers[i];
        get_user_name(player, playername, 31);
        num_to_str(player, playerid, 2);
        menu_additem(menu, playername, playerid);
        server_print("Name: >>%s<< ID: >>%s<<", playername, playerid); 
    } 
    
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
    return PLUGIN_CONTINUE;
 }
The iPlayers-Array contains the correct index IDs, as you can also see on my last post.

I still think this isn't a scripting problem, why else does just the multiple get_user_name() fails, dependent on the server load?
justincase is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-06-2009 , 18:03   Re: Multiple get_user_name's under low performance make problems
Reply With Quote #6

Maybe you have an outdated version.

To get this information send "version" and "amxx version" to the server console and post both of the results here.
__________________
fysiks is online now
justincase
Senior Member
Join Date: Dec 2008
Old 11-07-2009 , 14:29   Re: Multiple get_user_name's under low performance make problems
Reply With Quote #7

Version should be the newest.
Code:
] amxx version
AMX Mod X 1.8.1.3746
Authors: 
         David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko, Felix "SniperBeamer" Geyer
         Jonny "Got His Gun" Bergstrom, Lukasz "SidLuke" Wlasinski
         Christian "Basic-Master" Hammacher, Borja "faluco" Ferrer
         Scott "Damaged Soul" Ehlert
Compiled: Aug 16 2008, 19:58:51
URL:http://www.amxmodx.org/
Core mode: JIT
I'm stumped for the solution on this :/.
justincase is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-07-2009 , 14:44   Re: Multiple get_user_name's under low performance make problems
Reply With Quote #8

You forgot "version".
__________________
fysiks is online now
justincase
Senior Member
Join Date: Dec 2008
Old 11-07-2009 , 18:42   Re: Multiple get_user_name's under low performance make problems
Reply With Quote #9

Code:
] version
Protocol version 48
Exe version 1.1.2.6/2.0.761.254 (cstrike)
Exe build: 16:05:41 Jun 15 2009 (4554)
justincase is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-07-2009 , 21:47   Re: Multiple get_user_name's under low performance make problems
Reply With Quote #10

I don't see anything wrong so I can't really help.
__________________
fysiks is online now
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 23:36.


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