Approved Random Prizes

Plug-ins compatibility with Zombie Escape 1.x only!


User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

Random Prizes

#1

Post by Night Fury » 6 years ago

| Description:
  • This plugin will give random prizes once per map with command /prize.

| Defines:
  • // Remove '//' to use XP rewards

    Code: Select all

    #define USE_XP
  • // Remove '//' to use multijump reward

    Code: Select all

    #define USE_MULTIJUMP
  • // Remove '//' to use parachute reward

    Code: Select all

    #define USE_PARACHUTE

| Cvars:
  • Escape Coins increase amount?

    Code: Select all

    ze_ranpriz_ecincrease
  • Escape Coins decrease amount?

    Code: Select all

    ze_ranpriz_ecreduce
  • HP increase amount?

    Code: Select all

    ze_ranpriz_hpincrease
  • HP decrease amount?

    Code: Select all

    ze_ranpriz_hpreduce
  • Speed increase amount?

    Code: Select all

    ze_ranpriz_speedincrease
  • Speed decrease amount?

    Code: Select all

    ze_ranpriz_speedreduce
  • XPincrease amount?

    Code: Select all

    ze_ranpriz_xpincrease
  • XP decrease amount?

    Code: Select all

    ze_ranpriz_xpreduce

| Changelog:
  • Spoiler!
    Image
    • First Release.
    Image
    • Code optimized to use ReAPI engine functions instead of fun functions.
    Image [Current Version]
    • Minor bug fixes.
    • Updated code style.
    • Added speed, XP, multijump & parachute rewards.

| Code:

    1. // Remove '//' to use XP rewards
    2. #define USE_XP
    3. // Remove '//' to use multijump reward
    4. #define USE_MULTIJUMP
    5. // Remove '//' to use parachute reward
    6. #define USE_PARACHUTE
    7.  
    8. #include <zombie_escape>
    9. #if defined USE_XP
    10.     #include <ze_levels>
    11. #endif
    12. #if defined USE_MULTIJUMP
    13.     #include <ze_multijump>
    14. #endif
    15. #if defined USE_PARACHUTE
    16.     #include <ze_parachute>
    17. #endif
    18.  
    19. enum _:Cvars
    20. {
    21.     EscapeCoins_Increase = 0,
    22.     EscapeCoins_Decrease,
    23.     Health_Increase,
    24.     Health_Decrease,
    25.     Speed_Increase,
    26.     Speed_Decrease
    27. }
    28.  
    29. new bool:g_bUsed[33]
    30. new g_iMaxPlayers
    31. new g_pCvar[Cvars]
    32. new g_pCvarZombieSpeed, g_pCvarHumanSpeed
    33. #if defined USE_XP
    34.     new g_pCvarXP_Increase, g_pCvarXP_Decrease
    35. #endif
    36.  
    37. public plugin_init()
    38. {
    39.     register_plugin("[ZE] Addons: Random Prizes", "1.2", "Jack GamePlay")
    40.  
    41.     // Commands
    42.     register_clcmd("say /prize", "give_prize")
    43.     register_clcmd("say_team /prize", "give_prize")
    44.  
    45.     // Cvars
    46.     g_pCvar[EscapeCoins_Increase] = register_cvar("ze_ranpriz_ecincrease", "4")
    47.     g_pCvar[EscapeCoins_Decrease] = register_cvar("ze_ranpriz_ecreduce", "4")
    48.     g_pCvar[Health_Increase] = register_cvar("ze_ranpriz_hpincrease", "200")
    49.     g_pCvar[Health_Decrease] = register_cvar("ze_ranpriz_hpreduce", "200")
    50.     g_pCvar[Speed_Increase] = register_cvar("ze_ranpriz_speedincrease", "200")
    51.     g_pCvar[Speed_Decrease] = register_cvar("ze_ranpriz_speedreduce", "200")
    52.  
    53.     #if defined USE_XP
    54.         g_pCvarXP_Increase = register_cvar("ze_ranpriz_xpincrease", "200")
    55.         g_pCvarXP_Decrease = register_cvar("ze_ranpriz_xpreduce", "200")
    56.     #endif
    57.  
    58.     g_iMaxPlayers = get_member_game(m_nMaxPlayers)
    59.  
    60.     for (new id = 0; id < g_iMaxPlayers; id++)
    61.     {
    62.         if (!is_user_connected(id) || !g_bUsed[id])
    63.             continue
    64.  
    65.         g_bUsed[id] = false
    66.     }
    67. }
    68.  
    69. public plugin_cfg()
    70. {
    71.     g_pCvarZombieSpeed = get_cvar_pointer("ze_zombie_speed")
    72.     g_pCvarHumanSpeed = get_cvar_pointer("ze_human_speed_factor")
    73. }
    74.  
    75. public plugin_end()
    76. {
    77.     for (new id = 1; id < g_iMaxPlayers; id++)
    78.     {
    79.         if (!is_user_connected(id) || !g_bUsed[id])
    80.             continue
    81.  
    82.         g_bUsed[id] = false
    83.     }
    84. }
    85.  
    86. public give_prize(id)
    87. {
    88.     if (!is_user_alive(id))
    89.     {
    90.         ze_colored_print(id, "!tYou must be alive!y.")
    91.         return
    92.     }
    93.     else if (g_bUsed[id])
    94.     {
    95.         ze_colored_print(id, "!tYou've used this command already!y.")
    96.         return
    97.     }
    98.    
    99.     if (!g_bUsed[id])
    100.     {
    101.         if (ze_is_user_zombie(id))
    102.         {
    103.             switch(random(11))
    104.             {
    105.                 case 0:
    106.                 {
    107.                     ze_set_escape_coins(id, ze_get_escape_coins(id) + get_pcvar_num(g_pCvar[EscapeCoins_Increase]))
    108.                     ze_colored_print(id, "!tYou've got !g%i !tEscape Coins!y.", get_pcvar_num(g_pCvar[EscapeCoins_Increase]))
    109.                 }
    110.                 case 1:
    111.                 {
    112.                     ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(g_pCvar[EscapeCoins_Decrease]))
    113.                     ze_colored_print(id, "!tYou've lost !g%i !tEscape Coins!y.", get_pcvar_num(g_pCvar[EscapeCoins_Decrease]))
    114.                 }
    115.                 case 2:
    116.                 {
    117.                     set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(g_pCvar[Health_Increase])))
    118.                     ze_colored_print(id, "!tYou've got !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Increase]))
    119.                 }
    120.                 case 3:
    121.                 {
    122.                     set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(g_pCvar[Health_Decrease])))
    123.                     ze_colored_print(id, "!tYou've lost !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Decrease]))
    124.                 }
    125.                 case 4:
    126.                 {
    127.                     ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    128.                 }
    129.                 case 5:
    130.                 {
    131.                     ze_set_zombie_speed(id, get_pcvar_num(g_pCvarZombieSpeed) + get_pcvar_num(g_pCvar[Speed_Increase]))
    132.                     ze_colored_print(id, "!tYou won !y[+!g%i!y] !tspeed for !y[!g15!y] !tsec!y.", get_pcvar_num(g_pCvar[Speed_Increase]))
    133.                     set_task(15.0, "ResetSpeed", id)
    134.                 }
    135.                 case 6:
    136.                 {
    137.                     ze_set_zombie_speed(id, get_pcvar_num(g_pCvarZombieSpeed) - get_pcvar_num(g_pCvar[Speed_Decrease]))
    138.                     ze_colored_print(id, "!tOops!y! !tYou lost !y[-!g%i!y] !tspeed for !y[!g15!y] !tsec!y.", get_pcvar_num(g_pCvar[Speed_Decrease]))
    139.                     set_task(15.0, "ResetSpeed", id)
    140.                 }
    141.                 case 7:
    142.                 {
    143.                     #if defined USE_XP
    144.                         ze_set_user_xp(id, ze_get_user_xp(id) + get_pcvar_num(g_pCvarXP_Increase))
    145.                         ze_colored_print(id, "!tYou won !y[+!g%i!y] !tXP!y.", get_pcvar_num(g_pCvarXP_Increase))
    146.                     #else
    147.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    148.                     #endif
    149.                 }
    150.                 case 8:
    151.                 {
    152.                     #if defined USE_XP
    153.                         ze_set_user_xp(id, ze_get_user_xp(id) - get_pcvar_num(g_pCvarXP_Decrease))
    154.                         ze_colored_print(id, "!tYou lost !y[-!g%i!y] !tXP!y.", get_pcvar_num(g_pCvarXP_Decrease))
    155.                     #else
    156.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    157.                     #endif
    158.                 }
    159.                 case 9:
    160.                 {
    161.                     #if defined USE_MULTIJUMP
    162.                         ze_give_user_multijump(id)
    163.                         ze_colored_print(id, "!tYou won !gMultijump!y.")
    164.                     #else
    165.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing !y.")
    166.                     #endif
    167.                 }
    168.                 case 10:
    169.                 {
    170.                     #if defined USE_PARACHUTE
    171.                         ze_give_user_parachute(id)
    172.                         ze_colored_print(id, "!tYou won !gParahute!y.")
    173.                     #else
    174.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got noting !y.")
    175.                     #endif
    176.                 }
    177.             }
    178.         }
    179.         else
    180.         {
    181.             switch(random(14))
    182.             {
    183.                 case 0:
    184.                 {
    185.                     ze_set_escape_coins(id, ze_get_escape_coins(id) + get_pcvar_num(g_pCvar[EscapeCoins_Increase]))
    186.                     ze_colored_print(id, "!tYou've got !g%i !tEscape Coins!y.", get_pcvar_num(g_pCvar[EscapeCoins_Increase]))
    187.                 }
    188.                 case 1:
    189.                 {
    190.                     ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(g_pCvar[EscapeCoins_Decrease]))
    191.                     ze_colored_print(id, "!tYou've lost !g%i !tEscape Coins!y.", get_pcvar_num(g_pCvar[EscapeCoins_Decrease]))
    192.                 }
    193.                 case 2:
    194.                 {
    195.                     set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(g_pCvar[Health_Increase])))
    196.                     ze_colored_print(id, "!tYou've got !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Increase]))
    197.                 }
    198.                 case 3:
    199.                 {
    200.                     set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(g_pCvar[Health_Decrease])))
    201.                     ze_colored_print(id, "!tYou've lost !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Decrease]))
    202.                 }
    203.                 case 4:
    204.                 {
    205.                     ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    206.                 }
    207.                 case 5:
    208.                 {
    209.                     rg_give_item(id, "weapon_smokegrenade", GT_APPEND)
    210.                     rg_set_user_bpammo(id, WeaponIdType:CSW_SMOKEGRENADE, 3)
    211.                     ze_colored_print(id, "!tYou've got !gx3 !tfrost nades!y.")
    212.                 }
    213.                 case 6:
    214.                 {
    215.                     rg_give_item(id, "weapon_hegrenade", GT_APPEND)
    216.                     rg_set_user_bpammo(id, WeaponIdType:CSW_HEGRENADE, 3)
    217.                     ze_colored_print(id, "!tYou've got !gx3 !tfire!y/!tnapalm nades!y.")
    218.                 }
    219.                 case 7:
    220.                 {
    221.                     rg_give_item(id, "weapon_hegrenade", GT_APPEND)
    222.                     rg_give_item(id, "weapon_smokegrenade", GT_APPEND)
    223.                     rg_give_item(id, "weapon_flashbang", GT_APPEND)
    224.                     rg_set_user_bpammo(id, WeaponIdType:CSW_SMOKEGRENADE, 3)
    225.                     rg_set_user_bpammo(id, WeaponIdType:CSW_HEGRENADE, 3)
    226.                     rg_set_user_bpammo(id, WeaponIdType:CSW_FLASHBANG, 3)
    227.                     ze_colored_print(id, "!tYou've got !gx3 !tof each nade!y.")
    228.                 }
    229.                 case 8:
    230.                 {
    231.                     ze_set_human_speed_factor(id, get_pcvar_num(g_pCvarHumanSpeed) + get_pcvar_num(g_pCvar[Speed_Increase]))
    232.                     ze_colored_print(id, "!tYou won !y[+!g%i!y] !tspeed for !y[!g15!y] !tsec!y.", get_pcvar_num(g_pCvar[Speed_Increase]))
    233.                     set_task(15.0, "ResetSpeed", id)
    234.                 }
    235.                 case 9:
    236.                 {
    237.                     ze_set_human_speed_factor(id, get_pcvar_num(g_pCvarHumanSpeed) - get_pcvar_num(g_pCvar[Speed_Decrease]))
    238.                     ze_colored_print(id, "!tOops!y! !tYou lost !y[-!g%i!y] !tspeed for !y[!g15!y] !tsec!y.", get_pcvar_num(g_pCvar[Speed_Decrease]))
    239.                     set_task(15.0, "ResetSpeed", id)
    240.                 }
    241.                 case 10:
    242.                 {
    243.                     #if defined USE_XP
    244.                         ze_set_user_xp(id, ze_get_user_xp(id) + get_pcvar_num(g_pCvarXP_Increase))
    245.                         ze_colored_print(id, "!tYou won !y[+!g%i!y] !tXP!y.", get_pcvar_num(g_pCvarXP_Increase))
    246.                     #else
    247.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    248.                     #endif
    249.                 }
    250.                 case 11:
    251.                 {
    252.                     #if defined USE_XP
    253.                         ze_set_user_xp(id, ze_get_user_xp(id) - get_pcvar_num(g_pCvarXP_Decrease))
    254.                         ze_colored_print(id, "!tSorry!y, !tYou lost !y[-!g%i!y] !tXP!y.", get_pcvar_num(g_pCvarXP_Decrease))
    255.                     #else
    256.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    257.                     #endif
    258.                 }
    259.                 case 12:
    260.                 {
    261.                     #if defined USE_MULTIJUMP
    262.                         ze_give_user_multijump(id)
    263.                         ze_colored_print(id, "!tYou won !gMultijump!y.")
    264.                     #else
    265.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing !y.")
    266.                     #endif
    267.                 }
    268.                 case 13:
    269.                 {
    270.                     #if defined USE_PARACHUTE
    271.                         ze_give_user_parachute(id)
    272.                         ze_colored_print(id, "!tYou won !gParahute!y.")
    273.                     #else
    274.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got noting !y.")
    275.                     #endif
    276.                 }
    277.             }
    278.         }
    279.  
    280.         g_bUsed[id] = true
    281.     }
    282. }
    283.  
    284. public ResetSpeed(id)
    285. {
    286.     if (is_user_connected(id))
    287.     {
    288.         ze_colored_print(id, "!gSpeed expired!y, !tyour speed now normal!y!")
    289.         if (ze_is_user_zombie(id))
    290.             ze_reset_zombie_speed(id)
    291.         else
    292.             ze_reset_human_speed(id)
    293.     }
    294. }
    295.  
    296. public ze_roundend()
    297. {
    298.     for (new id = 1; id < g_iMaxPlayers; id++)
    299.     {
    300.         if (!is_user_connected(id))
    301.             continue
    302.  
    303.         ze_remove_user_parachute(id)
    304.         ze_remove_user_multijump(id)
    305.     }
    306. }
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#2

Post by johnnysins2000 » 6 years ago

Does this prize Have Time ? MEANING When I type prize after that I will have to wait %d minutes to again use this command /prize ?

Nice Plugin btw
Nobody Is That Busy If They Make Time :roll:

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#3

Post by Night Fury » 6 years ago

johnnysins2000 wrote: 6 years ago Does this prize Have Time ? MEANING When I type prize after that I will have to wait %d minutes to again use this command /prize ?

Nice Plugin btw
If i were you, i'd read thread fully.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#4

Post by Raheem » 6 years ago

+ Like, Good job jack we need more plugins like that.
Jack GamePlay wrote: 6 years ago If i were you, i'd read thread fully.
You don't write the command in the description man :lol:
He who fails to plan is planning to fail

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#5

Post by Night Fury » 6 years ago

Raheem wrote: 6 years ago + Like, Good job jack we need more plugins like that.
Jack GamePlay wrote: 6 years ago If i were you, i'd read thread fully.
You don't write the command in the description man :lol:
I wrote the code in the description. :)
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#6

Post by Raheem » 6 years ago

I see it from the code also it's not so hard hehe. I'll make description for it when get time so if someone not know in code can know the command ; )
He who fails to plan is planning to fail

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#7

Post by johnnysins2000 » 6 years ago

Jack GamePlay wrote: 6 years ago
johnnysins2000 wrote: 6 years ago Does this prize Have Time ? MEANING When I type prize after that I will have to wait %d minutes to again use this command /prize ?

Nice Plugin btw
If i were you, i'd read thread fully.
Once Per Map
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#8

Post by Raheem » 6 years ago

New version available: 1.1
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#9

Post by Spir0x » 6 years ago

No one can add exp to this code ?
example like giving escape coins by cvars
making a new cvar will give exp to player randomly from "50 to 150"
examples.

my own code:

Code: Select all

#include <zombie_escape>
 
new bool:g_bUsed[33], Cvar[4]
 
public plugin_init()
{
    register_plugin("[ZE] Addons: Random Prizes", "1.1", "Jack")
	
	// Commands
    register_clcmd("say /prize", "give_prize")
    register_clcmd("say_team /prize", "give_prize")
	
    // Cvars
    Cvar[0] = register_cvar("ze_ranpriz_ecincrease", "4")
}
 
public server_changelevel()
{
    for(new id = 0; id < get_member_game(m_nMaxPlayers); id++)
    {
        if(!is_user_connected(id) || !g_bUsed[id])
            continue
           
        g_bUsed[id] = false
    }
}
 
public give_prize(id)
{
    if(!is_user_alive(id))
    {
        ze_colored_print(id, "!tYou must be alive to use your chance!y.")
        return
    }
    else if(g_bUsed[id])
    {
        ze_colored_print(id, "!tYou already used your chance!y, !tTry Again next map!y.")
        return
    }
   
    if(!g_bUsed[id])
    {
        switch(random(8))
        {
            case 0: // Escape coins increasment
            {
                ze_set_escape_coins(id, ze_get_escape_coins(id) + get_pcvar_num(Cvar[0]))
                ze_colored_print(id, "!tYou won !g%d !tGolds!y.", get_pcvar_num(Cvar[0]))
            }
            case 1: // Nothing
            {
                ze_colored_print(id, "!tBad Luck!y, !tSorry you didn't win anything!y.")
            }
            case 2: // Frost nade
            {
                if(!ze_is_user_zombie(id))
                {
                    rg_give_item(id, "weapon_smokegrenade", GT_APPEND)
                    rg_set_user_bpammo(id, WeaponIdType:CSW_SMOKEGRENADE, 3)
                    ze_colored_print(id, "!tYou have got !gx3 !tFrost nades!y.")
                }
            }
            case 3: // Fire nade
            {
                if(!ze_is_user_zombie(id))
                {
                    rg_give_item(id, "weapon_hegrenade", GT_APPEND)
                    rg_set_user_bpammo(id, WeaponIdType:CSW_HEGRENADE, 3)
                    ze_colored_print(id, "!tYou have got !gx3 !tFire nades!y.")
                }
            }
            case 4: // Pack of grenades
            {
                if(!ze_is_user_zombie(id))
                {
                    rg_give_item(id, "weapon_hegrenade", GT_APPEND)
                    rg_give_item(id, "weapon_smokegrenade", GT_APPEND)

                    rg_set_user_bpammo(id, WeaponIdType:CSW_SMOKEGRENADE, 3)
                    rg_set_user_bpammo(id, WeaponIdType:CSW_HEGRENADE, 3)
                    ze_colored_print(id, "!tYou received !gx3 !tFire!y/!tFrost nades!y.")
                }
            }
        }
        g_bUsed[id] = true
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#10

Post by Raheem » 6 years ago

Here:
  • Code: Select all

    #include <zombie_escape>
    #include <ze_levels>
     
    new bool:g_bUsed[33], g_iCoins, g_iXP
     
    public plugin_init()
    {
        register_plugin("[ZE] Addons: Random Prizes", "1.1", "Jack")
    	
    	// Commands
        register_clcmd("say /prize", "give_prize")
        register_clcmd("say_team /prize", "give_prize")
    	
        // Cvars
        g_iCoins = register_cvar("ze_ranpriz_ecincrease", "4")
    	g_iXP = register_cvar("ze_ranpriz_xpincrease", "4")
    }
     
    public server_changelevel()
    {
        for(new id = 0; id < get_member_game(m_nMaxPlayers); id++)
        {
            if(!is_user_connected(id) || !g_bUsed[id])
                continue
               
            g_bUsed[id] = false
        }
    }
     
    public give_prize(id)
    {
        if(!is_user_alive(id))
        {
            ze_colored_print(id, "!tYou must be alive to use your chance!y.")
            return
        }
        else if(g_bUsed[id])
        {
            ze_colored_print(id, "!tYou already used your chance!y, !tTry Again next map!y.")
            return
        }
       
        if(!g_bUsed[id])
        {
            switch(random(8))
            {
                case 0: // Escape coins increasment
                {
                    ze_set_escape_coins(id, ze_get_escape_coins(id) + get_pcvar_num(g_iCoins))
                    ze_colored_print(id, "!tYou won !g%d !tGolds!y.", get_pcvar_num(g_iCoins))
                }
                case 1: // Nothing
                {
                    ze_colored_print(id, "!tBad Luck!y, !tSorry you didn't win anything!y.")
                }
                case 2: // Frost nade
                {
                    if(!ze_is_user_zombie(id))
                    {
                        rg_give_item(id, "weapon_smokegrenade", GT_APPEND)
                        rg_set_user_bpammo(id, WeaponIdType:CSW_SMOKEGRENADE, 3)
                        ze_colored_print(id, "!tYou have got !gx3 !tFrost nades!y.")
                    }
                }
                case 3: // Fire nade
                {
                    if(!ze_is_user_zombie(id))
                    {
                        rg_give_item(id, "weapon_hegrenade", GT_APPEND)
                        rg_set_user_bpammo(id, WeaponIdType:CSW_HEGRENADE, 3)
                        ze_colored_print(id, "!tYou have got !gx3 !tFire nades!y.")
                    }
                }
                case 4: // Pack of grenades
                {
                    if(!ze_is_user_zombie(id))
                    {
                        rg_give_item(id, "weapon_hegrenade", GT_APPEND)
                        rg_give_item(id, "weapon_smokegrenade", GT_APPEND)
    
                        rg_set_user_bpammo(id, WeaponIdType:CSW_SMOKEGRENADE, 3)
                        rg_set_user_bpammo(id, WeaponIdType:CSW_HEGRENADE, 3)
                        ze_colored_print(id, "!tYou received !gx3 !tFire!y/!tFrost nades!y.")
                    }
                }
    			case 5: // XP increasment
    			{
    				ze_set_user_xp(id, ze_get_user_xp(id) + get_pcvar_num(g_iXP))
    				ze_colored_print(id, "!tYou won !g%d !tXP!y.", get_pcvar_num(g_iXP))
    			}
            }
            g_bUsed[id] = true
        }
    }
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#11

Post by Spir0x » 6 years ago

ok, thank.

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#12

Post by czirimbolo » 5 years ago

Can someone add 2 prizes:
- lower speed
- higher speed
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#13

Post by Raheem » 5 years ago

Using our new version natives:
  • Code: Select all

    #include <zombie_escape>
     
    new bool:g_bUsed[33], Cvar[6]
    
    new g_pCvarZombieSpeed, g_pCvarHumanSpeed
    
    public plugin_init()
    {
        register_plugin("[ZE] Addons: Random Prizes", "1.1", "Jack")
    	
    	// Commands
        register_clcmd("say /prize", "give_prize")
        register_clcmd("say_team /prize", "give_prize")
    	
        // Cvars
        Cvar[0] = register_cvar("ze_ranpriz_ecincrease", "4")
        Cvar[1] = register_cvar("ze_ranpriz_ecreduce", "4")
        Cvar[2] = register_cvar("ze_ranpriz_hpincrease", "200")
        Cvar[3] = register_cvar("ze_ranpriz_hpreduce", "200")
    	Cvar[4] = register_cvar("ze_ranpriz_speedincrease", "100")
    	Cvar[5] = register_cvar("ze_ranpriz_decrease", "50")
    	
        g_pCvarZombieSpeed = get_cvar_pointer("ze_zombie_speed")
    	g_pCvarHumanSpeed = get_cvar_pointer("ze_human_speed_factor")
    }
     
    public server_changelevel()
    {
        for(new id = 0; id < get_member_game(m_nMaxPlayers); id++)
        {
            if(!is_user_connected(id) || !g_bUsed[id])
                continue
               
            g_bUsed[id] = false
        }
    }
     
    public give_prize(id)
    {
        if(!is_user_alive(id))
        {
            ze_colored_print(id, "!tYou must be alive!y.")
            return
        }
        else if(g_bUsed[id])
        {
            ze_colored_print(id, "!tYou've just used this command!y.")
            return
        }
       
        if(!g_bUsed[id])
        {
            switch(random_num(0, 8))
            {
                case 0: // Escape coins increasment
                {
                    ze_set_escape_coins(id, ze_get_escape_coins(id) + get_pcvar_num(Cvar[0]))
                    ze_colored_print(id, "!tYou've got !g%d !tEscape Coins!y.", get_pcvar_num(Cvar[0]))
                }
                case 1: // Escape coins reducement
                {
                    ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(Cvar[1]))
                    ze_colored_print(id, "!tYou've lost !g%d !tEscape Coins!y.", get_pcvar_num(Cvar[1]))
                }
                case 2: // Health increasment
                {
                    set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(Cvar[2])))
                    ze_colored_print(id, "!tYou've got !g%d !tHealth!y.", get_pcvar_num(Cvar[2]))
                }
                case 3: // Health reducement
                {
                    set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(Cvar[3])))
                    ze_colored_print(id, "!tYou've lost !g%d !tHealth!y.", get_pcvar_num(Cvar[3]))
                }
                case 4: // Nothing
                {
                    ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
                }
                case 5: // Frost nade
                {
                    if(!ze_is_user_zombie(id))
                    {
                        rg_give_item(id, "weapon_smokegrenade", GT_APPEND)
                        rg_set_user_bpammo(id, WeaponIdType:CSW_SMOKEGRENADE, 3)
                        ze_colored_print(id, "!tYou've got !gx3 !tfrost nades!y.")
                    }
                }
                case 6: // Fire/Napalm nade
                {
                    if(!ze_is_user_zombie(id))
                    {
                        rg_give_item(id, "weapon_hegrenade", GT_APPEND)
                        rg_set_user_bpammo(id, WeaponIdType:CSW_HEGRENADE, 3)
                        ze_colored_print(id, "!tYou've got !gx3 !tfire!y/!tnapalm nades!y.")
                    }
                }
                case 7: // Pack of grenades
                {
                    if(!ze_is_user_zombie(id))
                    {
                        rg_give_item(id, "weapon_hegrenade", GT_APPEND)
                        rg_give_item(id, "weapon_smokegrenade", GT_APPEND)
                        rg_give_item(id, "weapon_flashbang", GT_APPEND)
                        rg_set_user_bpammo(id, WeaponIdType:CSW_SMOKEGRENADE, 3)
                        rg_set_user_bpammo(id, WeaponIdType:CSW_HEGRENADE, 3)
                        rg_set_user_bpammo(id, WeaponIdType:CSW_FLASHBANG, 3)
                        ze_colored_print(id, "!tYou've got !gx3 !tof each nade!y.")
                    }
                }
    			case 8:
    			{
    				if (ze_is_user_zombie(id))
    				{
    					ze_set_zombie_speed(id, get_pcvar_num(g_pCvarZombieSpeed) + get_pcvar_num(Cvar[4]))
    					
    					ze_colored_print(id, "!tCongratulations!y, !tyou won !g+%d Speed for 30 seconds!y.", get_pcvar_num(Cvar[4]))
    					set_task(30.0, "ZombieResetSpeed", id)
    				}
    				else
    				{
    					ze_set_human_speed_factor(id, get_pcvar_num(g_pCvarHumanSpeed) + get_pcvar_num(Cvar[4]))
    					
    					ze_colored_print(id, "!tCongratulations!y, !tyou won !g+%d Speed for 30 seconds!y.", get_pcvar_num(Cvar[4]))
    					set_task(30.0, "HumanResetSpeed", id)
    				}
    			}
    			case 9:
    			{
    				if (ze_is_user_zombie(id))
    				{
    					ze_set_zombie_speed(id, get_pcvar_num(g_pCvarZombieSpeed) - get_pcvar_num(Cvar[5]))
    					
    					ze_colored_print(id, "!tSorry!y, !tyou lost !g+%d Speed for 15 seconds!y.", get_pcvar_num(Cvar[5]))
    					set_task(15.0, "ZombieResetSpeed", id)
    				}
    				else
    				{
    					ze_set_human_speed_factor(id, get_pcvar_num(g_pCvarHumanSpeed) - get_pcvar_num(Cvar[5]))
    					
    					ze_colored_print(id, "!tSorry!y, !tyou lost !g+%d Speed for 15 seconds!y.", get_pcvar_num(Cvar[5]))
    					set_task(15.0, "HumanResetSpeed", id)
    				}
    			}
            }
            g_bUsed[id] = true
        }
    }
    
    public ZombieResetSpeed(id)
    {
    	if (is_user_connected(id))
    	{
    		ze_colored_print(id, "!tSpeed expired!y, !tyour speed now normal!y!")
    		ze_reset_zombie_speed(id)
    	}
    }
    
    public HumanResetSpeed(id)
    {
    	if (is_user_connected(id))
    	{
    		ze_colored_print(id, "!tSpeed expired!y, !tyour speed now normal!y!")
    		ze_reset_human_speed(id)
    	}
    }
Last edited by Raheem 5 years ago, edited 1 time in total.
Reason: Updated
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#14

Post by czirimbolo » 5 years ago

Thanks Raheem
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#15

Post by Raheem » 5 years ago

I updated the code, i was do something wrong in setting the speed. Try it now.
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#16

Post by czirimbolo » 5 years ago

seems that extra speed or less speed doesnt work. Never won this prize on my server
Image

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#17

Post by Night Fury » 5 years ago

czirimbolo wrote: 5 years ago seems that extra speed or less speed doesnt work. Never won this prize on my server
Random..

Updated to Version 1.2 .
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#18

Post by Mark » 5 years ago

Jack GamePlay wrote: 6 years ago | Description:
  • This plugin will give random prizes once per map with command /prize.

| Defines:
  • // Remove '//' to use XP rewards

    Code: Select all

    #define USE_XP
  • // Remove '//' to use multijump reward

    Code: Select all

    #define USE_MULTIJUMP
  • // Remove '//' to use parachute reward

    Code: Select all

    #define USE_PARACHUTE

| Cvars:
  • Escape Coins increase amount?

    Code: Select all

    ze_ranpriz_ecincrease
  • Escape Coins decrease amount?

    Code: Select all

    ze_ranpriz_ecreduce
  • HP increase amount?

    Code: Select all

    ze_ranpriz_hpincrease
  • HP decrease amount?

    Code: Select all

    ze_ranpriz_hpreduce
  • Speed increase amount?

    Code: Select all

    ze_ranpriz_speedincrease
  • Speed decrease amount?

    Code: Select all

    ze_ranpriz_speedreduce
  • XPincrease amount?

    Code: Select all

    ze_ranpriz_xpincrease
  • XP decrease amount?

    Code: Select all

    ze_ranpriz_xpreduce

| Changelog:
  • Spoiler!
    Image
    • First Release.
    Image
    • Code optimized to use ReAPI engine functions instead of fun functions.
    Image [Current Version]
    • Minor bug fixes.
    • Updated code style.
    • Added speed, XP, multijump & parachute rewards.

| Code:

    1. // Remove '//' to use XP rewards
    2. #define USE_XP
    3. // Remove '//' to use multijump reward
    4. #define USE_MULTIJUMP
    5. // Remove '//' to use parachute reward
    6. #define USE_PARACHUTE
    7.  
    8. #include <zombie_escape>
    9. #if defined USE_XP
    10.     #include <ze_levels>
    11. #endif
    12. #if defined USE_MULTIJUMP
    13.     #include <ze_multijump>
    14. #endif
    15. #if defined USE_PARACHUTE
    16.     #include <ze_parachute>
    17. #endif
    18.  
    19. enum _:Cvars
    20. {
    21.     EscapeCoins_Increase = 0,
    22.     EscapeCoins_Decrease,
    23.     Health_Increase,
    24.     Health_Decrease,
    25.     Speed_Increase,
    26.     Speed_Decrease
    27. }
    28.  
    29. new bool:g_bUsed[33]
    30. new g_iMaxPlayers
    31. new g_pCvar[Cvars]
    32. new g_pCvarZombieSpeed, g_pCvarHumanSpeed
    33. #if defined USE_XP
    34.     new g_pCvarXP_Increase, g_pCvarXP_Decrease
    35. #endif
    36.  
    37. public plugin_init()
    38. {
    39.     register_plugin("[ZE] Addons: Random Prizes", "1.2", "Jack GamePlay")
    40.  
    41.     // Commands
    42.     register_clcmd("say /prize", "give_prize")
    43.     register_clcmd("say_team /prize", "give_prize")
    44.  
    45.     // Cvars
    46.     g_pCvar[EscapeCoins_Increase] = register_cvar("ze_ranpriz_ecincrease", "4")
    47.     g_pCvar[EscapeCoins_Decrease] = register_cvar("ze_ranpriz_ecreduce", "4")
    48.     g_pCvar[Health_Increase] = register_cvar("ze_ranpriz_hpincrease", "200")
    49.     g_pCvar[Health_Decrease] = register_cvar("ze_ranpriz_hpreduce", "200")
    50.     g_pCvar[Speed_Increase] = register_cvar("ze_ranpriz_speedincrease", "200")
    51.     g_pCvar[Speed_Decrease] = register_cvar("ze_ranpriz_speedreduce", "200")
    52.  
    53.     #if defined USE_XP
    54.         g_pCvarXP_Increase = register_cvar("ze_ranpriz_xpincrease", "200")
    55.         g_pCvarXP_Decrease = register_cvar("ze_ranpriz_xpreduce", "200")
    56.     #endif
    57.  
    58.     g_iMaxPlayers = get_member_game(m_nMaxPlayers)
    59.  
    60.     for (new id = 0; id < g_iMaxPlayers; id++)
    61.     {
    62.         if (!is_user_connected(id) || !g_bUsed[id])
    63.             continue
    64.  
    65.         g_bUsed[id] = false
    66.     }
    67. }
    68.  
    69. public plugin_cfg()
    70. {
    71.     g_pCvarZombieSpeed = get_cvar_pointer("ze_zombie_speed")
    72.     g_pCvarHumanSpeed = get_cvar_pointer("ze_human_speed_factor")
    73. }
    74.  
    75. public plugin_end()
    76. {
    77.     for (new id = 1; id < g_iMaxPlayers; id++)
    78.     {
    79.         if (!is_user_connected(id) || !g_bUsed[id])
    80.             continue
    81.  
    82.         g_bUsed[id] = false
    83.     }
    84. }
    85.  
    86. public give_prize(id)
    87. {
    88.     if (!is_user_alive(id))
    89.     {
    90.         ze_colored_print(id, "!tYou must be alive!y.")
    91.         return
    92.     }
    93.     else if (g_bUsed[id])
    94.     {
    95.         ze_colored_print(id, "!tYou've used this command already!y.")
    96.         return
    97.     }
    98.    
    99.     if (!g_bUsed[id])
    100.     {
    101.         if (ze_is_user_zombie(id))
    102.         {
    103.             switch(random(11))
    104.             {
    105.                 case 0:
    106.                 {
    107.                     ze_set_escape_coins(id, ze_get_escape_coins(id) + get_pcvar_num(g_pCvar[EscapeCoins_Increase]))
    108.                     ze_colored_print(id, "!tYou've got !g%i !tEscape Coins!y.", get_pcvar_num(g_pCvar[EscapeCoins_Increase]))
    109.                 }
    110.                 case 1:
    111.                 {
    112.                     ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(g_pCvar[EscapeCoins_Decrease]))
    113.                     ze_colored_print(id, "!tYou've lost !g%i !tEscape Coins!y.", get_pcvar_num(g_pCvar[EscapeCoins_Decrease]))
    114.                 }
    115.                 case 2:
    116.                 {
    117.                     set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(g_pCvar[Health_Increase])))
    118.                     ze_colored_print(id, "!tYou've got !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Increase]))
    119.                 }
    120.                 case 3:
    121.                 {
    122.                     set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(g_pCvar[Health_Decrease])))
    123.                     ze_colored_print(id, "!tYou've lost !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Decrease]))
    124.                 }
    125.                 case 4:
    126.                 {
    127.                     ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    128.                 }
    129.                 case 5:
    130.                 {
    131.                     ze_set_zombie_speed(id, get_pcvar_num(g_pCvarZombieSpeed) + get_pcvar_num(g_pCvar[Speed_Increase]))
    132.                     ze_colored_print(id, "!tYou won !y[+!g%i!y] !tspeed for !y[!g15!y] !tsec!y.", get_pcvar_num(g_pCvar[Speed_Increase]))
    133.                     set_task(15.0, "ResetSpeed", id)
    134.                 }
    135.                 case 6:
    136.                 {
    137.                     ze_set_zombie_speed(id, get_pcvar_num(g_pCvarZombieSpeed) - get_pcvar_num(g_pCvar[Speed_Decrease]))
    138.                     ze_colored_print(id, "!tOops!y! !tYou lost !y[-!g%i!y] !tspeed for !y[!g15!y] !tsec!y.", get_pcvar_num(g_pCvar[Speed_Decrease]))
    139.                     set_task(15.0, "ResetSpeed", id)
    140.                 }
    141.                 case 7:
    142.                 {
    143.                     #if defined USE_XP
    144.                         ze_set_user_xp(id, ze_get_user_xp(id) + get_pcvar_num(g_pCvarXP_Increase))
    145.                         ze_colored_print(id, "!tYou won !y[+!g%i!y] !tXP!y.", get_pcvar_num(g_pCvarXP_Increase))
    146.                     #else
    147.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    148.                     #endif
    149.                 }
    150.                 case 8:
    151.                 {
    152.                     #if defined USE_XP
    153.                         ze_set_user_xp(id, ze_get_user_xp(id) - get_pcvar_num(g_pCvarXP_Decrease))
    154.                         ze_colored_print(id, "!tYou lost !y[-!g%i!y] !tXP!y.", get_pcvar_num(g_pCvarXP_Decrease))
    155.                     #else
    156.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    157.                     #endif
    158.                 }
    159.                 case 9:
    160.                 {
    161.                     #if defined USE_MULTIJUMP
    162.                         ze_give_user_multijump(id)
    163.                         ze_colored_print(id, "!tYou won !gMultijump!y.")
    164.                     #else
    165.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing !y.")
    166.                     #endif
    167.                 }
    168.                 case 10:
    169.                 {
    170.                     #if defined USE_PARACHUTE
    171.                         ze_give_user_parachute(id)
    172.                         ze_colored_print(id, "!tYou won !gParahute!y.")
    173.                     #else
    174.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got noting !y.")
    175.                     #endif
    176.                 }
    177.             }
    178.         }
    179.         else
    180.         {
    181.             switch(random(14))
    182.             {
    183.                 case 0:
    184.                 {
    185.                     ze_set_escape_coins(id, ze_get_escape_coins(id) + get_pcvar_num(g_pCvar[EscapeCoins_Increase]))
    186.                     ze_colored_print(id, "!tYou've got !g%i !tEscape Coins!y.", get_pcvar_num(g_pCvar[EscapeCoins_Increase]))
    187.                 }
    188.                 case 1:
    189.                 {
    190.                     ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(g_pCvar[EscapeCoins_Decrease]))
    191.                     ze_colored_print(id, "!tYou've lost !g%i !tEscape Coins!y.", get_pcvar_num(g_pCvar[EscapeCoins_Decrease]))
    192.                 }
    193.                 case 2:
    194.                 {
    195.                     set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(g_pCvar[Health_Increase])))
    196.                     ze_colored_print(id, "!tYou've got !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Increase]))
    197.                 }
    198.                 case 3:
    199.                 {
    200.                     set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(g_pCvar[Health_Decrease])))
    201.                     ze_colored_print(id, "!tYou've lost !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Decrease]))
    202.                 }
    203.                 case 4:
    204.                 {
    205.                     ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    206.                 }
    207.                 case 5:
    208.                 {
    209.                     rg_give_item(id, "weapon_smokegrenade", GT_APPEND)
    210.                     rg_set_user_bpammo(id, WeaponIdType:CSW_SMOKEGRENADE, 3)
    211.                     ze_colored_print(id, "!tYou've got !gx3 !tfrost nades!y.")
    212.                 }
    213.                 case 6:
    214.                 {
    215.                     rg_give_item(id, "weapon_hegrenade", GT_APPEND)
    216.                     rg_set_user_bpammo(id, WeaponIdType:CSW_HEGRENADE, 3)
    217.                     ze_colored_print(id, "!tYou've got !gx3 !tfire!y/!tnapalm nades!y.")
    218.                 }
    219.                 case 7:
    220.                 {
    221.                     rg_give_item(id, "weapon_hegrenade", GT_APPEND)
    222.                     rg_give_item(id, "weapon_smokegrenade", GT_APPEND)
    223.                     rg_give_item(id, "weapon_flashbang", GT_APPEND)
    224.                     rg_set_user_bpammo(id, WeaponIdType:CSW_SMOKEGRENADE, 3)
    225.                     rg_set_user_bpammo(id, WeaponIdType:CSW_HEGRENADE, 3)
    226.                     rg_set_user_bpammo(id, WeaponIdType:CSW_FLASHBANG, 3)
    227.                     ze_colored_print(id, "!tYou've got !gx3 !tof each nade!y.")
    228.                 }
    229.                 case 8:
    230.                 {
    231.                     ze_set_human_speed_factor(id, get_pcvar_num(g_pCvarHumanSpeed) + get_pcvar_num(g_pCvar[Speed_Increase]))
    232.                     ze_colored_print(id, "!tYou won !y[+!g%i!y] !tspeed for !y[!g15!y] !tsec!y.", get_pcvar_num(g_pCvar[Speed_Increase]))
    233.                     set_task(15.0, "ResetSpeed", id)
    234.                 }
    235.                 case 9:
    236.                 {
    237.                     ze_set_human_speed_factor(id, get_pcvar_num(g_pCvarHumanSpeed) - get_pcvar_num(g_pCvar[Speed_Decrease]))
    238.                     ze_colored_print(id, "!tOops!y! !tYou lost !y[-!g%i!y] !tspeed for !y[!g15!y] !tsec!y.", get_pcvar_num(g_pCvar[Speed_Decrease]))
    239.                     set_task(15.0, "ResetSpeed", id)
    240.                 }
    241.                 case 10:
    242.                 {
    243.                     #if defined USE_XP
    244.                         ze_set_user_xp(id, ze_get_user_xp(id) + get_pcvar_num(g_pCvarXP_Increase))
    245.                         ze_colored_print(id, "!tYou won !y[+!g%i!y] !tXP!y.", get_pcvar_num(g_pCvarXP_Increase))
    246.                     #else
    247.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    248.                     #endif
    249.                 }
    250.                 case 11:
    251.                 {
    252.                     #if defined USE_XP
    253.                         ze_set_user_xp(id, ze_get_user_xp(id) - get_pcvar_num(g_pCvarXP_Decrease))
    254.                         ze_colored_print(id, "!tSorry!y, !tYou lost !y[-!g%i!y] !tXP!y.", get_pcvar_num(g_pCvarXP_Decrease))
    255.                     #else
    256.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing!y.")
    257.                     #endif
    258.                 }
    259.                 case 12:
    260.                 {
    261.                     #if defined USE_MULTIJUMP
    262.                         ze_give_user_multijump(id)
    263.                         ze_colored_print(id, "!tYou won !gMultijump!y.")
    264.                     #else
    265.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got nothing !y.")
    266.                     #endif
    267.                 }
    268.                 case 13:
    269.                 {
    270.                     #if defined USE_PARACHUTE
    271.                         ze_give_user_parachute(id)
    272.                         ze_colored_print(id, "!tYou won !gParahute!y.")
    273.                     #else
    274.                         ze_colored_print(id, "!tUnfortunately!y! !tYou've got noting !y.")
    275.                     #endif
    276.                 }
    277.             }
    278.         }
    279.  
    280.         g_bUsed[id] = true
    281.     }
    282. }
    283.  
    284. public ResetSpeed(id)
    285. {
    286.     if (is_user_connected(id))
    287.     {
    288.         ze_colored_print(id, "!gSpeed expired!y, !tyour speed now normal!y!")
    289.         if (ze_is_user_zombie(id))
    290.             ze_reset_zombie_speed(id)
    291.         else
    292.             ze_reset_human_speed(id)
    293.     }
    294. }
    295.  
    296. public ze_roundend()
    297. {
    298.     for (new id = 1; id < g_iMaxPlayers; id++)
    299.     {
    300.         if (!is_user_connected(id))
    301.             continue
    302.  
    303.         ze_remove_user_parachute(id)
    304.         ze_remove_user_multijump(id)
    305.     }
    306. }
Update this i can't edit your post :D Both Human and Zombie Prize has a + on decrease HP

From
  1.                 {
  2.                     set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(g_pCvar[Health_Increase])))
  3.                     ze_colored_print(id, "!tYou've got !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Increase]))
  4.                     g_bUsed[id]++
  5.                 }
  6.                 case 3:
  7.                 {
  8.                     set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(g_pCvar[Health_Decrease])))
  9.                     ze_colored_print(id, "!tYou've lost !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Decrease]))
  10.                     g_bUsed[id]++
  11.                 }
To
  1.                 {
  2.                     set_entvar(id, var_health, float(get_user_health(id) + get_pcvar_num(g_pCvar[Health_Increase])))
  3.                     ze_colored_print(id, "!tYou've got !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Increase]))
  4.                     g_bUsed[id]++
  5.                 }
  6.                 case 3:
  7.                 {
  8.                     set_entvar(id, var_health, float(get_user_health(id) - get_pcvar_num(g_pCvar[Health_Decrease])))
  9.                     ze_colored_print(id, "!tYou've lost !g%i !tHealth!y.", get_pcvar_num(g_pCvar[Health_Decrease]))
  10.                     g_bUsed[id]++
  11.                 }

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#19

Post by Mark » 5 years ago

Im trying to block the prize.

I dont want humans to be able to get a prize before zombie is choose then when zombie is choose i dont want zombie to be able to get prize untill release.

I tryed this.
  1. public ze_game_started()
  2. {
  3.     g_bBlockBuy = true
  4. }
  5.  
  6. public ze_zombie_appear()
  7. {
  8.     g_bBlockBuy = false
  9.     g_bZBlockBuy = true
  10. }
  11.  
  12. public ze_zombie_release()
  13. {
  14.     g_bZBlockBuy = false
  15. }
  16.  
  17. public plugin_end()
  18. {
  19.     for (new id = 1; id < g_iMaxPlayers; id++)
  20.     {
  21.         if (!is_user_connected(id) || !g_bUsed[id])
  22.             continue
  23.  
  24.         g_bUsed[id] = false
  25.     }
  26. }
  27.  
  28. public ze_user_humanized(id)
  29. {
  30.     g_bUsed[id] = false
  31. }
  32.  
  33.  
  34. public give_prize(id)
  35. {
  36.     if (!is_user_alive(id) || g_bBlockBuy)
  37.     {
  38.         ze_colored_print(id, "!tYou must wait till zombie choosen!y.")
  39.         return
  40.     }
  41.     if (ze_is_user_zombie(id) || g_bZBlockBuy)
  42.     {
  43.         ze_colored_print(id, "!tYou must wait till zombie released!y.")
  44.         return
  45.     }
  46.     else if (g_bUsed[id])
  47.     {
  48.         ze_colored_print(id, "!tYou can only use this once per round!")
  49.         return
  50.     }

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#20

Post by Mark » 5 years ago

@Raheem what am i doing wrong lol

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 0 guests