Raised This Month: $ Target: $400
 0% 

[HELP]Need Help.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 03-31-2017 , 09:38   [HELP]Need Help.
Reply With Quote #1

Hi all.

I have created this code for my mod, but i have some problems like ( if i hit tamemates even if the firendlyfire is turned off i can get money and, the hud of the money doesn't work problley it show me 300000 the admin limit that i set, and it does stay stuck at there, so please can anyone tell me what i am doing wrong ?

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

#define    PLUGIN    "Money System"
#define    VERSION    "1.0"
#define    AUTHOR    "yas17sin"

#define ADMIN_ACCESS ADMIN_LEVEL_H

#define LIMIT 150000
#define LIMIT_ADMIN_VIP 300000

new players_menuplayers[32], numi
new accessmenuiName[64], callback

//new pcvar_dmg_money

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /give""transfer_menu"ADMIN_ALL"")    // transfer money
    
register_clcmd("say /donate""transfer_menu"ADMIN_ALL"")
    
register_clcmd("say_team /donate""transfer_menu"ADMIN_ALL"")
    
register_clcmd("say_team /give""transfer_menu"ADMIN_ALL"")
    
    
register_clcmd("transfer""transfer_money"ADMIN_ALL"")
    
    
RegisterHam(Ham_TakeDamage"player""fwTakeDamage"1)
    
    
//pcvar_dmg_money = register_cvar("damage_money", "2")
}

public 
transfer_menu(id)
{
    
get_players(playersnum"h")
    
    if (
num <= 1)
    {
        
ColorChat(idGREEN"x04There is no one to transfer money")
        return 
PLUGIN_HANDLED
    
}
    
    new 
tempname[32], info[10]
    
    
players_menu menu_create("Player""players_menu_handler")
    
    for(
0numi++)
    {
        if(
players[i] == id)
            continue
        
        
get_user_name(players[i], tempname31)
        
num_to_str(players[i], info9)
        
menu_additem(players_menutempnameinfo0)
    }
    
    
menu_setprop(players_menuMPROP_EXITMEXIT_ALL)
    
    
menu_display(idplayers_menu0)
    return 
PLUGIN_CONTINUE
}

public 
players_menu_handler(idplayers_menuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(players_menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6]
    
    
menu_item_getinfo(players_menuitemaccessmenudatacharsmax(data), iNamecharsmax(iName), callback)
    
    new 
player str_to_num(data)
    
    
client_cmd(id"messagemode ^"transfer %i^""player)
    
    return 
PLUGIN_CONTINUE
}

public 
transfer_money(id)
{
    new 
param[5]
    
read_argv(2paramcharsmax(param))
    
    for (new 
xstrlen(param); x++)
    {
        if(!
isdigit(param[x]))
        {
            
ColorChat(idGREEN"x04The parameter must be a number")
            return 
PLUGIN_HANDLED
        
}
    }
    
    new 
amount str_to_num(param)
    
    new 
money cs_get_user_money(id)
    
    if (
money amount)
    {
        
ColorChat(idGREEN"x04You do not have enough money!")
        return 
PLUGIN_HANDLED
    
}
    
    
read_argv(1paramcharsmax(param))
    new 
player str_to_num(param)
    
    new 
player_money cs_get_user_money(player)
    
    
cs_set_user_money(idmoney amount1)
    
cs_set_user_money(playerplayer_money amount1)
    
    new 
names[2][32]
    
    
get_user_name(idnames[0], 31)
    
get_user_name(playernames[1], 31)
    
    
ColorChat(idGREEN"x04Player x01%s x04give x01$%i x04%s"names[0], amountnames[1])
    
    return 
PLUGIN_HANDLED
}
public 
fwTakeDamage(iVictimweaponiAttackerFloat:damage)
{
    if(!
is_user_alive(iAttacker))
        return     
    
    if( 
get_user_team(iAttacker) == get_user_team(iVictim))
        return
    
    if(
damage 2.0)
        
cs_set_user_money(iAttackerclamp(cs_get_user_money(iAttacker) + floatround(damage), .max = (get_user_flags(iAttacker) & ADMIN_ACCESS) ? LIMIT_ADMIN_VIP LIMIT))

/*public set_money(id, value)
{
    new money = cs_get_user_money(id)+value

    money = clamp(money, .max =(get_user_flags(id) & ADMIN_ACCESS) ? LIMIT_ADMIN_VIP:LIMIT)

    cs_set_user_money(id, money)
}
stock amx_clamp(value, maximum)

    return value>maximum?maximum:value*/ 
__________________
FINISHED WORKING ON : Attack On Titan Mod (100% Done).

FB Acc : FaceBook Account.

pic: http://prntscr.com/fszkke not good quality

Last edited by yas17sin; 03-31-2017 at 17:41.
yas17sin is offline
Send a message via ICQ to yas17sin
 



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 18:03.


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