View Single Post
versatile_bfg
Veteran Member
Join Date: Feb 2012
Old 07-15-2014 , 00:33   Re: [CS:GO] Pug Setup (v1.0.0, 2014-7-13)
Reply With Quote #5

Here is the code I used with warmod and this round money plugin.

You don't have to use it but if you wanted to add it you can. =)

Does money on event round_start:

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <cstrike>

// Offsets
new g_iAccount = -1;

public 
Plugin:myinfo = {
    
name "Round Money [BFG]",
    
author "Versatile_BFG",
    
description "Displays team's money on round start",
    
version "0.1",
    
url "www.sourcemod.net"
};

public 
OnPluginStart()
{
    
HookEvent("round_start"Event_Round_Start);
    
g_iAccount FindSendPropOffs("CCSPlayer""m_iAccount");
}

public 
Event_Round_Start(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
the_money[MAXPLAYERS 1];
    new 
num_players;
    
    
// sort by money
    
for (new 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) > 1)
        {
            
the_money[num_players] = i;
            
num_players++;
        }
    }
    
    
SortCustom1D(the_moneynum_playersSortMoney);
    
    new 
String:player_name[64];
    new 
String:player_money[10];
    new 
String:has_weapon[1];
    new 
pri_weapon;
    
    
// display team players money
    
for (new 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) > 1)
        {
            
PrintToChat(i"\x01 \x03 Team Money");
        }
        for (new 
0num_playersx++)
        {
            
GetClientName(the_money[x], player_namesizeof(player_name));
            if (
IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == GetClientTeam(the_money[x]))
            {
                
pri_weapon GetPlayerWeaponSlot(the_money[x], 0);
                if (
pri_weapon == -1)
                {
                    
has_weapon ">";
                }
                else
                {
                    
has_weapon "\0";
                }
                
IntToMoney(GetEntData(the_money[x], g_iAccount), player_moneysizeof(player_money));
                
PrintToChat(i"\x01$%s \x04%s> \x03%s"player_moneyhas_weaponplayer_name);
            }
        }
    }
}

/**
 *  get the comma'd string version of an integer
 * 
 * @param  OldMoney            the integer to convert
 * @param  String:NewMoney    the buffer to save the string in
 * @param  size                the size of the buffer
 * @noreturn
 */

stock IntToMoney(OldMoneyString:NewMoney[], size)
{
    new 
String:Temp[32];
    new 
String:OldMoneyStr[32];
    new 
tempChar;
    new 
RealLen 0;

    
IntToString(OldMoneyOldMoneyStrsizeof(OldMoneyStr));

    for (new 
strlen(OldMoneyStr) - 1>= 0i--)
    {
        if (
RealLen == && RealLen != strlen(OldMoneyStr) && != strlen(OldMoneyStr)-1)
        {
            
tempChar OldMoneyStr[i];
            
Format(Tempsizeof(Temp), "%s,%s"tempCharTemp);
        }
        else
        {
            
tempChar OldMoneyStr[i];
            
Format(Tempsizeof(Temp), "%s%s"tempCharTemp);
        }
        
RealLen++;
    }
    
Format(NewMoneysize"%s"Temp);
}

public 
SortMoney(elem1elem2, const array[], Handle:hndl)
{
    new 
money1 GetEntData(elem1g_iAccount);
    new 
money2 GetEntData(elem2g_iAccount);
    
    if (
money1 money2)
    {
        return -
1;
    }
    else if (
money1 == money2)
    {
        return 
0;
    }
    else
    {
        return 
1;
    }

Could be an easier way to do it. I was done by 1260 with his original GameTech Warmod.
__________________

Last edited by versatile_bfg; 07-15-2014 at 00:34.
versatile_bfg is offline