View Single Post
Dexon
Member
Join Date: Aug 2019
Old 04-22-2024 , 12:17   Re: bio extra item set hp
Reply With Quote #2

This code is completely and intentionally about giving armour, not about giving health for money.
For health:

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_health(%1))
#define set_armor(%1,%2)    (set_user_health(%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 }
*/
__________________
[ExTasY] Furien Hero [CRAFT SYSTEM]
213.181.206.21:27140

[ExTasY] Zombie Mutation [ZOMBIE NPC]
213.181.206.28:27057

Join now!

Video: https://www.youtube.com/watch?v=fNahCsS8DOU&t=328s
DC: https://discord.gg/swARTUZCZ4

Creating private plugins, reference above.

Last edited by Dexon; 04-22-2024 at 12:17.
Dexon is offline