Raised This Month: $51 Target: $400
 12% 

New AMXX Menu System


Post New Thread Reply   
 
Thread Tools Display Modes
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 12-25-2010 , 15:14   Re: New AMXX Menu System
Reply With Quote #311

Please make your own topics if you are asking for help on menus in the Scripting Help section.

Posts that were here have been moved: Countdown in menu
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Antixianos
BANNED
Join Date: Oct 2010
Old 12-30-2010 , 02:19   Re: New AMXX Menu System
Reply With Quote #312

Hi, I'm new to scripting and I have some quick (or not so quick) questions about the example menus.. I hope I don't annoy anyone.

Code:
    //We will need to create some variables so we can loop through all the players
    new players[32], pnum, tempid;
 
    //Some variables to hold information about the players
    new szName[32], szTempid[10];
 
    //Fill players with available players
    get_players(players, pnum);
 
    //Start looping through all players
    for( new i; i<pnum; i++ )
    {
        //Save a tempid so we do not re-index
        tempid = players[i];
 
        //Get the players name and id as strings
        get_user_name(tempid, szName, 31);
        num_to_str(tempid, szTempid, 9);
 
        //Add the item for this player
        menu_additem(menu, szName, szTempid, 0);
1. What info do players, pnum, tempid, szName, and szTempid exactly hold?
2. I'm confused on what the difference is between players and pnum.
3. Why is szTempid array set to 10 of all numbers?
4. What does sz stand for? (I know g is for global, i is for integer AFAIK)

Code:
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
 
    //Get the id of the player that was selected
    new tempid = str_to_num(data);
 
    //If the player is alive
    if( is_user_alive(tempid) )
        //Set their health to 100
        set_user_health(tempid, 100);
Same questions here.
1. What info do data, iName, access, and callback hold?
2. What does callback exactly do?
3. Why are data and iName set to 6 and 64?
Antixianos is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-30-2010 , 03:29   Re: New AMXX Menu System
Reply With Quote #313

Quote:
Originally Posted by Antixianos View Post
Hi, I'm new to scripting and I have some quick (or not so quick) questions about the example menus.. I hope I don't annoy anyone.

Code:
    //We will need to create some variables so we can loop through all the players
    new players[32], pnum, tempid;
 
    //Some variables to hold information about the players
    new szName[32], szTempid[10];
 
    //Fill players with available players
    get_players(players, pnum);
 
    //Start looping through all players
    for( new i; i<pnum; i++ )
    {
        //Save a tempid so we do not re-index
        tempid = players[i];
 
        //Get the players name and id as strings
        get_user_name(tempid, szName, 31);
        num_to_str(tempid, szTempid, 9);
 
        //Add the item for this player
        menu_additem(menu, szName, szTempid, 0);
1. What info do players, pnum, tempid, szName, and szTempid exactly hold?
2. I'm confused on what the difference is between players and pnum.
3. Why is szTempid array set to 10 of all numbers?
4. What does sz stand for? (I know g is for global, i is for integer AFAIK)

Code:
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
 
    //Get the id of the player that was selected
    new tempid = str_to_num(data);
 
    //If the player is alive
    if( is_user_alive(tempid) )
        //Set their health to 100
        set_user_health(tempid, 100);
Same questions here.
1. What info do data, iName, access, and callback hold?
2. What does callback exactly do?
3. Why are data and iName set to 6 and 64?
1. players = array of player ids that are in the server
- pnum = total number of players in the array
- tempid = the player id selected from the array
- szName = string containing the selected player's name
- szTempid = string form of the tempid

2. See #1

3. It should be 3 because the max player id is 32 which is 2 digits + 0 terminator.

4. s = string, z = zero terminating

--

1. data = the tempid in string form
- iName = the name of the menu item that you chosen
- access = the required admin flags to use that item
- callback = the callback function pointer used in menu_additem()

2. Read up on how callbacks work.

3. data should be set to 3 like in #3 above, and iName is set to 64 to be able to hold all of the menu item string

--

I advise you to learn more about scripting and learn to use the funcwiki and how to search before asking more questions.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-30-2010 , 04:40   Re: New AMXX Menu System
Reply With Quote #314

Also for those players menu, would be better to store userid or steamid as info because player id can be a new player when the callback is executed.
In callback, use find_player with appropriated flag to retrieve player id.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-30-2010 , 22:58   Re: New AMXX Menu System
Reply With Quote #315

Quote:
Originally Posted by ConnorMcLeod View Post
Also for those players menu, would be better to store userid or steamid as info because player id can be a new player when the callback is executed.
In callback, use find_player with appropriated flag to retrieve player id.
I prefer userid just because you don't have to deal with strings except for the menu info.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-31-2010 , 06:28   Re: New AMXX Menu System
Reply With Quote #316

But both steamid and iteminfo are strings.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-31-2010 , 15:25   Re: New AMXX Menu System
Reply With Quote #317

You're right, but SteamIDs are not always unique among players in a server such as LAN.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-01-2011 , 10:37   Re: New AMXX Menu System
Reply With Quote #318

IPs should do the job then, but lot of plugins are steamid only .
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bananaCheater
Junior Member
Join Date: Jan 2011
Old 01-07-2011 , 18:28   Re: New AMXX Menu System
Reply With Quote #319

i didnīt get anything itīs too hard for me (-.-)
noob(me)
__________________

WTF.LorD
bananaCheater is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 01-08-2011 , 08:34   Re: New AMXX Menu System
Reply With Quote #320

Try learning more basic things first then.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
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 22:15.


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