Raised This Month: $ Target: $400
 0% 

[Help] Add limit each player 1 item per map


Post New Thread Reply   
 
Thread Tools Display Modes
Depresie
Veteran Member
Join Date: Nov 2013
Old 11-04-2014 , 07:23   Re: [Help] Add limit each player 1 item per map
Reply With Quote #41

sorry for not answering, i have some health problems, i will test it these days to see...
Depresie is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-04-2014 , 09:07   Re: [Help] Add limit each player 1 item per map
Reply With Quote #42

Depresie, just take your time!

By the way, your health should be your first priority. ;)
zmd94 is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 11-06-2014 , 02:06   Re: [Help] Add limit each player 1 item per map
Reply With Quote #43

Hello ;), well to block all these items for 1 player, when 1 item is bought from him, i have to make a bool like this ? or just a new variable[33]

PHP Code:
new bool:has_mod[33]
or 
just ?
new 
has_mod[33

in the function
PHP Code:
 if (itemid == g_nemesis)
        {
            if(
has_mod[player])
            {
            
chat_color(player"!g[StreetZM]!y You !galready have bought mod !yin this map!")
            return 
ZP_PLUGIN_HANDLED;
            }
            
zp_make_user_nemesis(player)
            
has_mod[player] = true
        
}
        else  if (
itemid == g_survivor)
        {
            if(
has_mod[player])
            {
                
chat_color(player"!g[StreetZM]!y You !galready have bought !ymod in this map!")
                return 
ZP_PLUGIN_HANDLED;
            }
            if(
has_survivor[player])
            {
            
chat_color(player"!g[ZP]!y It!g was a Survivor!y in this map!")
            return 
ZP_PLUGIN_HANDLED;
            }
            
zp_make_user_survivor(player)
            
has_mod[player] = true
            
for (player 1player <= g_maxplayersplayer++)
            {
            
has_survivor[player] = true
            
}
        } 
__________________

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

Just use new bool:has_mod[33] as you just want to check whether the player has bought the extra item or not. ;)
zmd94 is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 11-21-2014 , 07:02   Re: [Help] Add limit each player 1 item per map
Reply With Quote #45

Well we limited many things on this code for Buying mode. but i was wondering for the round blocks Delay, to be avaible and prevent buying mod also if there was a player maded a Mod by Server or by a zp_ command by admin. hope you understand me, this will be really helpfull for me.
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-21-2014 , 09:20   Re: [Help] Add limit each player 1 item per map
Reply With Quote #46

Just learn from this code for the round delay code: https://forums.alliedmods.net/showpo...3&postcount=36
zmd94 is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 11-21-2014 , 10:15   Re: [Help] Add limit each player 1 item per map
Reply With Quote #47

I know, and we already have round delay code on my first post. I've liked Round delay for Mods no matter if Server or Admin gaved to a Player, they still have to wait X rounds delay. Because in current code we have, is doing Delay only if there is Bought mod by AMMO PACKS. i hope understanded now, what i mean. ... if we can do a Ex. zp_get_current_gamemode() or a zp_is_nemesis_round() to be couted with cvar_delay. will be really helpfull
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-21-2014 , 10:54   Re: [Help] Add limit each player 1 item per map
Reply With Quote #48

Yes, it is possible. Below is an example on how to do it:
PHP Code:
public zp_round_started(modeid)
{
    switch(
mode)
    {
        
// If the mode for that round is Nemesis mode
        // we add the value to delay countdown
        
case MODE_NEMESIS:
        {
            
// Increase the value by 1
            
RoundCount += 1
        
}
        
// If the mode for that round is Survivor mode
        // we add the value to delay countdown
        
case MODE_SURVIVOR:
        {
            
// Increase the value by 1
            
RoundCount += 1
        
}
    }


Last edited by zmd94; 11-21-2014 at 20:16.
zmd94 is offline
Gam3ronE
SourceMod Donor
Join Date: Aug 2010
Old 11-21-2014 , 19:55   Re: [Help] Add limit each player 1 item per map
Reply With Quote #49

Using a switch would be a more efficent method and use less resources than multiple if statements for buy modes.
Gam3ronE is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-21-2014 , 20:15   Re: [Help] Add limit each player 1 item per map
Reply With Quote #50

I appreciate it. ;)

I have updated the code.
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 05:57.


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