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 i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) > 1)
{
the_money[num_players] = i;
num_players++;
}
}
SortCustom1D(the_money, num_players, SortMoney);
new String:player_name[64];
new String:player_money[10];
new String:has_weapon[1];
new pri_weapon;
// display team players money
for (new i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) > 1)
{
PrintToChat(i, "\x01 \x03 Team Money");
}
for (new x = 0; x < num_players; x++)
{
GetClientName(the_money[x], player_name, sizeof(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_money, sizeof(player_money));
PrintToChat(i, "\x01$%s \x04%s> \x03%s", player_money, has_weapon, player_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(OldMoney, String:NewMoney[], size)
{
new String:Temp[32];
new String:OldMoneyStr[32];
new tempChar;
new RealLen = 0;
IntToString(OldMoney, OldMoneyStr, sizeof(OldMoneyStr));
for (new i = strlen(OldMoneyStr) - 1; i >= 0; i--)
{
if (RealLen % 3 == 0 && RealLen != strlen(OldMoneyStr) && i != strlen(OldMoneyStr)-1)
{
tempChar = OldMoneyStr[i];
Format(Temp, sizeof(Temp), "%s,%s", tempChar, Temp);
}
else
{
tempChar = OldMoneyStr[i];
Format(Temp, sizeof(Temp), "%s%s", tempChar, Temp);
}
RealLen++;
}
Format(NewMoney, size, "%s", Temp);
}
public SortMoney(elem1, elem2, const array[], Handle:hndl)
{
new money1 = GetEntData(elem1, g_iAccount);
new money2 = GetEntData(elem2, g_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.
__________________