Официалният форум на iPlay.bg 

Този раздел е създаден специално за проблеми и въпроси за направата на плъгини или преработката на вече съществуващи кодове.
 #384788  от southdivision
 пон мар 21, 2016 2:12 am
Имам следния проблем:

Въпросния код предназначен за JB който прави TT да не могат да говорят искам да го направя по следния начин:
Кода:
Код: Избери всички
public plugin_init()
{
	gp_TalkMode = register_cvar("jbe_talkmode", "2")	// 0-alltak / 1-tt talk / 2-tt no talk
	}
	
public hud_status(task)
{
gc_TalkMode = get_pcvar_num(gp_TalkMode)
}
	


От този кoд: да се определя дали има право да използва Speach достъпа ,а не от горния който съм дал
Default: Да не могат да говорят ТТ,но админите TT с Kick права да могат
Код: Избери всички
/* ---------------------------------------------------
* ------------- GIVE ACCESS TO SPEACH --------------*/

public FwdSetVoice(receiver, sender, bool:listen)
{
        if(!(1 <= receiver <= g_max_clients) || !g_connected[receiver] || !(1 <= sender <= g_max_clients) || !g_connected[sender])
                return
        if((get_user_flags(sender) & ADMIN_MENU || get_bit(g_PlayerVoice, sender))
        || (cs_get_user_team(sender) == CS_TEAM_CT && is_user_alive(sender) && !mutect))
                set_speak(sender, 2)
        else    set_speak(sender, 1)
}

public AccessSpeachMenu(id)
{
        if(get_user_flags(id) & ADMIN_CVAR) {
                new speachmenu = menu_create("\r[\wAMXX\r]\y Glasovi prava", "ActionAccessSpeachMenu")
                new callback = menu_makecallback("MenuCallbackSpeach")
               
                menu_additem(speachmenu, "\yDai Glasovi Prava", "1")
                menu_additem(speachmenu, "\yPremahni Glasovi Prava^n", "2")
                menu_additem(speachmenu, "\rDai Glasovi Prava na vsichki Nadzirateli", "3",_, callback)
                menu_additem(speachmenu, "\rPremahni Glasovi Prava na vsichki Nadzirateli", "4")
               
                menu_display(id, speachmenu)
        } else
				 
}
 
public MenuCallbackSpeach()
        return mutect ? ITEM_ENABLED : ITEM_DISABLED
public ActionAccessSpeachMenu(id, speachmenu, item)
{
        if(item == MENU_EXIT) {
                menu_destroy(speachmenu)
                return
        }
        new Data[7], Name[64], Access, Callback
        menu_item_getinfo(speachmenu, item, Access, Data,5, Name, 63, Callback)
       
        new Key = str_to_num(Data)
        switch(Key)
        {
                case 1:
                {
                        new speach_give = menu_create("\r[\wAMXX\r]\y Mikrofon Dostup:", "ActionGiveSpeach")
       
                        new players[32], pnum, tempid, szName[32], szTempid[10]
                        get_players(players, pnum)
                       
                        for(new i; i<pnum; i++)
                        {
                                tempid = players[i]
                               
                                if(!is_user_connected(tempid) || get_user_flags(tempid) & ADMIN_MENU || get_bit(g_PlayerVoice, tempid))
                                        continue
                               
                                get_user_name(tempid, szName, 31)
                                num_to_str(tempid, szTempid, 9)
                                menu_additem(speach_give, szName, szTempid)
                        }
                        menu_display(id, speach_give)
                }
                case 2:
                {
                        new speach_remove = menu_create("\r[\wAMXX\r]\y Premahni Dostupa do Mikrofona", "ActionRemoveSpeach")
       
                        new players[32], pnum, tempid, szName[32], szTempid[10]
                        get_players(players, pnum)
                        for(new i; i<pnum; i++)
                        {
                                tempid = players[i]
                               
                                if(!is_user_connected(tempid) || get_user_flags(tempid) & ADMIN_MENU || !(get_bit(g_PlayerVoice, tempid)))
                                        continue
                               
                                get_user_name(tempid, szName, 31)
                                num_to_str(tempid, szTempid, 9)
                                menu_additem(speach_remove, szName, szTempid)
                        }
                        menu_display(id, speach_remove)
                }
                case 3:
                {
                        new name[33]
                        get_user_name(id, name, 32)
                        mutect = false
                   
                }
                case 4:
                {
                        new name[33]
                        get_user_name(id, name, 32)
                        mutect = true
						
                }
        }
        menu_destroy(speachmenu)
}
 
public ActionGiveSpeach(id, speach_give, item)
{
        if(item == MENU_EXIT) {
                AccessSpeachMenu(id)
                return
        }
        new data[6], iName[64]
        new _access, callback
        menu_item_getinfo(speach_give, item, _access, data,5, iName, 63, callback)
       
        new tempid = str_to_num(data)
        new szName[32], szName2[32]
        get_user_name(id, szName, 31)
        get_user_name(tempid, szName2, 31)
        set_bit(g_PlayerVoice, tempid)
	
        menu_destroy(speach_give)
}
 
public ActionRemoveSpeach(id, speach_remove, item)
{
        if(item == MENU_EXIT) {
                AccessSpeachMenu(id)
                return
        }
        new data[6], iName[64]
        new _access, callback
        menu_item_getinfo(speach_remove, item, _access, data,5, iName, 63, callback)
       
        new tempid = str_to_num(data)
        new szName[32], szName2[32]
        get_user_name(id, szName, 31)
        get_user_name(tempid, szName2, 31)
        clear_bit(g_PlayerVoice, tempid)
		
        menu_destroy(speach_remove)
}