AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need code For plugin (https://forums.alliedmods.net/showthread.php?t=225192)

asdfdsdf 09-01-2013 17:20

Need code For plugin
 
HEllo i need someone that can help me adding in this code its from a jailbreakshop so they only can gamble 5time per 10min because otherwise it gets spammed if someone can help me grtz heres the code

PHP Code:

public handle_gamble(id) {
    static 
arg[10];
    
read_argv(1argcharsmax(arg));
    
    if( !
strlen(arg) || str_to_num(arg) < 200 
    {
        
client_print(idprint_console"%s That amount wont work, min. 200$"TAG)
        return 
PLUGIN_HANDLED
    
}
    new 
Num str_to_num(arg)
    if(
g_Cash[id] < Num) {
        
client_print(idprint_console"%s Sorry You dont have that amount of jbcash"TAG)
        return 
PLUGIN_HANDLED
    
}
    
    
/* Start the game */
    
JbShop_GameRTD(idNum)
    return 
PLUGIN_HANDLED;
}
public 
JbShop_GameRTD(idcash)
{
    if(
is_user_connected(id))
    {
        new 
Number random_num(1100
        
        new 
strName[32]
        
get_user_name(idstrName31)
        
        if(
Number <= 35)
        {
            
client_print(idprint_console"%s You won %i$."TAGcash)
            
            if(
cash >= 15000)
            {
                
ColorChat(0GREY"^4%s^3 %s^1 gamble^3 %i^1 and won."TAGstrNamecash)
            }
            
            
g_Cash[id] += cash;
            
        }
        else
        {
            
client_print(idprint_console"%s You lost %i$."TAGcash)
            
            if(
cash >= 15000)
            {
                
ColorChat(0GREY"^4%s^3 %s^1 gamble^3 %i^1 and lost."TAGstrNamecash)
            }
            
            
g_Cash[id] -= cash;
        }
        
Save(id)
    }



asdfdsdf 09-02-2013 04:49

Re: Need code For plugin
 
No one ???

HalfLife 09-02-2013 05:14

Re: Need code For plugin
 
Do not BUMP until 2 weeks have passed.

GuskiS 09-02-2013 12:02

Re: Need code For plugin
 
Make an array g_times[33], make it +1 everytime you call gamble, check if g_times is smaller than 6 and execute gamble, else set_task to reset it to 0.
EDIT: Also, check if !task_exists and only after that execute set_task.


All times are GMT -4. The time now is 19:11.

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