Raised This Month: $ Target: $400
 0% 

Need code For plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 09-01-2013 , 17:20   Need code For plugin
Reply With Quote #1

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 is offline
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 09-02-2013 , 04:49   Re: Need code For plugin
Reply With Quote #2

No one ???
asdfdsdf is offline
HalfLife
Senior Member
Join Date: Aug 2013
Location: I'll tell you later ;)
Old 09-02-2013 , 05:14   Re: Need code For plugin
Reply With Quote #3

Do not BUMP until 2 weeks have passed.
__________________
If you need any help regarding your HL Server, PM me and I can help you
My Tutorials:
How to install and use your SQL Database using AMX Mod X Plugins
HalfLife is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 09-02-2013 , 12:02   Re: Need code For plugin
Reply With Quote #4

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.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 09-02-2013 at 12:04.
GuskiS is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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