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

Solved Remain as the money when sv_restart.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ZombieTheMan01
Senior Member
Join Date: Aug 2015
Location: Turkey
Old 06-29-2016 , 12:16   Remain as the money when sv_restart.
Reply With Quote #1

Hello guys. I want to keep my money as well as 'sv_restart' writing the server. But I always go according to mp_startmoney dealing it. If guys can make that will, Thanks in advance.
EDIT: Sorry, My English is bad for writing Google Translate.

Last edited by ZombieTheMan01; 06-16-2017 at 15:30.
ZombieTheMan01 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 06-29-2016 , 15:46   Re: Remain as the money when sv_restart.
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?p=221246
mlibre is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-29-2016 , 15:51   Re: Remain as the money when sv_restart.
Reply With Quote #3

If you want to set to player ammount of money which he had before sv_restart then here u go:

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>

new g_money[33];

public 
plugin_init(){
    
    
register_plugin("Money Save On Restart""1.0""siriusmd99");
    
register_event("TextMsg""hook_restart""a""2=#Game_Commencing""2=#Game_will_restart_in");
    
register_logevent("set_bool_to_false"2"1=Round_End"); 
    
RegisterHam(Ham_Spawn"player""set_player_money"); 
}

public 
hook_restart()
{
    for(new 
id 1id <= get_maxplayers(); id++)
    {
        if(
is_user_connected(id) && !is_user_bot(id))
            
g_money[id] = cs_get_user_money(id);
    }
    
g_money[0] = 1;
}

public 
set_player_money(id)
{
    if(
g_money[0])
    {
        if(!
is_user_bot(id))
        {
            new 
tmp g_money[id];
            if(
tmp)
            {
                
cs_set_user_money(idtmp0);
            }
        }      
    }
}

public 
set_bool_to_false()
    
g_money[0] = 0;

public 
client_disconnect(id)
    
g_money[id] = 0;

public 
client_connect(id)    
    
g_money[id] = 0
P.S. If you want i can make it not set previous ammount if it is smaller then mp_startmoney I just don't know your intention to use it.
siriusmd99 is offline
ZombieTheMan01
Senior Member
Join Date: Aug 2015
Location: Turkey
Old 06-30-2016 , 08:36   Re: Remain as the money when sv_restart.
Reply With Quote #4

Quote:
Originally Posted by mlibre View Post
No. It's not exactly the case.
ZombieTheMan01 is offline
ZombieTheMan01
Senior Member
Join Date: Aug 2015
Location: Turkey
Old 06-30-2016 , 08:37   Re: Remain as the money when sv_restart.
Reply With Quote #5

Quote:
Originally Posted by siriusmd99 View Post
If you want to set to player ammount of money which he had before sv_restart then here u go:

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>

new g_money[33];

public 
plugin_init(){
    
    
register_plugin("Money Save On Restart""1.0""siriusmd99");
    
register_event("TextMsg""hook_restart""a""2=#Game_Commencing""2=#Game_will_restart_in");
    
register_logevent("set_bool_to_false"2"1=Round_End"); 
    
RegisterHam(Ham_Spawn"player""set_player_money"); 
}

public 
hook_restart()
{
    for(new 
id 1id <= get_maxplayers(); id++)
    {
        if(
is_user_connected(id) && !is_user_bot(id))
            
g_money[id] = cs_get_user_money(id);
    }
    
g_money[0] = 1;
}

public 
set_player_money(id)
{
    if(
g_money[0])
    {
        if(!
is_user_bot(id))
        {
            new 
tmp g_money[id];
            if(
tmp)
            {
                
cs_set_user_money(idtmp0);
            }
        }      
    }
}

public 
set_bool_to_false()
    
g_money[0] = 0;

public 
client_disconnect(id)
    
g_money[id] = 0;

public 
client_connect(id)    
    
g_money[id] = 0
P.S. If you want i can make it not set previous ammount if it is smaller then mp_startmoney I just don't know your intention to use it.
Yeah. This is what I was looking for. Thank you so much.
ZombieTheMan01 is offline
Reply



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 08:40.


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