Raised This Month: $ Target: $400
 0% 

help with adding


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
itoxicreal
Senior Member
Join Date: Jun 2018
Old 12-26-2021 , 16:26   help with adding
Reply With Quote #1

Hey can anyone help me add
zp_cs_set_user_money(id, zp_cs_get_user_money(id) + Values[value]);
zp_set_user_exp(id, zp_get_user_exp(id) + Exps[exp]);
in 1 line?

and edit the client print msg

client_print(id, print_chat, "[ZP] You have just received %d $ and %d exp, try again after map change!", Values[value]);


PHP Code:
#include <amxmodx>
#include <zombieplague>

new bool:g_HasMoneynEXP[33] = false;

new const 
GET_CSO[][] = {
    
    
"say /get",
    
"say_team /get"
}

new 
Values[6] = {

    
20000
    
35000,
    
45000,
    
50000,
    
60000,
    
100000
}
new 
Exps[6] = {

    
200
    
400,
    
600,
    
800,
    
1000,
    
1500
}

public 
plugin_init() {    
    
register_cvar("cso_get"VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)

    for (new 
isizeof GET_CSOi++)
    
register_clcmd(GET_CSO[i], "give_money_exp");
}

public 
plugin_natives()
{
    
register_native("zp_cs_get_user_money""_get_money"1)
    
register_native("zp_cs_set_user_money""native_set_money"1)
    
register_native("zp_get_user_exp""native_get_exp"1)
    
register_native("zp_set_user_exp""native_set_exp"1)
}

public 
give_money_exp(id) {
    
    if(
g_HasMoneynEXP[id]) {
        
client_print(idprint_chat"[CSO] Retry again after map changes to get more Money&Exp!");
        return 
PLUGIN_HANDLED;
    }
    
    new 
value random_num(20000100000)
    new 
exp random_num(2001500)
    
zp_cs_set_user_money(idzp_cs_get_user_money(id) + Values[value]);
    
zp_set_user_exp(idzp_get_user_exp(id) + Exps[exp]);
    
client_print(idprint_chat"[CSO]  You have just received %d $ and  exp, try again after map change!"Values[value], Exps[exp]);
    
g_HasMoneynEXP[id] = true;
    
    return 
PLUGIN_HANDLED;

itoxicreal is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-26-2021 , 16:28   Re: help with adding
Reply With Quote #2

I don't understand what you mean by that.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
itoxicreal
Senior Member
Join Date: Jun 2018
Old 12-26-2021 , 18:19   Re: help with adding
Reply With Quote #3

the plugin dosent work and those things are causing it, so if someone can fix it, it would mean alot
itoxicreal is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 12-26-2021 , 18:52   Re: help with adding
Reply With Quote #4

Quote:
Originally Posted by itoxicreal View Post
the plugin dosent work and those things are causing it, so if someone can fix it, it would mean alot
Create the natives ex: native zp_cs_get_user_money( id ), native zp_cs_set_user_money( id, amount )
Code:
public plugin_natives() {     register_native("zp_cs_get_user_money", "_get_money", 1)     register_native("zp_cs_set_user_money", "native_set_money", 1)     register_native("zp_get_user_exp", "native_get_exp", 1)     register_native("zp_set_user_exp", "native_set_exp", 1) } public give_money_exp(id) {         if(g_HasMoneynEXP[id]) {         client_print(id, print_chat, "[CSO] Retry again after map changes to get more Money&Exp!");         return PLUGIN_HANDLED;     }         new value = random_num(20000, 100000)     new exp = random_num(200, 1500)  it is not possible to use native from register     zp_cs_set_user_money(id, zp_cs_get_user_money(id) + Values[value]);     zp_set_user_exp(id, zp_get_user_exp(id) + Exps[exp]);     client_print(id, print_chat, "[CSO]  You have just received %d $ and  exp, try again after map change!", Values[value], Exps[exp]);     g_HasMoneynEXP[id] = true;         return PLUGIN_HANDLED; }

Show "_get_money" function

Edit: if the plugin already has these native or include then no one can help you without see the full code
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 12-26-2021 at 18:56.
Supremache is offline
itoxicreal
Senior Member
Join Date: Jun 2018
Old 12-28-2021 , 15:06   Re: help with adding
Reply With Quote #5

sorry the natives weren't meant to be there


PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <zp_buys>

new bool:g_HasMoneynEXP[33] = false;

new const 
GET_CSO[][] = {
    
    
"say /get",
    
"say_team /get"
}

new 
Values[6] = {

    
20000
    
35000,
    
45000,
    
50000,
    
60000,
    
100000
}
new 
Exps[6] = {

    
200
    
400,
    
600,
    
800,
    
1000,
    
1500
}

public 
plugin_init() {    
    
register_cvar("cso_get"VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)

    for (new 
isizeof GET_CSOi++)
    
register_clcmd(GET_CSO[i], "give_money_exp");
}

public 
give_money_exp(id) {
    
    if(
g_HasMoneynEXP[id]) {
        
client_print(idprint_chat"[CSO] Retry again after map changes to get more Money&Exp!");
        return 
PLUGIN_HANDLED;
    }
    
    new 
value random_num(20000100000)
    new 
exp random_num(2001500)
    
zp_cs_set_user_money(idzp_cs_get_user_money(id) + Values[value]);
    
zp_set_user_exp(idzp_get_user_exp(id) + Exps[exp]);
    
client_print(idprint_chat"[CSO]  You have just received %d $ and  exp, try again after map change!"Values[value], Exps[exp]);
    
g_HasMoneynEXP[id] = true;
    
    return 
PLUGIN_HANDLED;

plugin compiles fine but when I use it the console says (debug is enabled but it says enable still)

[AMXX] Run time error 19 (plugin "zp_get.amxx") - debug not enabled!
L 12/28/2021 - 15:053: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 12/28/2021 - 15:053: [AMXX] Run time error -1 (plugin "zp_get.amxx") - debug not enabled!
L 12/28/2021 - 15:053: An error occurred in plugin_natives. This is dangerous!
itoxicreal is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 12-28-2021 , 15:31   Re: help with adding
Reply With Quote #6

Enable debug and back with message logs or show the wrong in which line
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 12-28-2021 at 15:31.
Supremache is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 12-29-2021 , 09:17   Re: help with adding
Reply With Quote #7

Try this
zp_cs_set_user_money(id, zp_cs_get_user_money(id) + Values[random_num(0, sizeof(Values) - 1)])
bigdaddy424 is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 12-29-2021 , 11:18   Re: help with adding
Reply With Quote #8

@itoxicreal; the wrong was in the line of client_print, there are two values, "Values[value] & Exps[exp]" with just one field %d also you didn't use register_plugin !

PHP Code:
client_print(idprint_chat"[CSO]  You have just received %d $ and  exp, try again after map change!"Values[value], Exps[exp]); 
PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <zp_buys>

new bool:bReward33 ]

new const 
GET_CSO[ ][ ] = 
{
    
"say /get",
    
"say_team /get"
}

enum GetReward
{
    
Value,
    
Exp
}

new 
g_szReward[ ][ GetReward ] =
{
    { 
20000200 },
    { 
35000400 },
    { 
45000600 },
    { 
50000800 },
    { 
600001000 },
    { 
1000001500 }
}

public 
plugin_init( ) 
{    
    
register_plugin"Get random reward"VERSION"Supremache" );
    
    for (new 
isizeof GET_CSOi++)
        
register_clcmdGET_CSO[i], "GetReward" );
}

public 
GetRewardid 
{
    if( 
bRewardid ] ) 
    {
        
client_printidprint_chat"[CSO] Retry again after map changes to get more Money&Exp!" );
    }
    else
    {
        new 
iValue g_szRewardrandomsizeofg_szReward ) ) ][ Value 
        new 
iExp g_szRewardrandomsizeofg_szReward ) ) ][ Exp ]
        
zp_cs_set_user_moneyidzp_cs_get_user_money(id) + iValue );
        
zp_set_user_expidzp_get_user_exp(id) + iExp );
        
client_printidprint_chat"[CSO] You have just received $%d and %d exp, try again after map change!"iValueiExp );
        
bRewardid ] = true;
    }
    return 
PLUGIN_HANDLED;

__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 12-29-2021 at 16:25.
Supremache is offline
itoxicreal
Senior Member
Join Date: Jun 2018
Old 12-29-2021 , 15:09   Re: help with adding
Reply With Quote #9

Everything worked out fine, there was just a issue with the Exp giving 0 but i fixed it, I also added cromchat if anyone wanted here is the final version


PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <zp_buys>
#include <cromchat>

#define VERSION "1.0"
#define AUTHOR "unknown"

new bool:g_HasMoneynEXP[33] = false;

new const 
GET_CSO[ ][ ] = {
    
    
"say /get",
    
"say_team /get"
}

enum GetReward
{
    
Value
}

enum GetExp
{
    
Exp
}

new 
g_szReward[ ][GetReward] =
{
    
45000,
    
50000
    
60000,
    
100000
    
120000
    
200000
}
new 
g_szExp[ ][GetExp] =
{
    
500,
    
700
    
800,
    
900
    
1200
    
2000
}


public 
plugin_init( ) 
{    
    
register_plugin"cso_get"VERSION"Author" );
    
register_cvar("cso_get"VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)

    for (new 
isizeof GET_CSOi++)
        
register_clcmd(GET_CSO[i], "give_money_exp");
}

public 
give_money_exp(id) {
    
    if( 
g_HasMoneynEXPid ] ) 
    {
        
CC_SendMessage(id"&x07[CSO] Retry again after map changes to get more Money and Exp!");
        return 
PLUGIN_HANDLED;
    }
    
    new 
iValue g_szRewardrandomsizeofg_szReward ) ) ][ Value 
    new 
iExp g_szExprandomsizeofg_szExp ) ) ][ Exp ]
    
zp_cs_set_user_moneyidzp_cs_get_user_money(id) + iValue );
    
zp_set_user_exp(idzp_get_user_exp(id) + iExp );
    
CC_SendMessageid"&x04[CSO] You have just received $%d and %d exp, try again after map change!"iValueiExp );
    
g_HasMoneynEXPid ] = true;
    
    return 
PLUGIN_HANDLED;

itoxicreal is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 12-29-2021 , 16:20   Re: help with adding
Reply With Quote #10

Quote:
Originally Posted by itoxicreal View Post
Everything worked out fine, there was just a issue with the Exp giving 0 but i fixed it, I also added cromchat if anyone wanted here is the final version
Ops i forgot to add symbol '{' to the array, try it now
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 12-29-2021 at 16:20.
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 01:22.


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