Raised This Month: $77 Target: $400
 19% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
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");
}
__________________
Accepting private work. Contact me if you're interested.
If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.

Total Donated: 10$

Last edited by eyal282; 04-16-2019 at 11:14.
eyal282 is offline
Ilusion9
Senior Member
Join Date: Jun 2018
Location: Romania
Old 03-24-2019 , 16:46   Re: [CS:GO] Setting money ( the only way possible )
Reply With Quote #2

PHP Code:
mp_backup_round_auto 0 
Try with this cvar on 0.
__________________
Ilusion9 is online now
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-25-2019 , 11:31   Re: [CS:GO] Setting money ( the only way possible )
Reply With Quote #3

Quote:
Originally Posted by Ilusion9 View Post
PHP Code:
mp_backup_round_auto 0 
Try with this cvar on 0.
"mp_backup_round_auto" = "1" game - If enabled will keep in-memory backups to handle reconnecting players even if th

Not a chance this way is better, it stops the players from having their money saved when disconnecting.
__________________
Accepting private work. Contact me if you're interested.
If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.

Total Donated: 10$
eyal282 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 03-26-2019 , 11:25   Re: [CS:GO] Setting money ( the only way possible )
Reply With Quote #4

Spawning the entity without checking if it's created is a bad idea... why didn't you check if moneyEntity actually points to an entity?
TheDS1337 is offline
Send a message via MSN to TheDS1337
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-26-2019 , 17:24   Re: [CS:GO] Setting money ( the only way possible )
Reply With Quote #5

Quote:
Originally Posted by TheDS1337 View Post
Spawning the entity without checking if it's created is a bad idea... why didn't you check if moneyEntity actually points to an entity?
Why would creating the entity even fail?
__________________
Accepting private work. Contact me if you're interested.
If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.

Total Donated: 10$
eyal282 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 03-26-2019 , 20:57   Re: [CS:GO] Setting money ( the only way possible )
Reply With Quote #6

Quote:
Originally Posted by eyal282 View Post
Why would creating the entity even fail?
Very unlikely, but also a good habit
TheDS1337 is offline
Send a message via MSN to TheDS1337
eyal282
Veteran Member
Join Date: Aug 2011
Old 04-03-2019 , 09:05   Re: [CS:GO] Setting money ( the only way possible )
Reply With Quote #7

Stock is now better.
__________________
Accepting private work. Contact me if you're interested.
If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.

Total Donated: 10$
eyal282 is offline
gubka
Veteran Member
Join Date: Jan 2012
Location: Dublin
Old 04-03-2019 , 09:17   Re: [CS:GO] Setting money ( the only way possible )
Reply With Quote #8

Quote:
Originally Posted by eyal282 View Post
Stock is now better.
That should be faster, because why use checking the FindEntityByClassname when it faster to create new and delete it
PHP Code:
stock SetClientMoney(clientmoney)
{
    
SetEntProp(clientProp_Send"m_iAccount"money);

    
int entity CreateEntityByName("game_money");
    if(
entity != INVALID_ENT_REFERENCE)
    {
        
DispatchKeyValue(entity"AwardText""");
    
        
DispatchSpawn(entity);

        
SetVariantInt(0);
        
AcceptEntityInput(entity"SetMoneyAmount");
        
        
SetVariantInt(client);
        
AcceptEntityInput(entity"AddMoneyPlayer");
        
        
AcceptEntityInput(entity"Kill");
        
        return 
true;
    }

    return 
false;

and i never had issue with giving money by the
Quote:
/**
* @brief Sets the money on a client.
*
* @param clientIndex The client index.
* @param iMoney The money amount.
**/
void AccountSetMoney(int clientIndex, int iMoney)
{
SetEntData(clientIndex, g_iOffset_PlayerAccount, iMoney, _, true);
}
__________________

Last edited by gubka; 04-03-2019 at 09:19.
gubka is offline
Send a message via ICQ to gubka Send a message via Skype™ to gubka
eyal282
Veteran Member
Join Date: Aug 2011
Old 04-04-2019 , 07:29   Re: [CS:GO] Setting money ( the only way possible )
Reply With Quote #9

Quote:
Originally Posted by gubka View Post
That should be faster, because why use checking the FindEntityByClassname when it faster to create new and delete it
PHP Code:
stock SetClientMoney(clientmoney)
{
    
SetEntProp(clientProp_Send"m_iAccount"money);

    
int entity CreateEntityByName("game_money");
    if(
entity != INVALID_ENT_REFERENCE)
    {
        
DispatchKeyValue(entity"AwardText""");
    
        
DispatchSpawn(entity);

        
SetVariantInt(0);
        
AcceptEntityInput(entity"SetMoneyAmount");
        
        
SetVariantInt(client);
        
AcceptEntityInput(entity"AddMoneyPlayer");
        
        
AcceptEntityInput(entity"Kill");
        
        return 
true;
    }

    return 
false;

and i never had issue with giving money by the
Argue with everything I said in the video. If you can do what it claims you can't sure whatever.

Forgot to say, you can also find the game data for the task. I don't know anything about gamedatas and I know they occasionally require updates and this isn't L4D2, every two weeks there's an update.
__________________
Accepting private work. Contact me if you're interested.
If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.

Total Donated: 10$

Last edited by eyal282; 04-04-2019 at 07:50.
eyal282 is offline
Ilusion9
Senior Member
Join Date: Jun 2018
Location: Romania
Old 04-04-2019 , 08:13   Re: [CS:GO] Setting money ( the only way possible )
Reply With Quote #10

PHP Code:

        SetVariantInt
(0);
        
AcceptEntityInput(entity"SetMoneyAmount");
        
        
SetVariantInt(client);
        
AcceptEntityInput(entity"AddMoneyPlayer"
So, these "SetVariantInt"s works for you?
__________________
Ilusion9 is online now
Reply


Thread Tools
Display Modes

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 07:17.


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