AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   round money help (https://forums.alliedmods.net/showthread.php?t=173889)

sylar02 12-12-2011 01:49

round money help
 
so here is what my plugin is suppose to do. when u join a server, it will give u 8000$ as start money. next, if you are ct and have less than 3500$, then it is suppose to set your money to 3500. so u can buy famas or stuff and arent completely broke. same goes for t side. if u have less than 3000 (t guns are less expensive) then plugin sets your money to 3000.

idea behind this plugin was to control awp whoring in my server (which is set to 16k, but give money to nub players incase if they are broke)

anyways, its having an issue where it gives money after 7-8 seconds. freeze time is 5 secs, and if i have less money, it gives me money to make purchases. but after i start walking around, it gives me money one more time. what am i doing wrong here?
sorry for nub mistakes if i made any, this is my first plugin

PHP Code:

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

//new MONEY;

public plugin_init()
{
    
register_plugin("better_money","0.1","sylar")
    
    
//MONEY = register_cvar("round_money","16000")
    
    /* Register LANG file */
    
register_dictionary("rmlang.txt")
    
    
//register_logevent("new_round", 2, "1=Round_Start")
    
register_event("HLTV""new_round""a")  

}
public 
new_round()
{
    new 
players[32], playerCountiplayerctMoneytMoneyuserTeam;
    
//pMoney = get_pcvar_num(MONEY)
    
ctMoney 3500
    tMoney 
3000
    
    get_players
(players,playerCount);
    
    for(
i=0;i<playerCount;i++)
    {
        
player players[i];
        
userTeam get_user_team(player);
        if((
userTeam == 2) && (userTeam != 1||3||0) && (cs_get_user_money(player) < 3500))
        {
            
cs_set_user_money(playerctMoney);
            
client_print(player,print_chat,"%L",LANG_PLAYER,"MONEY_AMOUNT",ctMoney)
        }
        
        else if((
userTeam == 1) && (userTeam != 0||2||3) && (cs_get_user_money(player) < 3000))
        {
            
cs_set_user_money(playertMoney);
            
client_print(player,print_chat,"%L",LANG_PLAYER,"MONEY_AMOUNT",tMoney)
        }
        
    } 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 

based on this plugin http://forums.alliedmods.net/showthread.php?p=221246

sylar02 12-13-2011 18:58

Re: round money help
 
can somebody help me?

ConnorMcLeod 12-14-2011 00:51

Re: round money help
 
It should be due to another plugin.
Also it would be better to use player spawn so you are sure to retrieve the real team and you don't have to loop through all players.


(userTeam == 2) && (userTeam != 1||3||0)

LoL :mrgreen::mrgreen::mrgreen:

sylar02 12-14-2011 02:14

Re: round money help
 
could u elaborate on player spawn, like what it is and a sample code snippet.

also what should be return type here.

i tried your suggestion and put return type as plugin_handled incase something is messing it up.(http://forums.alliedmods.net/showthread.php?t=10493). now, it would give me money in the end round for some reason.

for instance, lets say ts win the round. and there is message and sound saying terrorist win. and there is a delay of about 1-2 secs till new round begins.

it gave me money after the terrorist win sound came, and before new round started.

and i dont think there are any other plugins that would cause an error

Code:

name version author file status
[ 1] Advanced Bans 0.8 Exolent advanced_bans_s running
[ 2] [CSAC]CrossServerAdmin 2.0.3 KoST amx_need.amxx running
[ 3] Admin Base 1.8.1.3746 AMXX Dev Team admin.amxx running
[ 4] Admin Commands 1.8.1.3746 AMXX Dev Team admincmd.amxx running
[ 5] Admin Help 1.8.1.3746 AMXX Dev Team adminhelp.amxx running
[ 6] Menus Front-End 1.8.1.3746 AMXX Dev Team menufront.amxx running
[ 7] Players Menu 1.8.1.3746 AMXX Dev Team plmenu.amxx running
[ 8] Admin Chat 1.8.1.3746 AMXX Dev Team adminchat.amxx running
[ 9] Anti Flood 1.8.1.3746 AMXX Dev Team antiflood.amxx running
[ 10] Admin Votes 1.8.1.3746 AMXX Dev Team adminvote.amxx running
[ 11] Nextmap Chooser 1.8.1.3746 AMXX Dev Team mapchooser.amxx running
[ 12] TimeLeft 1.8.1.3746 AMXX Dev Team timeleft.amxx running
[ 13] Pause Plugins 1.8.1.3746 AMXX Dev Team pausecfg.amxx running
[ 14] Stats Configuration 1.8.1.3746 AMXX Dev Team statscfg.amxx running
[ 15] Restrict Weapons 1.8.1.3746 AMXX Dev Team restmenu.amxx running
[ 16] StatsX 1.8.1.3746 AMXX Dev Team statsx.amxx running
[ 17] Autoresponder/Advertis 0.5 MaximusBrood ad_manager.amxx running
[ 18] AMX Super 4.2 Bmann_420 amx_super.amxx running
[ 19] round_money 0.7 SweatyBanana round_money.amx running
[ 20] xREDIRECT 1.0.3.3 x0R xredirect.amxx running
20 plugins, 20 running


ConnorMcLeod 12-14-2011 02:36

Re: round money help
 
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

public plugin_init()
{
    
register_plugin("better_money","0.1","sylar")

    
/* Register LANG file */
    
register_dictionary("rmlang.txt")

    
RegisterHam(Ham_Spawn"player""CBasePlayer_Spawn_Post"true)
}

public 
CBasePlayer_Spawn_Postid )
{
    if( 
is_user_alive(id) )
    {
        new 
iMinMoney cs_get_user_team(id) == CS_TEAM_T 3000 3500
        
if( cs_get_user_money(id) < iMinMoney )
        {
            
cs_set_user_money(idiMinMoney)
            
client_print(idprint_chat"%L"id"MONEY_AMOUNT"iMinMoney)
        }
    }




All times are GMT -4. The time now is 12:06.

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