Approved Coins Gamble

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


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

Coins Gamble

#1

Post by Raheem » 5 years ago

Coins Gamble

Description:
  • This plugin will allow players to gamble with their coins, example gamble 500 there is 50% you will win 500 or you will lose them. This plugin just for fun.
Commands:
  • say gamble "value" or say_team gamble "value" any player can gamble any amount he needs in chat, the value should be higher than MINIMUM_VALUE.
Code:
    1. /*
    2. *    A gamble system, just for FUN - RAHEEM
    3. */
    4.  
    5. #include <zombie_escape>
    6.  
    7. #define MINIMUM_VALUE 250 // Minimum Escape Coins to be gambled
    8.  
    9. new g_szCommand[] = "gamble" // Change cmd if needed
    10.  
    11. public plugin_init()
    12. {
    13.     register_plugin("Gamble System", "1.0", "Raheem")
    14.    
    15.     register_clcmd("say", "SayHandler");
    16.     register_clcmd("say_team", "SayHandler")
    17. }
    18.  
    19. public SayHandler(id)
    20. {
    21.     new szMessage[192]
    22.     read_args(szMessage, charsmax(szMessage))
    23.    
    24.     remove_quotes(szMessage) // Important to remove quotes, so parse function works correctly
    25.    
    26.     new szCommand[32], szValue[32]
    27.     parse(szMessage, szCommand, charsmax(szCommand), szValue, charsmax(szValue)) //Split the string
    28.    
    29.     if (!equali(g_szCommand, szCommand))
    30.         return PLUGIN_CONTINUE;
    31.    
    32.     new iValue = str_to_num(szValue)
    33.    
    34.     if ((ze_get_escape_coins(id) < iValue) && (iValue >= MINIMUM_VALUE))
    35.     {
    36.         client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You have no enough escape coins^1!")
    37.        
    38.         return PLUGIN_CONTINUE
    39.     }
    40.    
    41.     if (iValue < MINIMUM_VALUE)
    42.     {
    43.         client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3Minimum value to gamble is ^4%i ^3EC^1.", MINIMUM_VALUE)
    44.        
    45.         return PLUGIN_CONTINUE
    46.     }
    47.    
    48.     new iRandomNum = random_num(1, 100) // 50% lose, 50% win
    49.    
    50.     if (iRandomNum >= 1 && iRandomNum < 50)
    51.     {
    52.         // WIN
    53.         client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You WON ^1!")
    54.         ze_set_escape_coins(id, ze_get_escape_coins(id) + iValue)
    55.     }
    56.     else
    57.     {
    58.         // LOSE
    59.         client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You LOST ^1!")
    60.         ze_set_escape_coins(id, ze_get_escape_coins(id) - iValue)
    61.     }
    62.    
    63.     return PLUGIN_CONTINUE
    64. }
He who fails to plan is planning to fail

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#2

Post by Muhammet20 » 4 years ago

Raheem wrote: 5 years ago
Coins Gamble

Description:
  • This plugin will allow players to gamble with their coins, example gamble 500 there is 50% you will win 500 or you will lose them. This plugin just for fun.
Commands:
  • say gamble "value" or say_team gamble "value" any player can gamble any amount he needs in chat, the value should be higher than MINIMUM_VALUE.
Code:
    1. /*
    2. *    A gamble system, just for FUN - RAHEEM
    3. */
    4.  
    5. #include <zombie_escape>
    6.  
    7. #define MINIMUM_VALUE 250 // Minimum Escape Coins to be gambled
    8.  
    9. new g_szCommand[] = "gamble" // Change cmd if needed
    10.  
    11. public plugin_init()
    12. {
    13.     register_plugin("Gamble System", "1.0", "Raheem")
    14.    
    15.     register_clcmd("say", "SayHandler");
    16.     register_clcmd("say_team", "SayHandler")
    17. }
    18.  
    19. public SayHandler(id)
    20. {
    21.     new szMessage[192]
    22.     read_args(szMessage, charsmax(szMessage))
    23.    
    24.     remove_quotes(szMessage) // Important to remove quotes, so parse function works correctly
    25.    
    26.     new szCommand[32], szValue[32]
    27.     parse(szMessage, szCommand, charsmax(szCommand), szValue, charsmax(szValue)) //Split the string
    28.    
    29.     if (!equali(g_szCommand, szCommand))
    30.         return PLUGIN_CONTINUE;
    31.    
    32.     new iValue = str_to_num(szValue)
    33.    
    34.     if ((ze_get_escape_coins(id) < iValue) && (iValue >= MINIMUM_VALUE))
    35.     {
    36.         client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You have no enough escape coins^1!")
    37.        
    38.         return PLUGIN_CONTINUE
    39.     }
    40.    
    41.     if (iValue < MINIMUM_VALUE)
    42.     {
    43.         client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3Minimum value to gamble is ^4%i ^3EC^1.", MINIMUM_VALUE)
    44.        
    45.         return PLUGIN_CONTINUE
    46.     }
    47.    
    48.     new iRandomNum = random_num(1, 100) // 50% lose, 50% win
    49.    
    50.     if (iRandomNum >= 1 && iRandomNum < 50)
    51.     {
    52.         // WIN
    53.         client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You WON ^1!")
    54.         ze_set_escape_coins(id, ze_get_escape_coins(id) + iValue)
    55.     }
    56.     else
    57.     {
    58.         // LOSE
    59.         client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You LOST ^1!")
    60.         ze_set_escape_coins(id, ze_get_escape_coins(id) - iValue)
    61.     }
    62.    
    63.     return PLUGIN_CONTINUE
    64. }
Nice but i dont love it

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

#3

Post by Raheem » 4 years ago

Why :laughing:
He who fails to plan is planning to fail

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#4

Post by Muhammet20 » 4 years ago

Raheem wrote: 4 years agoWhy :laughing:
IDK :D

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