AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with a Bet Plugin (https://forums.alliedmods.net/showthread.php?t=293579)

xeloxded 02-04-2017 11:20

Help with a Bet Plugin
 
Hi i have this plugin adapted to my Mod

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <ColorChat>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new monety_gracza[33], Pozo[33], randon


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /bet""menu_apostar")
}
public 
menu_apostar(id){
    new 
menu menu_create("\r[\y Bet Menu\r ]""handler_apostar")
    
menu_additem(menu"Bet 2 Moneys""0"0)
    
menu_additem(menu"Bet 4 Moneys""1"0)
    
menu_setprop(menuMPROP_EXITNAME"Close")
    
menu_display(idmenu0)
    return 
PLUGIN_HANDLED
}
public 
handler_apostar(idmenuitem){
    if(
item == MENU_EXIT) return PLUGIN_HANDLED
    
switch(item){
        case 
0:{
            if(
monety_gracza[id] < 2){
                
ColorChat(idGREEN"Not enough money")
                return 
PLUGIN_HANDLED
            
}
            
randonrandom_num(12)
            
ColorChat(idGREEN"Sad, you lost your bet and was send into the betting pool")
            
Pozo[id]  += 2
            monety_gracza
[id] -= 2
            
if(randon == 2){
                
monety_gracza[id] -= 2
                
switch(random_num(1,2)){
                    case 
1:{
                        
monety_gracza[id] += 4
                        ColorChat
(idGREEN"Congratz, you won 4 moneys")
                        return 
PLUGIN_HANDLED
                    
}
                    case 
2:{
                        
monety_gracza[id] += Pozo[id]
                        
Pozo[id] = 0
                        ColorChat
(idGREEN"Congratz, you won the BIG PRIZE")
                        return 
PLUGIN_HANDLED
                    
}
                }
            }
        }
        case 
1:{
            if(
monety_gracza[id] < 4){
                
ColorChat(idGREEN"Not enough money")
                return 
PLUGIN_HANDLED
            
}
            
randonrandom_num(12)
            
ColorChat(idGREEN"Sad, you lost your bet and was send into the betting pool")
            
Pozo[id]  += 4
            monety_gracza
[id] -= 4
            
if(randon == 2){
                
monety_gracza[id] -= 4
                
switch(random_num(1,2)){
                    case 
1:{
                        
monety_gracza[id] += 8
                        ColorChat
(idGREEN"Congratz, you won 4 Moneys")
                        return 
PLUGIN_HANDLED
                    
}
                    case 
2:{
                        
monety_gracza[id] += Pozo[id]
                        
Pozo[id] = 0
                        ColorChat
(idGREEN"Congratz, you won the BIG PRIZE!")
                        return 
PLUGIN_HANDLED
                    
}
                }
            }
        }
    }
    return 
PLUGIN_HANDLED


It doesnt work like intended, like Bet 4 then you won, but you won 4 again = No profit
Sometimes if you bet, you can lose and win at the same time.
And i need to know how to add a formatex or a HUD that show whats the current bet pool (Amount of coins lost between all players (BIG PRIZE = Lost moneys between all players that have bet and lost their currency)


All times are GMT -4. The time now is 20:53.

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