Raised This Month: $ Target: $400
 0% 

[ZP][TUT] Happy Hour


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JuanCruz.-
BANNED
Join Date: Dec 2009
Location: Scripting
Old 12-29-2009 , 10:45   [ZP][TUT] Happy Hour
Reply With Quote #1

[ Happy Hour ]

CREDITS: Capostrike!

DESCRIPTION: Traffic on a large double ammo packs at a certain time "X" until some time "X".

Good start, for this we must open our sma zombie plague, ie have zombie_plague40.sma or as each.

Above all the plugin, includes below, we:
PHP Code:
new const horas[] = { 00,01,02,03,04,05,06,07,08,09,10,11,12 }
new 
boolg_happytime // happy time 
There are saying that will be 12 hours of happy hour, marrow from 12:00 PM until 12:00 AM.

Then look for the following line:

PHP Code:
            // Reward ammo packs for every [ammo damage] dealt
            
while (g_damagedealt[attacker] >= ammodamage
Now, here we'll put that when we put us in double packs, for that we replace the while for this:

PHP Code:
            // Reward ammo packs for every [ammo damage] dealt
            
while (g_damagedealt[attacker] >= ammodamage)
            {
                if(!
g_happytime)
                {
                    if(
is_user_admin(attacker))
                    {
                        
g_ammopacks[attacker] += 2
                        g_damagedealt
[attacker] -= ammodamage
                    
}
                    else
                    {
                        
g_ammopacks[attacker]++
                        
g_damagedealt[attacker] -= ammodamage
                    
}
                }
                else if(
g_happytime)
                {
                    if(
is_user_admin(attacker))
                    {
                        
g_ammopacks[attacker] += 4
                        g_damagedealt
[attacker] -= ammodamage
                    
}
                    else
                    {
                        
g_ammopacks[attacker] += 2
                        g_damagedealt
[attacker] -= ammodamage
                    
}
                }
                
            } 
Now go to the following public:
PHP Code:
// Event Round Start
public event_round_start() 
Then, below the "(" place:
PHP Code:
    // [HH] Happy Hour
    
set_task(0.1,"happyhour"
That call to the message every round to begin by saying that there are already happy hour.

Missing the latest, let down all around the plug and put:

PHP Code:
// Happy Hour
public happyhour(id)
{
    new 
data[12]
    
get_time("%H"data12)
    
    new 
Tiempo str_to_num(data)
    
    for(new 
i=0;<= sizeof horas 1;i++)
    {
        if(
Tiempo != horas[i]) continue
        
g_happytime true
    
}
    if(
g_happytime)
    {
        
set_task(3.0,"anuncio")    
    }
}
public 
anuncio(id)
{
    
zp_colored_print(0"^x04[ZP]^x01 - Already, Happy Hour, began at 24:00 am until 13:00 pm")  

JuanCruz.- is offline
Send a message via MSN to JuanCruz.-
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 12-29-2009 , 11:02   Re: [ZP][TUT] Happy Hour
Reply With Quote #2

Google Translator fail.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
AfteR.
Veteran Member
Join Date: Dec 2008
Location: λ
Old 12-29-2009 , 12:23   Re: [ZP][TUT] Happy Hour
Reply With Quote #3

Quote:
Originally Posted by meTaLiCroSS View Post
Google Translator fail.
Also, you shouldn't put [TUT], I would call it [C&P]

AfteR. is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 12-29-2009 , 12:23   Re: [ZP][TUT] Happy Hour
Reply With Quote #4

Quote:
Originally Posted by AfteR. View Post
Also, you shouldn't put [TUT], I would call it [C&P]



__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Javivi
AlliedModders Donor
Join Date: Dec 2008
Old 12-29-2009 , 13:23   Re: [ZP][TUT] Happy Hour
Reply With Quote #5

PHP Code:
            // Reward ammo packs for every [ammo damage] dealt
            
while (g_damagedealt[attacker] >= ammodamage)
            {
                if(!
g_happytime)
                {
                    if(
is_user_admin(attacker))
                    {
                        
g_ammopacks[attacker] += 2
                        g_damagedealt
[attacker] -= ammodamage
                    
}
                    else
                    {
                        
g_ammopacks[attacker]++
                        
g_damagedealt[attacker] -= ammodamage
                    
}
                }
                else if(
g_happytime)
                {
                    if(
is_user_admin(attacker))
                    {
                        
g_ammopacks[attacker] += 4
                        g_damagedealt
[attacker] -= ammodamage
                    
}
                    else
                    {
                        
g_ammopacks[attacker] += 2
                        g_damagedealt
[attacker] -= ammodamage
                    
}
                }
                
            } 
--------------------->

PHP Code:
while (g_damagedealt[attacker] >= (ammodamage / (g_happytime 1)) )
        {  
            
g_ammopacks[attacker] += (is_user_admin(attacker) ? 1
            
g_damagedealt[attacker] -=  (ammodamage / (g_happytime 1))  
        } 
Owned
(Thanks to capostrike...)



Owned by Google Translator...


Owned by yourself (?)

__________________
Javivi is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 12-29-2009 , 13:56   Re: [ZP][TUT] Happy Hour
Reply With Quote #6

Quote:
Originally Posted by Javivi View Post
PHP Code:
            // Reward ammo packs for every [ammo damage] dealt
            
while (g_damagedealt[attacker] >= ammodamage)
            {
                if(!
g_happytime)
                {
                    if(
is_user_admin(attacker))
                    {
                        
g_ammopacks[attacker] += 2
                        g_damagedealt
[attacker] -= ammodamage
                    
}
                    else
                    {
                        
g_ammopacks[attacker]++
                        
g_damagedealt[attacker] -= ammodamage
                    
}
                }
                else if(
g_happytime)
                {
                    if(
is_user_admin(attacker))
                    {
                        
g_ammopacks[attacker] += 4
                        g_damagedealt
[attacker] -= ammodamage
                    
}
                    else
                    {
                        
g_ammopacks[attacker] += 2
                        g_damagedealt
[attacker] -= ammodamage
                    
}
                }
                
            } 
--------------------->

PHP Code:
while (g_damagedealt[attacker] >= (ammodamage / (g_happytime 1)) )
        {  
            
g_ammopacks[attacker] += (is_user_admin(attacker) ? 1
            
g_damagedealt[attacker] -=  (ammodamage / (g_happytime 1))  
        } 
Owned
(Thanks to capostrike...)



Owned by Google Translator...


Owned by yourself (?)

Owned by Metal.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 12-29-2009 , 15:27   Re: [ZP][TUT] Happy Hour
Reply With Quote #7

wtf is this shit .
Owned by
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
WhightKnight
Senior Member
Join Date: Jun 2008
Old 12-29-2009 , 17:49   Re: [ZP][TUT] Happy Hour
Reply With Quote #8

very nice! I would used to do the same thing (double ammo packs, etc.) during events, however I'd always have to recompile zombieplague.sma

Thanks a million
__________________
WhightKnight is offline
AfteR.
Veteran Member
Join Date: Dec 2008
Location: λ
Old 12-29-2009 , 23:01   Re: [ZP][TUT] Happy Hour
Reply With Quote #9

Quote:
Originally Posted by Javivi View Post

Owned
(Thanks to capostrike...)



Owned by Google Translator...

Owned by yourself (?)

Quote:
Originally Posted by meTaLiCroSS View Post
Owned by Metal.
Quote:
Originally Posted by NiHiLaNTh View Post
Owned by
Dont forget about him:

Owned by
AfteR. 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:24.


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