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

[Help] Add limit each player 1 item per map


Post New Thread Reply   
 
Thread Tools Display Modes
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 10-10-2014 , 02:55   Re: [Help] Add limit each player 1 item per map
Reply With Quote #11

Quote:
Originally Posted by zmd94 View Post
Nope. ;)
a , so what its needet, to code, to afect for all players ? pls ? ,, i want to block buy, only for 1 item.

if i do these codes, will afect all players forbiding buy that item for whole map ?

PHP Code:
new iBuyCount
const iMaxBuy 
PHP Code:
if(iBuyCount >= iMaxBuy
        { 
            
zp_colored_print(player"[ZP]^x01 Sorry this item is not available.")  
            return 
ZP_PLUGIN_HANDLED
        }
            
zp_make_user_nemesis(player)
            
zp_colored_print(0"[ZP]^x03 %s^x01 bought^x04 Nemesis!"name)
            
iBuyCount++ 
PHP Code:
public event_round_start()  
{  
        
iBuyCount 
__________________

Last edited by ghost95v; 10-10-2014 at 03:23.
ghost95v is offline
Send a message via Skype™ to ghost95v
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-10-2014 , 03:05   Re: [Help] Add limit each player 1 item per map
Reply With Quote #12

So, do you want when a player have already bought it, other players can't anymore buy it?
zmd94 is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 10-10-2014 , 03:15   Re: [Help] Add limit each player 1 item per map
Reply With Quote #13

Quote:
Originally Posted by zmd94 View Post
So, do you want when a player have already bought it, other players can't anymore buy it?
yes , exactly, how to do it ..(if a player, buy that item, others cant buy , for whole map). my last post updated.
__________________

Last edited by ghost95v; 10-10-2014 at 03:17.
ghost95v is offline
Send a message via Skype™ to ghost95v
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-10-2014 , 03:46   Re: [Help] Add limit each player 1 item per map
Reply With Quote #14

Just try below code. ;)
PHP Code:
public zp_extra_item_selected(playeritemid)
{
    if (!
g_buyable)
    {
        if (
RoundCount == get_pcvar_num(cvar_delay))
        {
            
zp_colored_print(player"^x04[ZP]^x01 You have to wait^x04 one^x01 more round before you can buy this item")
        }
        else
        {
            
zp_colored_print(player"^x04[ZP]^x01 You have to wait^x04 %d^x01 rounds until you can buy this item"get_pcvar_num(cvar_delay) - RoundCount 1)
        }
        return 
ZP_PLUGIN_HANDLED;
    }
    
    if (
zp_has_round_started() == || g_endround)
    {
        
zp_colored_print(player"^x04[ZP]^x01 This item can only be bought before the round mode starts")
        return 
ZP_PLUGIN_HANDLED;
    }
    new 
name[32]
    
get_user_name(playernamecharsmax(name))

    if(
itemid == g_nemesis)
    {
        if (
has_nemesis[player])
        {
            
zp_colored_print(player"^x04[ZP]^x01 You only can^x04 buy this item^x01 once for a map")
            
            return 
ZP_PLUGIN_HANDLED;
        }
        
        
zp_make_user_nemesis(player)
        
zp_colored_print(0"^x04[StreetZM]^x03 %s^x01 has bought ^x04 Nemesis"name)
        
        for (
player 1player <= g_maxplayersplayer++)
        {
            
has_nemesis[player] = true
        
}
    }
    else if(
itemid == g_survivor)
    {
        if (
has_survivor[player])
        {
            
zp_colored_print(player"^x04[ZP]^x01 You only can^x04 buy this item^x01 once for a map")
            
            return 
ZP_PLUGIN_HANDLED;
        }
        
zp_make_user_survivor(player)
        
zp_colored_print(0"^x04[StreetZM]^x03 %s^x01 has bought ^x04 Survivor"name)  
        
        for (
player 1player <= g_maxplayersplayer++)
        {
            
has_survivor[player] = true
        
}
    }  
    
g_buyable false
    
    
return PLUGIN_CONTINUE

zmd94 is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 10-10-2014 , 18:59   Re: [Help] Add limit each player 1 item per map
Reply With Quote #15

Thank you my friend, u are the best
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-10-2014 , 21:24   Re: [Help] Add limit each player 1 item per map
Reply With Quote #16

I'm glad I can help you. ;)
zmd94 is offline
onlinecheow
Member
Join Date: Jan 2013
Location: Malaysia [?]
Old 10-19-2014 , 13:23   Re: [Help] Add limit each player 1 item per map
Reply With Quote #17

Hmm my compiler has problems with 'cvar_delay' & 'iBuyCount' lol
__________________
SkyTheDog
onlinecheow is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 10-19-2014 , 13:27   Re: [Help] Add limit each player 1 item per map
Reply With Quote #18

Quote:
Originally Posted by onlinecheow View Post
Hmm my compiler has problems with 'cvar_delay' & 'iBuyCount' lol
Be more precise, what is the error output?
RateX is offline
onlinecheow
Member
Join Date: Jan 2013
Location: Malaysia [?]
Old 10-19-2014 , 13:38   Re: [Help] Add limit each player 1 item per map
Reply With Quote #19

Sorry but Im not with my PC rite now
Guess I will edit this comment tomorrow
__________________
SkyTheDog
onlinecheow is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-19-2014 , 19:43   Re: [Help] Add limit each player 1 item per map
Reply With Quote #20

Nothing we can do to help you, if you don't tell the exact errors. ;)
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 01:34.


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