Page 1 of 1

Coins Gamble

Posted: 05 Feb 2019, 19:58
by Raheem
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. }

Re: Coins Gamble

Posted: 06 Jul 2019, 13:50
by Muhammet20
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

Re: Coins Gamble

Posted: 07 Jul 2019, 20:31
by Raheem
Why :laughing:

Re: Coins Gamble

Posted: 08 Jul 2019, 15:45
by Muhammet20
Raheem wrote: 4 years agoWhy :laughing:
IDK :D