Raised This Month: $ Target: $400
 0% 

Update user money


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tedaimlocks
Senior Member
Join Date: Jan 2024
Old 04-13-2024 , 14:23   Update user money
Reply With Quote #1

As the title says, can anyone help create a plugin to use a buymenu natives to update the money in score tab?

The natives are:
zp_cs_get_user_money(id)
zp_cs_set_user_money(id)

Pic of what i mean and smaller explaination
https://imgur.com/a/BLwG6dh

- Get user money using zp_cs_get_user_money(id) and set it in TAB using zp_cs_set_user_money(id)

Last edited by tedaimlocks; 04-13-2024 at 15:07.
tedaimlocks is offline
tedaimlocks
Senior Member
Join Date: Jan 2024
Old 04-14-2024 , 06:46   Re: Update user money
Reply With Quote #2

solved. for anyone who needs the plugin :

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

#define PLUGIN "Money convert"
#define VERSION "1.0"
#define AUTHOR "tedaimlocks"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
set_task(10.0"loop_client_putinserver"0""0"b");
}

public 
loop_client_putinserver()
{
    new 
id;
    for(
id 1id <= get_maxplayers(); id++)
    {
        if(
is_user_connected(id))
        {
            
client_putinserver(id);
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
client_putinserver(id) {
    if (!
is_user_connected(id) || is_user_bot(id))
        return 
PLUGIN_CONTINUE
   
    
cs_set_user_money(idzp_cs_get_user_money(id));
    return 
PLUGIN_HANDLED;


Last edited by tedaimlocks; 04-14-2024 at 08:29.
tedaimlocks is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 04-14-2024 , 09:01   Re: Update user money
Reply With Quote #3

Quote:
Originally Posted by tedaimlocks View Post
solved. for anyone who needs the plugin :

wtf
hi, I guess you're you are trying to restore the money to the player "only" when he connects to the server, this would be done once therefore it is not necessary to create an infinite loop since it recreates an overload to the server and more if it is a zp

for them we can make sure that the player has entered and chosen a team, and then give them the money.

It will be enough, try...

Code:
#include <amxmodx> #include <hamsandwich> #include <cstrike> #include <zp_buymenu> #if AMXX_VERSION_NUM > 182     #define client_disconnect client_disconnected #else     #define MAX_PLAYERS 32 #endif new bool:is_spawn[MAX_PLAYERS + 1] public plugin_precache() {     RegisterHam(Ham_Spawn, "player", "Ham_SpawnPlayer_Post", true) } public Ham_SpawnPlayer_Post(id) {     if( !is_spawn[id] && is_user_alive(id) )     {         is_spawn[id] = true                 cs_set_user_money(id, zp_cs_get_user_money(id))     } } public client_putinserver(id) {     if(is_user_bot(id))     {         is_spawn[id] = true     } } public client_disconnect(id) {     if(is_spawn[id])     {         is_spawn[id] = false     } }
__________________
mlibre is offline
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 22:01.


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