Raised This Month: $ Target: $400
 0% 

[Solved]Get the player Index in a players menu...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 08-16-2010 , 02:59   [Solved]Get the player Index in a players menu...
Reply With Quote #1

Example..
PHP Code:
new bool:ThaBoolean[33][33
In menu
PHP Code:
ThaBoolean[id][iName/* Choosed name */] = true 
but if I use that method AMXX Shows
Code:
Error: Array must be indexed (variable "iName")
How I can get the index of iName?
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-16-2010 , 04:22   Re: Get the player Index in a players menu...
Reply With Quote #2

One question.
Do you know how to use arrays?
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 08-16-2010 , 04:37   Re: Get the player Index in a players menu...
Reply With Quote #3

Yes I know...
PHP Code:
ThisIs[Players][Len
But,I find the same way in others plugins...(Example:mutemenu)..
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-16-2010 , 05:16   Re: Get the player Index in a players menu...
Reply With Quote #4

iName[Whatever]
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 08-16-2010 , 05:18   Re: Get the player Index in a players menu...
Reply With Quote #5

Quote:
Originally Posted by ot_207 View Post
iName[Whatever]
Is not important,example if I put iName[a] works ?
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-16-2010 , 10:20   Re: Get the player Index in a players menu...
Reply With Quote #6

What are you trying to do? Your code has no logic at the moment. As far as getting a player's entity index from their name you can use cmd_target().

BUT, ultimately you should rethink everything that you are doing regarding this. Tell us what you are actually trying to do.
__________________
fysiks is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 08-16-2010 , 17:51   Re: Get the player Index in a players menu...
Reply With Quote #7

Check this code..(I Made Something Like Mute Menu)

PHP Code:
new bool:vMuted[33][33]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /mute","MuteMenu")
    
    
register_forward(FM_Voice_SetClientListening,"ForwardVoiceSetClientListening")
}

public 
ForwardVoiceSetClientListening(receiver,sender)
{
    if(
receiver == sender)
        return 
FMRES_IGNORED

    
if(vMuted[receiver][sender])
    {
        
engfunc(EngFunc_SetClientListening,receiver,sender,0)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED
}
public 
MuteMenu(id)
{
    new 
menu menu_create("\r[AMXX]\y Mute Menu :","MenuHandler")
    
    static 
name[32]
    static 
item[32]
    
    static 
temp[256]
    
    for(new 
1;<= get_maxplayers();i++)
    {
        if(
== id || !is_user_connected(i)) continue;
        
        
get_user_name(i,name,31)
        
num_to_str(i,item,31)
        
        
format(temp,255,"%s \d%s",name,vMuted[id][i] ? "(Muted)" "")
        
menu_additem(menu,temp,item)
    }
    
    
menu_display(id,menu)
    return 
PLUGIN_HANDLED
}
public 
MenuHandler(id,menu,item)
{
    if(
item == MENU_EXIT)
        
menu_destroy(menu)
        
    new 
iData[6]
    new 
iName[64]
    new 
Access
    
new Callback
    menu_item_getinfo
(menu,item,Access,iData,5,iName,63,Callback)
    
    new 
Choosed str_to_num(iData)
    
    if(
Choosed)
        
vMuted[id][/*???*/] = true
    
    menu_display
(id,menu)
    return 
PLUGIN_HANDLED

#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-17-2010 , 01:01   Re: Get the player Index in a players menu...
Reply With Quote #8

Look in the "New Menus Tutorial" for the players menu example.
__________________
fysiks is offline
minato
Senior Member
Join Date: May 2010
Location: Rosario
Old 08-17-2010 , 01:12   Re: Get the player Index in a players menu...
Reply With Quote #9

Your you want that when a user selects
Does this user remain mute?
It proves this:
PHP Code:
public MenuHandler(id,menu,item)
{
    if(
item == MENU_EXIT)
        
menu_destroy(menu)
        
    new 
iData[6]
    new 
iName[64]
    new 
Access
    
new Callback
    menu_item_getinfo
(menu,item,Access,iData,5,iName,63,Callback)
    
    new 
Choosed cmd_target(id,iData,CMDTARGET_OBEY_IMMUNITY)
    
    
vMuted[id][Choosed] = true
    
    menu_display
(id,menu)
    return 
PLUGIN_HANDLED

__________________
minato is offline
Send a message via MSN to minato
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 08-17-2010 , 01:32   Re: Get the player Index in a players menu...
Reply With Quote #10

(Sorry I don't understand at all english) So...obey immunity means when an admin have immunity the player can't mute him?
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
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 21:53.


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