Raised This Month: $51 Target: $400
 12% 

[CS:GO] Setting money ( the only way possible )


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-24-2019 , 10:20   [CS:GO] Setting money ( the only way possible )
Reply With Quote #1

If you're about to hit me with: "SetEntProp(client, Prop_Send, "m_iAccount", money);", I'll hit you with this video, proving it will never work unless you rek a nob, or grab a hostage, forcing your money to update.

https://youtu.be/VRGWWNEcmgo

Additional Info:

The plugin used to give 3000$ on VIP evacuation replicates it completely. You cannot do anything similar to that without Sourcemod.

Using this snippet in CS:S uses the regular method to set money, except the stock will always return false in CS:S

Useful Commands will soon have this snippet ( !money is from Useful Commands ) but right now and during testing it didn't.

The snippet is used to properly set cash, basically giving the player 0 money and forcing it to update. Set the cash in the traditional way and use RefreshMoney to force it to refresh. Please note that using any refresh function more than once in a single function / frame can be dangerous and fail the refresh.

Code:

/**
 * Gives a client a weapon and ammo for that weapon.
 *
 * @param client		Client Index.
 * @param money			Amount of money to give to the Client.
 
 * @noreturn.
 */
stock bool SetClientMoney(int client, int money)
{
	SetEntProp(client, Prop_Send, "m_iAccount", money);
}

/**
 * Forces a money refresh on a certain number of clients. Please limit to once per function / frame / 0.1 seconds or whatever.
 *
 * @param clients		Array holding the client indexes.
 * @param numClients	Number of clients inside the array
 
 * @return				true if money was successfully refreshed, false if failed to refresh. If this is used in CS:S or any other game, will always return false.
 
 */
stock bool RefreshMoney(int clients[], int numClients)
{	
	int moneyEntity = CreateEntityByName("game_money");
	
	if(moneyEntity == -1)
		return false;

	DispatchKeyValue(moneyEntity, "Award Text", "");
	
	DispatchSpawn(moneyEntity);
	
	AcceptEntityInput(moneyEntity, "SetMoneyAmount 0");

	
	for(inti=0;i < numClients;i++)
		AcceptEntityInput(moneyEntity, "AddMoneyPlayer", clients[i]);
		
		
	AcceptEntityInput(moneyEntity, "Kill");
	
	return true;
}

/**
 * Forces a money refresh on a certain number on a client. Never use this twice or more in a row, instead go to the function RefreshMoney to refresh as many players as you like at once.
 *
 * @param client		Client index to refresh money.
 
 * @return				true if money was successfully refreshed, false if failed to refresh. If this is used in CS:S or any other game, will always return false.
 
 */
stock bool RefreshClientMoney(int client)
{	
	int clients[1];
	clients[0] = client;
	
	return RefreshMoney(client, 1);
}

/**
 * Forces a money refresh on all clients.
 
 * @return				true if money was successfully refreshed, false if failed to refresh. If this is used in CS:S or any other game, will always return false.
 
 */
 
stock bool RefreshAllClientsMoney()
{	
	int clients[MAXPLAYERS+1], num;
	
	for(int i=1;i <= MaxClients;i++)
	{
		if(!IsClientInGame(i))
			continue;
			
		clients[num] = i;
		num++
	}
	
	return RefreshMoney(clients, num);
}

stock int GetClientMoney(client)
{
	return GetEntProp(client, Prop_Send, "m_iAccount");
}
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 04-16-2019 at 11:14.
eyal282 is offline
 



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 09:42.


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