Raised This Month: $51 Target: $400
 12% 

menu only for a User


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
victorngl
Member
Join Date: Feb 2011
Old 12-25-2011 , 03:08   menu only for a User
Reply With Quote #1

I need this menu can be accessed only by the first user to type the command to open it.

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >


#define PLUGIN "Vivo ou Morto JailBreak"
#define VERSION "1.0"
#define AUTHOR "Viictor #"

new szSoundM[] = { "sound/misc/morto.wav" 
new 
szSoundV[] = { "sound/misc/vivo.wav" 

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /brincadeiras""szFunny")
}

public 
plugin_precache()
{
    
precache_sound(szSoundM)
    
precache_sound(szSoundV)
}

public 
szFunny(id)
{
    new 
menu menu_create("\yVivo ou Morto!\r By Viictor#:""szMenu_Handled")
    
    
menu_additem(menu"\yVivo!""1"0)
    
menu_additem(menu"\yMorto!""2"0)
    
    
menu_setprop(menuMPROP_EXITMEXIT_NEVER)
    
    
menu_display(idmenu0)
}
public 
szMenu_Handled(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1:{
            
server_cmd("amx_execall spk sound/misc/vivo.wav")
            
set_hudmessage(025500.480.3606.03.0)
            
show_hudmessage(0"VIVO!")
            
szFunny(id)
            
menu_destroy(menu)
            return 
PLUGIN_HANDLED
        
}
        case 
2:{
            
server_cmd("amx_execall spk sound/misc/morto.wav")
            
set_hudmessage(025500.480.3606.03.0)
            
show_hudmessage(0"MORTO!")
            
szFunny(id)
            
menu_destroy(menu)
            return 
PLUGIN_HANDLED
        
}
    }
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED

victorngl is offline
Send a message via MSN to victorngl Send a message via Skype™ to victorngl
Heartbeat
Member
Join Date: Nov 2011
Location: Denmark
Old 12-25-2011 , 04:13   Re: menu only for a User
Reply With Quote #2

i dont believe that is possible..

Last edited by Heartbeat; 12-25-2011 at 04:14.
Heartbeat is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-25-2011 , 04:13   Re: menu only for a User
Reply With Quote #3

Store the id of the first player in a global variable. Check in the command if the id of the person calling the command is the same as the person in the variable. Also, if the variable is equal to 0 then store the person's id. Quite simple actually.
__________________
fysiks is offline
victorngl
Member
Join Date: Feb 2011
Old 12-25-2011 , 04:18   Re: menu only for a User
Reply With Quote #4

something like that?

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >


#define PLUGIN "Vivo ou Morto JailBreak"
#define VERSION "1.0"
#define AUTHOR "Viictor #"
new szName[32]
new 
szSoundM[] = { "sound/misc/morto.wav" 
new 
szSoundV[] = { "sound/misc/vivo.wav" 
new 
g_Player[33]


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /brincadeiras""szFunnyTask")
    
    
}

public 
szFunnyTaskid )
{
    
    
get_user_name(idszNamecharsmax(szName))
    
g_Player szName
    set_task
(0.1"szFunny"szName)
    
}
public 
plugin_precache()
{
    
precache_sound(szSoundM)
    
precache_sound(szSoundV)
}

public 
szFunny(id)
{
    
    if(
szName[id])
    {
        
        new 
menu menu_create("\yVivo ou Morto!\r By Viictor#:""szMenu_Handled")
        
        
menu_additem(menu"\yVivo!""1"0)
        
menu_additem(menu"\yMorto!""2"0)
        
        
menu_setprop(menuMPROP_EXITMEXIT_NEVER)
        
        
menu_display(idmenu0)
    }
    else
    {
        
client_print(idprint_chat"Outra pessoa ja esta usando o menu de brincadeiras")
    }
}
public 
szMenu_Handled(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1:{
            
server_cmd("amx_execall spk sound/misc/vivo.wav")
            
set_hudmessage(025500.480.3606.03.0)
            
show_hudmessage(0"VIVO!")
            
szFunny(id)
            
menu_destroy(menu)
            return 
PLUGIN_HANDLED
        
}
        case 
2:{
            
server_cmd("amx_execall spk sound/misc/morto.wav")
            
set_hudmessage(025500.480.3606.03.0)
            
show_hudmessage(0"MORTO!")
            
szFunny(id)
            
menu_destroy(menu)
            return 
PLUGIN_HANDLED
        
}
    }
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED


Last edited by victorngl; 12-25-2011 at 04:26. Reason: Code
victorngl is offline
Send a message via MSN to victorngl Send a message via Skype™ to victorngl
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-25-2011 , 08:08   Re: menu only for a User
Reply With Quote #5

PHP Code:
#include < amxmodx >

#define PLUGIN "Vivo ou Morto JailBreak"
#define VERSION "1.0"
#define AUTHOR "Viictor #"

new szSoundM[] = { "misc/morto.wav" }  // remove sound/ from path unless sound is located in cstrike/sound/sound/...
new szSoundV[] = { "misc/vivo.wav" 

new 
bool:g_bCmdHasBeenUsed

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /brincadeiras""ClCmd_FunnyTask")
}

public 
plugin_precache()
{
    
precache_sound(szSoundM)
    
precache_sound(szSoundV)
}

public 
ClCmd_FunnyTaskid )
{
    if( 
g_bCmdHasBeenUsed )
    {
        
client_print(idprint_chat"Outra pessoa ja esta usando o menu de brincadeiras")
        return 
PLUGIN_HANDLED
    
}

    
g_bCmdHasBeenUsed true

    
new menu menu_create("\yVivo ou Morto!\r By Viictor#:""hVivoMortoMenuHandled")

    
menu_additem(menu"\yVivo!")
    
menu_additem(menu"\yMorto!")

    
menu_setprop(menuMPROP_EXITMEXIT_NEVER)

    
menu_display(idmenu0)

    return 
PLUGIN_CONTINUE
}

public 
hVivoMortoMenuHandled(idmenuitem)
{
    switch( 
item // MENU_EXIT implied there, also MEXIT_NEVER is set so there is no exit option
    
{
        case 
0:
        {
            
client_cmd(0"spk %s"szSoundV)
            
set_hudmessage(025500.480.3606.03.0,_,_,-1)
            
show_hudmessage(0"VIVO!")
        }
        case 
1:
        {
            
client_cmd(0"spk %s"szSoundM)
            
set_hudmessage(025500.480.3606.03.0,_,_,-1)
            
show_hudmessage(0"MORTO!")
        }
    }

    
menu_destroy(menu)
    return 
PLUGIN_HANDLED

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 12-25-2011 at 08:11.
ConnorMcLeod is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-25-2011 , 18:27   Re: menu only for a User
Reply With Quote #6

I was thinking he meant that the first person to use it can use it again and everybody else cannot use it at all. I guess the way he says it that it could be either way.
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-26-2011 , 00:45   Re: menu only for a User
Reply With Quote #7

Anyway, his code is so terrible that i would be better in request forum than in scripting help one.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
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 17:37.


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