Approved Random Prizes

Gameplay Addons
User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 576
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 47 times
Age: 19
Contact:

Random Prizes

#1

Post by Jack GamePlay » 2 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. }
These users thanked the author Jack GamePlay for the post:
Raheem (2 Years Ago)
Not interested in CS/Pawn anymore.
Accepting web projects.

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#2

Post by johnnysins2000 » 2 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
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 576
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 47 times
Age: 19
Contact:

#3

Post by Jack GamePlay » 2 Years Ago

johnnysins2000 wrote:
2 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.
Not interested in CS/Pawn anymore.
Accepting web projects.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1866
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 98 times
Age: 21
Contact:

#4

Post by Raheem » 2 Years Ago

+ Like, Good job jack we need more plugins like that.
Jack GamePlay wrote:
2 Years Ago
If i were you, i'd read thread fully.
You don't write the command in the description man :lol:
You don't know? Learn and you will know.

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 576
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 47 times
Age: 19
Contact:

#5

Post by Jack GamePlay » 2 Years Ago

Raheem wrote:
2 Years Ago
+ Like, Good job jack we need more plugins like that.
Jack GamePlay wrote:
2 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. :)
Not interested in CS/Pawn anymore.
Accepting web projects.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1866
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 98 times
Age: 21
Contact:

#6

Post by Raheem » 2 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 ; )
These users thanked the author Raheem for the post:
Jack GamePlay (2 Years Ago)
You don't know? Learn and you will know.

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#7

Post by johnnysins2000 » 2 Years Ago

Jack GamePlay wrote:
2 Years Ago
johnnysins2000 wrote:
2 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
Egypt
Posts: 1866
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 98 times
Age: 21
Contact:

#8

Post by Raheem » 1 Year Ago

New version available: 1.1
You don't know? Learn and you will know.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 620
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#9

Post by Spir0x » 1 Year 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 }
*/
I trynna make money, not friends.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1866
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 98 times
Age: 21
Contact:

#10

Post by Raheem » 1 Year 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
        }
    }
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests