AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   vote menu for min Frags (https://forums.alliedmods.net/showthread.php?t=141013)

sb123 10-18-2010 15:01

vote menu for min Frags
 
only kill 10 Frags player can open the votemenu

somebody can help me?

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define MENU_SIZE    256
#define MENU_PLAYERS 7

new g_iMenuPosition
new g_iMenuPlayers[32]
new 
g_iMenuOption[32]
new 
g_iMenuSettings[32]


public 
plugin_init()
{
    
register_plugin("Vote Kick/Ban Menu","1.3","WaZZeR")

    
register_menucmd(register_menuid("\rVote Menu:"),1023,"actionVoteMenu")

    
register_clcmd("amx_votemenu","cmdVoteMenu",ADMIN_VOTE,"- displays vote menu")
}


/* Vote Menu */
public cmdVoteMenuidlvlcid )
{
    if( 
cmd_accessidlvlcid) )
    {
        
g_iMenuOption[id] = 0
        g_iMenuSettings
[id] = 0

        showVoteMenu
idg_iMenuPosition )
    }
    return 
PLUGIN_HANDLED
}

public 
showVoteMenuidpos )
{
    if( 
pos ) return

    new 
ij
    
new szMenuBody[MENU_SIZE]
    new 
iCurrKey 0
    
new szUserName[32]
    new 
iStart pos MENU_PLAYERS
    
new iNum

    get_players
g_iMenuPlayersiNum )

    if( 
iStart >= iNum )
        
iStart pos g_iMenuPosition 0

    
new iLen formatszMenuBodyMENU_SIZE-1"\rVote Menu:\R%d/%d^n\w^n"pos+1, (iNum MENU_PLAYERS + ((iNum MENU_PLAYERS) ? )) )
    new 
iEnd iStart MENU_PLAYERS
    
new iKeys = (1<<9|1<<7)

    if( 
iEnd iNum )
        
iEnd iNum

    
for( iStartiEndi++ )
    {
        
g_iMenuPlayers[i]
        
get_user_namejszUserName31 )
        
        
//Check if the player has immunity
        
if( (get_user_flags(j) & ADMIN_IMMUNITY) )
        {
            
iCurrKey++
            
iLen += formatszMenuBody[iLen], (MENU_SIZE-1-iLen), "\d%d. %s^n\w"iCurrKeyszUserName )
        }else
        {
            
iKeys |= (1<<iCurrKey++)
            
iLen += formatszMenuBody[iLen], (MENU_SIZE-1-iLen), "%d. %s^n"iCurrKeyszUserName )
        }
    }
    
//Check if it is kick or ban
    
if ( g_iMenuSettings[id] )
        
iLen += formatszMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. Vote Ban^n" )
    else
        
iLen += formatszMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. Vote Kick^n" )

    
//Cheack if there is more players left
    
if( iEnd != iNum )
    {
        
formatszMenuBody[iLen], (MENU_SIZE-1-iLen), "^n9. More...^n0. %s"pos "Back" "Exit" )
        
iKeys |= (1<<8)
    }
    else
        
formatszMenuBody[iLen], (MENU_SIZE-1-iLen), "^n0. %s"pos "Back" "Exit" )

    
show_menuidiKeysszMenuBody, -)

    return
}

public 
actionVoteMenuidkey )
{
    switch( 
key )
    {
        case 
7: {   //The switch key
            
++g_iMenuOption[id]
            
g_iMenuOption[id] %= 2

            
switch(g_iMenuOption[id]){
            case 
0g_iMenuSettings[id] = 0    //kick
            
case 1g_iMenuSettings[id] = 1    //ban
            
}     
            
showVoteMenuidg_iMenuPosition )
        }
        case 
8showVoteMenuid, ++g_iMenuPosition // More Option
        
case 9showVoteMenuid, --g_iMenuPosition // Back Option

        // Chose a Player
        
default:
        {
            new 
player g_iMenuPlayers[g_iMenuPosition MENU_PLAYERS key]

            
//Get user info

            
new authid[32]
            
get_user_authid(player,authid,31)

            new 
userid get_user_userid(player)

            
//Exec the command

            
if (equal("4294967295",authid)) { /* check if it is a lan */
                
new ipa[32]
                
get_user_ip(player,ipa,31,1)
                
server_cmd("addip 0.0 %s;writeip",ipa/* no need to vote on lan, or? */
            
}
            else {
                switch(
g_iMenuSettings[id]){
                    case 
0server_cmd("amx_votekick #%d",userid)
                    case 
1server_cmd("amx_voteban #%d kick;writeid",userid)
                }
            }            
            
server_exec()
        }
    }
    return 
PLUGIN_HANDLED



mottzi 10-18-2010 15:26

Re: vote menu for min Frags
 
uhm, we are here in scripting help, omg.

get_user_frags()
if()

sb123 10-19-2010 03:23

Re: vote menu for min Frags
 
can u give me full code

i use the plugins on zombie server

Vechta 10-19-2010 04:33

Re: vote menu for min Frags
 
Search little bit please and you can make yourself

mottzi 10-19-2010 10:14

Re: vote menu for min Frags
 
Quote:

Originally Posted by sb123 (Post 1329095)
can u give me full code

i use the plugins on zombie server

NAAAAAAAAA
SCRIPTING HELP; Not I SCRIPT FOU YOU

:|


All times are GMT -4. The time now is 10:18.

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