AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   give money at some interval (https://forums.alliedmods.net/showthread.php?t=141348)

am_amx 10-23-2010 02:13

give money at some interval
 
hi
in my server every round is for 2.0 minutes, i don't want to give money at round begin instead once every 7-8 mins .how can i modify this

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

new MONEY;

public 
plugin_init()
{
    
register_plugin("round_money","0.7","SweatyBanana")
    
    
MONEY register_cvar("round_money","16000")
    
    
/* Register LANG file */
    
register_dictionary("rmlang.txt")
    
    
register_logevent("new_round"2"1=Round_Start")
}
public 
new_round()
{
    new 
players[32], playerCountiplayerpMoney;
    
pMoney get_pcvar_num(MONEY)
    
    
get_players(players,playerCount);
    
    for(
i=0;i<playerCount;i++)
    {
        
player players[i];
        if(
cs_get_user_money(player) < pMoney)
        {
            
cs_set_user_money(playerpMoney);
            
client_print(player,print_chat,"%L",LANG_PLAYER,"MONEY_AMOUNT",pMoney)
        }
    } 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 


SaM.ThE.MaN 10-23-2010 03:12

Re: give money at some interval
 
Did you try using set_task?

am_amx 10-23-2010 03:32

Re: give money at some interval
 
Quote:

Originally Posted by SaM.ThE.MaN (Post 1332124)
Did you try using set_task?

thanx will try it

i'm getting money only once why?

PHP Code:

#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 

new MONEY

public 
plugin_init() 

    
register_plugin("round_money","0.7","SweatyBanana"
     
    
MONEY register_cvar("round_money","16000"
     
    
/* Register LANG file */ 
    //register_dictionary("rmlang.txt") 
     //register_logevent("new_round", 2, "1=Round_Start") 
     
set_task(40.0,"new_round",2,"b");

public 
new_round() 

    new 
players[32], playerCountiplayerpMoney
    
pMoney get_pcvar_num(MONEY
     
    
get_players(players,playerCount); 
     
    for(
i=0;i<playerCount;i++) 
    { 
        
player players[i]; 
        if(
cs_get_user_money(player) < pMoney
        { 
            
cs_set_user_money(playerpMoney); 
            
//client_print(player,print_chat,"%L",LANG_PLAYER,"MONEY_AMOUNT",pMoney) 
        

    }  



Moe 10-23-2010 22:24

Re: give money at some interval
 
The task is only done once. So once the plugin iniciates and finishes that one time then it assumes its done. Loop it.

fysiks 10-23-2010 22:28

Re: give money at some interval
 
See set_task()

am_amx 10-24-2010 00:23

Re: give money at some interval
 
Quote:

Originally Posted by Moe (Post 1332717)
The task is only done once. So once the plugin iniciates and finishes that one time then it assumes its done. Loop it.

set_task(40.0,"new_round",2,"b");

b=loop task infinitely .

but players get money once

fysiks 10-24-2010 01:23

Re: give money at some interval
 
Quote:

Originally Posted by am_amx (Post 1332747)
set_task(40.0,"new_round",2,"b");

b=loop task infinitely .

but players get money once

Did you happen to notice my post?

Hint: Counter your arguments.

am_amx 10-24-2010 02:00

Re: give money at some interval
 
Quote:

Originally Posted by fysiks (Post 1332775)
Did you happen to notice my post?

no,
@hint :you mean this?
set_task(180.0,"new_round",2,"",0,"b");

after this i'm able to get money every3 mins :P


http://4.bp.blogspot.com/_r1dFyemAxm.../thank-you.jpg


thank you for your replies SaM.ThE.MaN ,Moefysiks

fysiks 10-24-2010 17:23

Re: give money at some interval
 
What do you think the 2 is for?

am_amx 10-25-2010 07:03

Re: give money at some interval
 
Quote:

Originally Posted by fysiks (Post 1333327)
What do you think the 2 is for?

id - A unique id to assign to the task.

without that i couldn't compile the sma got some errors


All times are GMT -4. The time now is 10:26.

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