Raised This Month: $ Target: $400
 0% 

Spawnmoney jctf


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yagami
Senior Member
Join Date: Jan 2021
Old 06-11-2022 , 17:49   Spawnmoney jctf
Reply With Quote #1

Good night I'll try to explain as best I can I'm using JCTF by Digi plugin
in it I made a config like this

Admin starts with 3000 and players with 2000


Code:
pCvar_adm_startmoney = MONEY ADMIN
pCvar_mp_startmoney = MONEY PLAYER
when ADMIN/PLAYER dies without spending anything he comes back with money that was set for him + BONUS SPAWNMONEY but this is not happening

PHP Code:
if(g_bFirstSpawn[id] || g_bRestarted[id])
    {
        
g_bRestarted[id] = false
        g_bFirstSpawn
[id] = false


        
new iStartMoney = (is_user_admin(id) ? get_pcvar_num(pCvar_adm_startmoney) : get_pcvar_num(pCvar_mp_startmoney));
        if (
cs_get_user_money(id) < iStartMoney)
                
cs_set_user_money(idclamp(iStartMoneyget_pcvar_num(pCvar_mp_startmoney), 16000));
    
    }
    else if(
g_bSuicide[id])
    {
        
g_bSuicide[id] = false

        player_print
(idid"%L"id"SPAWN_NOMONEY")
    }
    else
    {

       
// SHOULD NOT THE SPAWN MONEY BONUS HERE?
        
new iStartMoney = (is_user_admin(id) ? get_pcvar_num(pCvar_adm_startmoney) : get_pcvar_num(pCvar_mp_startmoney));
        if (
cs_get_user_money(id) < iStartMoney)
              
cs_set_user_money(idclamp((iStartMoney get_pcvar_num(pCvar_ctf_spawnmoney)), get_pcvar_num(pCvar_mp_startmoney), 16000))
      }        

yagami is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-11-2022 , 19:08   Re: Spawnmoney jctf
Reply With Quote #2

cs_get_user_money( id ) + BONUS SPAWNMONEY
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
yagami
Senior Member
Join Date: Jan 2021
Old 06-11-2022 , 19:41   Re: Spawnmoney jctf
Reply With Quote #3

Quote:
Originally Posted by Supremache View Post
cs_get_user_money( id ) + BONUS SPAWNMONEY
PHP Code:
else
    {
        new 
iStartMoney = (is_user_admin(id) ? get_pcvar_num(pCvar_adm_startmoney) : get_pcvar_num(pCvar_mp_startmoney));
        
// if (cs_get_user_money(id) < iStartMoney)
          
cs_set_user_money(idclamp((iStartMoney get_pcvar_num(pCvar_ctf_spawnmoney)), get_pcvar_num(pCvar_mp_startmoney), 16000))
      }        

precisely this is where he gives money + bonus but I can't solve the problem
yagami is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-11-2022 , 21:41   Re: Spawnmoney jctf
Reply With Quote #4

You said in your request that you want to return the money to those who didn't spend it, so why are you still giving them the starter money, try adding their existing money to the spawn money.

PHP Code:
cs_set_user_money(idclamp(( cs_get_user_moneyid ) + get_pcvar_num(pCvar_ctf_spawnmoney)), get_pcvar_num(pCvar_mp_startmoney), 16000)) 
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
yagami
Senior Member
Join Date: Jan 2021
Old 06-12-2022 , 10:51   Re: Spawnmoney jctf
Reply With Quote #5

Quote:
Originally Posted by Supremache View Post
You said in your request that you want to return the money to those who didn't spend it, so why are you still giving them the starter money, try adding their existing money to the spawn money.

PHP Code:
cs_set_user_money(idclamp(( cs_get_user_moneyid ) + get_pcvar_num(pCvar_ctf_spawnmoney)), get_pcvar_num(pCvar_mp_startmoney), 16000)) 

Basically this, I want to give extra money to those who haven't spent anything
but there are two cvars there
pCvar_adm_startmoney = ADMIN/VIP MONEY
pCvar_mp_startmoney = PLAYER MONEY

PHP Code:
cs_set_user_money(idclamp(( cs_get_user_moneyid ) + get_pcvar_num(pCvar_ctf_spawnmoney)), get_pcvar_num(pCvar_mp_startmoney), 16000)) 
[/QUOTE] this code here would not be giving money only to players
yagami is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-12-2022 , 13:50   Re: Spawnmoney jctf
Reply With Quote #6

PHP Code:
if (cs_get_user_money(id) >= iStartMoney
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
yagami
Senior Member
Join Date: Jan 2021
Old 06-12-2022 , 16:03   Re: Spawnmoney jctf
Reply With Quote #7

Quote:
Originally Posted by Supremache View Post
PHP Code:
if (cs_get_user_money(id) >= iStartMoney

This here seems to work but now I have another problem when I spend my money it doesn't give me back the value I should have from the das cvars
yagami is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-12-2022 , 16:58   Re: Spawnmoney jctf
Reply With Quote #8

Quote:
Originally Posted by yagami View Post
This here seems to work but now I have another problem when I spend my money it doesn't give me back the value I should have from the das cvars
Replace
PHP Code:
cs_set_user_money(idclamp(( cs_get_user_moneyid ) + get_pcvar_num(pCvar_ctf_spawnmoney)), get_pcvar_num(pCvar_mp_startmoney), 16000)) 
With
PHP Code:
cs_set_user_money(idclamp(( iStartMoney get_pcvar_num(pCvar_ctf_spawnmoney)), get_pcvar_num(pCvar_mp_startmoney), 16000)) 
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
yagami
Senior Member
Join Date: Jan 2021
Old 06-12-2022 , 18:30   Re: Spawnmoney jctf
Reply With Quote #9

Quote:
Originally Posted by Supremache View Post
Replace
PHP Code:
cs_set_user_money(idclamp(( cs_get_user_moneyid ) + get_pcvar_num(pCvar_ctf_spawnmoney)), get_pcvar_num(pCvar_mp_startmoney), 16000)) 
With
PHP Code:
cs_set_user_money(idclamp(( iStartMoney get_pcvar_num(pCvar_ctf_spawnmoney)), get_pcvar_num(pCvar_mp_startmoney), 16000)) 

Still the same thing

Basically it's like this when I spend the money it doesn't return the value of the cvars

EXAMPLE

I have 2000(
HTML Code:
pCvar_mp_startmoney
)

oh I spent 1500 and I only got 500, I just died instead back with 2000, I'm coming back with 500
yagami is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-12-2022 , 20:37   Re: Spawnmoney jctf
Reply With Quote #10

I really dont understand you.
PHP Code:
if (cs_get_user_money(id) >= iStartMoney// If the player did not spend the money
{
// Your code
}
else 
// If the player has spent his money
{
// Your code

__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache 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 03:09.


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