Raised This Month: $ Target: $400
 0% 

[Help] Fuction only usable once


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 12-25-2014 , 08:54   Re: [Help] Fuction only usable once
Reply With Quote #1

Quote:
Originally Posted by zmd94 View Post
Sorry, after tried a few methods, I still cannot find the correct way to do as your request.

However, if you want to restrict the item for one map, I can help you.
Give me what you have, please, and thank you.
Syturi0 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-25-2014 , 09:04   Re: [Help] Fuction only usable once
Reply With Quote #2

This is an example:
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < fun >

#define VERSION "0.1"

new boolg_HPboolg_Armorboolg_Money

new g_iMenu

public plugin_init() 
{
    
register_plugin"Free Item" VERSION "zmd94" )
    
    
// If you want to open gift menu, 
    // just say /gift in you chat
    
register_clcmd("say /gift""gift_menu")
    
register_clcmd("say_team /gift""gift_menu")
    
    
g_iMenu menu_create("\yFree Menu""gift_handler")
    
    
menu_additem(g_iMenu"\wHealth!""1");
    
menu_additem(g_iMenu"\wArmor""2");
    
menu_additem(g_iMenu"\yMoney!""3");
}

public 
gift_menu(id)
{
    if(
is_user_alive(id))
    {
        
// Show gift menu. ;)
        
menu_display(idg_iMenu0)
    }
}

public 
gift_handler(const id, const menuid, const item)
{
    if(
is_user_alive(id))
    {
        switch( 
item )
        {
            case 
0:
            {
                
// If there is already player redeem this free item
                
if(g_HP)
                {
                    
client_print(idprint_chat"[CS] There is already player redeem this reward!")
                }
                
// If there is no players redeem it
                
else
                {
                    
// Set free HP
                    // Code here. ;)
                    
                    // Set to true if there is player has redeem this item.
                    
g_HP true
                
}
            }
            case 
1:
            {
                
// If there is already player redeem this free item
                
if(g_Armor)
                {
                    
client_print(idprint_chat"[CS] There is already player redeem this reward!")
                }
                
// If there is no players redeem it
                
else
                {
                    
// Set free armor
                    // Code here. ;)
                    
                    // Set to true if there is player has redeem this item.
                    
g_Armor true
                
}
            }
            case 
2:
            {
                
// If there is already player redeem this free item
                
if(g_Money)
                {
                    
client_print(idprint_chat"[CS] There is already player redeem this reward!")
                }
                
// If there is no players redeem it
                
else
                {        
                    
// Set free money
                    // Code here. ;)
                    
                    // Set to true if there is player has redeem this item.
                    
g_Money true
                
}
            }
        }
    
        
menu_cancel(id)
    }

zmd94 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 15:32.


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