AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved]Get the player Index in a players menu... (https://forums.alliedmods.net/showthread.php?t=135424)

#8 SickneSS 08-16-2010 02:59

[Solved]Get the player Index in a players menu...
 
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?

ot_207 08-16-2010 04:22

Re: Get the player Index in a players menu...
 
One question.
Do you know how to use arrays?

#8 SickneSS 08-16-2010 04:37

Re: Get the player Index in a players menu...
 
Yes I know...
PHP Code:

ThisIs[Players][Len

But,I find the same way in others plugins...(Example:mutemenu)..

ot_207 08-16-2010 05:16

Re: Get the player Index in a players menu...
 
iName[Whatever]

#8 SickneSS 08-16-2010 05:18

Re: Get the player Index in a players menu...
 
Quote:

Originally Posted by ot_207 (Post 1272373)
iName[Whatever]

Is not important,example if I put iName[a] works ?

fysiks 08-16-2010 10:20

Re: Get the player Index in a players menu...
 
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.

#8 SickneSS 08-16-2010 17:51

Re: Get the player Index in a players menu...
 
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



fysiks 08-17-2010 01:01

Re: Get the player Index in a players menu...
 
Look in the "New Menus Tutorial" for the players menu example.

minato 08-17-2010 01:12

Re: Get the player Index in a players menu...
 
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



#8 SickneSS 08-17-2010 01:32

Re: Get the player Index in a players menu...
 
(Sorry I don't understand at all english) So...obey immunity means when an admin have immunity the player can't mute him?


All times are GMT -4. The time now is 21:53.

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