Raised This Month: $ Target: $400
 0% 

bio extra item set hp


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
xAlecsu
Junior Member
Join Date: Apr 2024
Old 04-21-2024 , 13:52   bio extra item set hp
Reply With Quote #1

Hello ,i have a little problem with my plugin .when the player already have 200 hp and buy again hp he keeps losing money but his life does not increase.

I don't want to lose money more than 200 hp

Code:
#include <amxmodx>
#include <fun>
#include <engine>
#include <cstrike>
#include <fakemeta>
#include <biohazard>
#include <bio_shop>
#include <hamsandwich> 
#include <fakemeta_util>

new const item_name[] = "Extra Armour"
new g_itemid_buyhp
#define get_money(%1)   (cs_get_user_money(%1))
#define set_money(%1,%2)    (cs_set_user_money(%1,%2))
#define is_human(%1)    (!is_user_zombie(%1))
#define get_armor(%1)   (get_user_armor(%1))
#define set_armor(%1,%2)    (set_user_armor(%1,%2))

public plugin_init() 
{
    register_plugin("[ZP] Buy Health Points", "1.0", "T[h]E Dis[as]teR")
    g_itemid_buyhp = bio_register_item(item_name, 200, "+50 AP",TEAM_HUMAN)
    
}
public bio_item_selected(id,itemid)
{
        if( is_user_alive( id ) || itemid==g_itemid_buyhp ) {
        if( is_human( id ) ) {
            money = get_money( id ) - 200;
            if( money < 0 ) { Color( id, "!4[Biohazard Shop] !1N-ai bani !! Necesari:!3 2000 $ !1!" ); return 1; } else
            if( get_armor( id ) < 200 ) {
                set_armor( id, min( (get_armor( id ) + 50), 200) );
                set_money( id, money );
                Color( id, "!4[Biohazard Shop] !1Ai cumparat!3 50 Armura !1!" );
            } else Color( id, "!4[Biohazard Shop]!1 Ai Armura Maxim !" );
        } else Color( id, "!4[Biohazard Shop]!1 Doar !3Human !1pot cumpara !" );
        } else Color( id, "!4[Biohazard Shop] !1Trebuie sa fi in viata sa cumperi!3 50 Armura !1!" );
    return PLUGIN_CONTINUE;
}

stock Color( const id, const input[ ], any:... ) {
    new count = 1, players[ 32 ];
    static msg[ 191 ]; vformat( msg, 190, input, 3 );
    replace_all( msg, 190, "!4", "^4" );
    replace_all( msg, 190, "!1", "^1" );
    replace_all( msg, 190, "!3", "^3" );
    replace_all( msg, 190, "!0", "^0" );
    if( id ) players[ 0 ] = id; else get_players( players, count, "ch" ); {
        for( new i = 0; i < count; i++ ) {
            if( is_user_connected( players[ i ] ) ) {
                message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] )
                write_byte( players[ i ] );
                write_string( msg );
                message_end( );
            }
        }
    }
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang3082\\ f0\\ fs16 \n\\ par }
*/

Last edited by xAlecsu; 05-02-2024 at 18:15. Reason: solved
xAlecsu is offline
 



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 15:25.


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