AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ZP] Help with ammo packs reward (https://forums.alliedmods.net/showthread.php?t=131558)

MaT' 07-06-2010 12:36

[ZP] Help with ammo packs reward
 
My inglish is very bad :S

I need that the admins get and double ammo packs that players, i try with

PHP Code:

while (g_damagedealt[attacker] > get_pcvar_num(cvar_ammodamage))
{

    if(
get_user_flags(attacker) & ADMIN_KICK)
    {
        
g_ammopacks[attacker] += 2
    
}
    else
    {
    
g_ammopacks[attacker]++
    }
    
g_damagedealt[attacker] -= get_pcvar_num(cvar_ammodamage)


and work very well, but with this code the ammo add 2 and i want to add 1 but with a different cvar ej.: cvar_ADMammodamage to put the half of value

What would the code with that while?

drekes 07-06-2010 12:57

Re: [ZP] Help with ammo packs reward
 
if i understand it right you want an admin to have 2 times as many packs as a player. And you want to have the amount of packs registered in a cvar?

EDIT:
This should do it i think. Make a cvar for the amount.
PHP Code:

while(g_damagedealt[attacker] > get_pcvar_num(cvar_ammodamage))
{
    new 
amount get_pcvar_num(cvar_packs_reward)
    
    if(
get_user_flags(attacker) & ADMIN_KICK)
    {
        
g_ammopacks[attacker] += amount 2
    
}
    else
    {
        
g_ammopacks[attacker] += amount
    
}
    
g_damagedealt[attacker] -= get_pcvar_num(cvar_ammodamage)



MaT' 07-06-2010 13:29

Re: [ZP] Help with ammo packs reward
 
This is i want, but i don't know that it's ok

PHP Code:

if (get_user_flags(attacker) & ADMIN_LEVEL_B)
{
    while (
g_damagedealt[attacker] > get_pcvar_num(cvar_ADMammodamage)) //cvar_ADMammodamage = 250
    
{
        
g_ammopacks[attacker]++
        
g_damagedealt[attacker] -= get_pcvar_num(cvar_ADMammodamage)
    }
}
else
{
    while (
g_damagedealt[attacker] > get_pcvar_num(cvar_ADMammodamage)) //cvar_ammodamage = 500
    
{

        
g_ammopacks[attacker]++
        
g_damagedealt[attacker] -= get_pcvar_num(cvar_ammodamage)
    }



drekes 07-06-2010 14:29

Re: [ZP] Help with ammo packs reward
 
Quote:

Originally Posted by MaT' (Post 1229999)
This is i want, but i don't know that it's ok

PHP Code:

if (get_user_flags(attacker) & ADMIN_LEVEL_B)
{
    while (
g_damagedealt[attacker] > get_pcvar_num(cvar_ADMammodamage)) //cvar_ADMammodamage = 250
    
{
        
g_ammopacks[attacker]++
        
g_damagedealt[attacker] -= get_pcvar_num(cvar_ADMammodamage)
    }
}
else
{
    while (
g_damagedealt[attacker] > get_pcvar_num(cvar_ADMammodamage)) //cvar_ammodamage = 500
    
{

        
g_ammopacks[attacker]++
        
g_damagedealt[attacker] -= get_pcvar_num(cvar_ammodamage)
    }



That adds 1 pack regardless if it's an admin or not. Try to rephrase exactly what you want and i'll make it for you

MaT' 07-06-2010 15:12

Re: [ZP] Help with ammo packs reward
 
it's simple, i need that the admins get ammo packs more easily than players, but add 1 for 1 (20 - 21 - 22 ), no like the code that i put at the bigining where add 2 (20 - 22 - 24)

drekes 07-06-2010 15:17

Re: [ZP] Help with ammo packs reward
 
Quote:

Originally Posted by MaT' (Post 1230113)
it's simple, i need that the admins get ammo packs more easily than players, but add 1 for 1 (20 - 21 - 22 ), no like the code that i put at the bigining where add 2 (20 - 22 - 24)

And how do players get ammo packs then?

MaT' 07-06-2010 15:25

Re: [ZP] Help with ammo packs reward
 
when the players will draw 500 zombie HP, give 1 ammo pack
when the admins will draw 250 zombie HP, give 1 ammo pack

drekes 07-06-2010 15:36

Re: [ZP] Help with ammo packs reward
 
and cvar_ADMammodamage == 250?

AfteR. 07-06-2010 15:55

Re: [ZP] Help with ammo packs reward
 
...

PHP Code:

while (g_damagedealt[attacker] > get_pcvar_num(cvar_ammodamage))
{
        new 
amount get_pcvar_num(cvar_packs_reward)

        
g_ammopacks[attacker] += amount * (is_user_admin(attacker) ? 1)
        
g_damagedealt[attacker] -= get_pcvar_num(cvar_ammodamage)


Damagedealt is the same for all, but admins will get 2 AP.

MaT' 07-06-2010 19:24

Re: [ZP] Help with ammo packs reward
 
Quote:

Originally Posted by AfteR. (Post 1230173)
...

PHP Code:

while (g_damagedealt[attacker] > get_pcvar_num(cvar_ammodamage))
{
        new 
amount get_pcvar_num(cvar_packs_reward)

        
g_ammopacks[attacker] += amount * (is_user_admin(attacker) ? 1)
        
g_damagedealt[attacker] -= get_pcvar_num(cvar_ammodamage)


Damagedealt is the same for all, but admins will get 2 AP.


In this case the admin gets 2 ammo pack, i need that the admin gets 1 but more easily that a player.

Normal Plugin:
THE PLAYER MUST HIT TO ZOMBIE WITH 500 HP TO GET A AP

I Want:
THE PLAYER MUST HIT TO ZOMBIE WITH 500 HP TO GET A AP AND THE ADMIN MUST HIT TO ZOMBIE WITH 250 HP TO GET A AP

-------------------------

I try with:

PHP Code:

if (get_user_flags(attacker) & ADMIN_LEVEL_B)
{
    while (
g_damagedealt[attacker] > 250)
    {
        
g_ammopacks[attacker]++
        
g_damagedealt[attacker] -= 250
    
}
}
else
{
    while (
g_damagedealt[attacker] > 500)
    {

        
g_ammopacks[attacker]++
        
g_damagedealt[attacker] -= 500
    
}


but nothing gets an ap, i don't know why :S


All times are GMT -4. The time now is 07:12.

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