AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need Some Codes (https://forums.alliedmods.net/showthread.php?t=107225)

DoviuX 10-24-2009 10:24

Need Some Codes
 
what is the code for slay and code for select a player in menu ?

xPaw 10-24-2009 10:43

Re: Need Some Codes
 
user_kill

Hawk552 10-24-2009 12:30

Re: Need Some Codes
 
You need to write up a menu:

PHP Code:

#include <amxmodx>

new gMaxPlayers

public plugin_init()
    
gMaxPlayers get_maxplayers()

public 
plugin_cfg()
    
register_clcmd"selectplayer""CmdSelectPlayer" )

public 
CmdSelectPlayerid )
{
    new 
menu menu_create"Select a Player""MenuSelectPlayer" )
    
    for ( new 
1name[33], idStr[3]; <= gMaxPlayersi++ )
        if ( 
!= id && is_user_connected) )
        {
            
get_user_nameiname32 )
            
num_to_striidStr)
            
            
menu_additemmenunameidStr )
        }
        
    
menu_displayidmenu )
}

public 
MenuSelectPlayeridmenuitem )
{
    if ( 
item == MENU_EXIT )
        goto 
end
    
    
new idStr[3], garbage
    menu_item_getinfo
menuitemgarbageidStr2__garbage )
    
    new 
player str_to_numidStr )
    
// In case they left before you selected them.
    
if ( !is_user_connectedplayer ) )
        goto 
end
    
    
// player is now your selected player
    // add your code here
    
end:
    
menu_destroymenu )
    return 
PLUGIN_HANDLED



MaNuCs 10-24-2009 15:43

Re: Need Some Codes
 
hawk... ur code is good and i use...
but... i have 1 problem
1 select the player and the COMMAND(agree for me) is use in me and he no...

i need the command is use in me and he....
need to the menu open for the last terrorist... and in the menu players... show CTS PLAYERS LIVEs..

i give +karm

thx :D

this is my code...

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>

new Plugin[] = "Last Restquest Menu"
new Version[] =  "1.0"
new Author[] = "[M]aNuC[s]_"
new gMaxPlayers


public plugin_init()
{
    
register_clcmd"say /lr","MenuLR");
    
register_clcmd"say !lr","MenuLR");
    
gMaxPlayers get_maxplayers() 
}

public 
MenuLR(id

    if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T
        
{
    new 
Menu menu_create("\w Last Resquest:""mostrar_menu")
    
menu_additem(Menu"\w Khife Duel"        "1"0)
    
menu_additem(Menu"\w Shot For Shot"        "2"0
    
    
menu_setprop(Menu,MPROP_EXITNAME,"Salir"
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL
    
    
menu_display(idMenu0
}

}
public 
mostrar_menu(idMenuitem

if (
item == MENU_EXIT

    
menu_destroy(Menu
    return 
PLUGIN_HANDLED 


new 
iData[6]; 
new 
iAccess
new 
iCallback
new 
iName[64]; 
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback

switch (
str_to_num(iData)) 

    case 
1:
    {
        if( 
is_user_alive(id) )
        {
        
Cuchilloid )
        }
    }
    case 
2:
    {
        if( 
is_user_alive(id) )
        {
        
Pistola(id)
        }  
    }
}
}

public 
Cuchilloid )
{
    new 
menu menu_create"Select a Player""MenuSelectPlayer1" )
    
    for ( new 
1name[33], idStr[3]; <= gMaxPlayersi++ )
        if ( 
!= id && is_user_connected) )
        {
            
get_user_nameiname32 )
            
num_to_striidStr)
            
            
menu_additemmenunameidStr )
        }
        
    
menu_displayidmenu )


public 
MenuSelectPlayer1idmenuitem )
{
    if ( 
item == MENU_EXIT )
        goto 
end
    
    
new idStr[3], garbage
    menu_item_getinfo
menuitemgarbageidStr2__garbage )
    
    new 
player str_to_numidStr )
    if ( !
is_user_connectedplayer ) )
        goto 
end
    
        strip_user_weapons
(id)  
        
give_item(id"weapon_knife");
        
set_user_health(id100);
        
client_print(idprint_chat"Duel Khife Activado...")
end:
    
menu_destroymenu )
    return 
PLUGIN_HANDLED
}

public 
Pistolaid )
{
    new 
menu menu_create"Select a Player""MenuSelectPlayer2" )
    
    for ( new 
1name[33], idStr[3]; <= gMaxPlayersi++ )
        if ( 
!= id && is_user_connected) )
        {
            
get_user_nameiname32 )
            
num_to_striidStr)
            
            
menu_additemmenunameidStr )
        }
        
    
menu_displayidmenu )


public 
MenuSelectPlayer2idmenuitem )
{
    if ( 
item == MENU_EXIT )
        goto 
end
    
    
new idStr[3], garbage
    menu_item_getinfo
menuitemgarbageidStr2__garbage )
    
    new 
player str_to_numidStr )
    if ( !
is_user_connectedplayer ) )
        goto 
end
    
           strip_user_weapons 
(id)  
            
set_user_health(id100);
            
give_item(id,"weapon_deagle")
            
cs_set_user_bpammo(id,CSW_DEAGLE,200)
            
give_item(id"weapon_knife")
            
client_print(idprint_chat"Shot For Shot Activado...")
end:
    
menu_destroymenu )
    return 
PLUGIN_HANDLED



grimvh2 10-24-2009 16:59

Re: Need Some Codes
 
PHP Code:

// Last terrorist Check
new players[32], pnum;
get_players(playerspnum,"ae""TERRORIST");

if(
pnum == 1)
{
    
// 1 terrorist alive
}

// If you want it automaticly
register_event("DeathMsg",         "DeathMsg""a"); // add to plugins init

public DeathMsg()
{
    new 
Victim read_data(2)
    if(
get_user_team(Victim) == 1)
    {
        new 
players[32], pnum;
        
get_players(playerspnum,"ae""TERRORIST");

        if(
pnum == 1)
        {
            
// 1 terrorist alive
        
}
    }
}
    
// add only cts in your menu
new players[32], pnumplayerszplayer[10];
get_players(playerspnum);
    
name[32]
    
for( new 
ii<pnumi++ )
{
        
player players[i]
        
get_user_name(player,name,31)
        
num_to_str(playerszplayer9);
        
menu_additem(menunameszplayer0);
}

// to handle it
new data[6], iName[64];
new 
accesscallback;
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
new 
player str_to_num(data); 


MaNuCs 10-25-2009 13:36

Re: Need Some Codes
 
PHP Code:

 if(pnum == 1)
{
    
// 1 terrorist alive <------------- (What Code Its Here?!)
}

public 
DeathMsg()
{
    new 
Victim read_data(2)
    if(
get_user_team(Victim) == 1)
    {
        new 
players[32], pnum;
        
get_players(playerspnum,"ae""TERRORIST");

        if(
pnum == 1)
        {
               
// 1 terrorist alive <------------ (What Code Its Here?!)
        
}
    }
}
    
// add only cts in your menu
new players[32], pnumplayerszplayer[10];
get_players(playerspnum);
    
name[32]  // <----------------- ( i have errors in this line Help Pls!) 
    
for( new ii<pnumi++ )
{
        
player players[i]
        
get_user_name(player,name,31)
        
num_to_str(playerszplayer9);
        
menu_additem(menunameszplayer0);


thx for all :)

grimvh2 10-25-2009 14:00

Re: Need Some Codes
 
PHP Code:

name[32

:arrow:
PHP Code:

new name[32

Where you ask me "what do I need to do here"
What about calling your menu?

MaNuCs 10-26-2009 16:56

Re: Need Some Codes
 
PHP Code:

if(pnum == 1)
{
  
i need the code here!... its this" menu(id) " ??  // 1 terrorist alive
}

public 
DeathMsg()
{
    new 
Victim read_data(2)
    if(
get_user_team(Victim) == 1)
    {
        new 
players[32], pnum;
        
get_players(playerspnum,"ae""TERRORIST");

        if(
pnum == 1)
        {
              
i need the code here!... its this" menu(id) " ??  // 1 terrorist alive 
        
}
    }


---------> THIS???? FINISHED?
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>

new Plugin[] = "Lr Menu"
new Version[] =  "2.1"
new Author[] = "[M]aNuC[s]_"

new players[32], pnum;
get_players(playerspnum,"ae""TERRORIST");

if(
pnum == 1)
{
    
MenuLR(id// 1 terrorist alive
}

public 
plugin_init()
{
            
register_plugin(PluginVersionAuthor)
            
register_clcmd"say /lr",    "MenuLR");
            
register_clcmd"say !lr",    "MenuLR");
            
register_event("DeathMsg",       "DeathMsg""a"); // add to plugins init


}

public 
DeathMsg()
{
    new 
Victim read_data(2)
    if(
get_user_team(Victim) == 1)
    {
        new 
players[32], pnum;
        
get_players(playerspnum,"ae""TERRORIST");

        if(
pnum == 1)
        {
            
MenuLR(id// 1 terrorist alive
        
}
    }
}
    

public 
MenuLR(id

    if( 
is_user_alive(id) ) 
        
    {
    new 
Menu menu_create("\w Last Resquest:""mostrar_menu")
    
menu_additem(Menu"\w Khife Duel"        "1"0)
    
menu_additem(Menu"\w Shot For Shot"        "2"0
    
    
menu_setprop(Menu,MPROP_EXITNAME,"Salir"
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL
    
    
menu_display(idMenu0
    }
    
}

public 
mostrar_menu(idMenuitem

    if (
item == MENU_EXIT
    { 
    
menu_destroy(Menu
    return 
PLUGIN_HANDLED 
    


new 
iData[6]; 
new 
iAccess
new 
iCallback
new 
iName[64]; 
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback

    switch (
str_to_num(iData)) 
    { 
        case 
1:
        {
            if( 
is_user_alive(id) )
            {
            
Cuchilloid )
            }
    }
        case 
2:
        {
            if( 
is_user_alive(id) )
            {
            
Pistola(id)
            }  
        }
    }
    return 
PLUGIN_HANDLED
}

public 
Cuchilloid )
{
    new 
menu menu_create"Select a Player""MenuSelectPlayer1" )
    new 
players[32], pnumplayerszplayer[10];
    
get_players(playerspnum);
    
    new 
name[32]
    
    for( new 
ii<pnumi++ )
        {
        
player players[i]
        
get_user_name(player,name,31)
        
num_to_str(playerszplayer9);
        
menu_additem(menunameszplayer0);
        }
    
menu_displayidmenu )


public 
MenuSelectPlayer1idmenuitem )
{
    if ( 
item == MENU_EXIT )
        goto 
end
    
    
new data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
player str_to_num(data);  
    
        
strip_user_weapons(id)  
        
give_item(id"weapon_knife");
        
set_user_health(id100);
        
client_print(idprint_chat"Duel Khife Activado...")
end:
    
menu_destroymenu )
    return 
PLUGIN_HANDLED
}

public 
Pistolaid )
{
    new 
menu menu_create"Select a Player""MenuSelectPlayer2" )
    new 
players[32], pnumplayerszplayer[10];
    
get_players(playerspnum);
    
    new 
name[32]
    
    for( new 
ii<pnumi++ )
        {
        
player players[i]
        
get_user_name(player,name,31)
        
num_to_str(playerszplayer9);
        
menu_additem(menunameszplayer0);
        }
    
menu_displayidmenu )


public 
MenuSelectPlayer2idmenuitem )

{
    if ( 
item == MENU_EXIT )
        goto 
end
    
    
new data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
player str_to_num(data);  
    
           
strip_user_weapons (id)  
            
set_user_health(id100);
            
give_item(id,"weapon_deagle")
            
cs_set_user_bpammo(id,CSW_DEAGLE,200)
            
give_item(id"weapon_knife")
            
client_print(idprint_chat"Shot For Shot Activado...")
end:
    
menu_destroymenu )
    return 
PLUGIN_HANDLED




All times are GMT -4. The time now is 17:38.

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