Raised This Month: $51 Target: $400
 12% 

[ZP] Addons Health Shop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Miljan9
Member
Join Date: Dec 2011
Location: Belgrade / Serbia
Old 02-27-2012 , 11:49   [ZP] Addons Health Shop
Reply With Quote #1


[ZP]Addon Health Shop
v1.0


Description:
This is my first and very interesting Zombie Plague plugin.
When you type /hpmenu you get a Health Shop menu.
Prices are expressed in ammo packs.

Commands:
say /hpmenu

Contents of menu:
Zombie Menu:
1000 HP [10 Ammo] - 1000 HP for 10 Ammo
5000 HP [20 Ammo] - 5000 HP for 20 Ammo
7000 HP [35 Ammo] - 7000 HP for 35 Ammo
10000 HP [50 Ammo] - 10000 for za 50 Ammo
50000 HP [90 Ammo]
- 50000 HP for 90 Ammo

Human Menu
100 HP [5 Ammo] - 100 HP for 5 Ammo
500 HP [10 Ammo] - 500 HP for 10 Ammo
1000 HP [15 Ammo] - 1000 HP for 15 Ammo
2500 HP [20 Ammo] - 2500 HP for 20 Ammo
5000 HP [40 Ammo]
- 5000 HP for 40 Ammo

Code of plugin:
PHP Code:
/* Plugin created by MiljanX */

#include <amxmodx>
#include <amxmisc> 
#include <cstrike> 
#include <fun>
#include <colorchat>
#include <zombieplague>

#define PLUGIN "[ZP] Addon Health Shop"
#define VERSION "1.0"
#define AUTHOR "MiljanX"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("say /hpmenu","ConHealthID"
    
register_concmd("say_team /hpmenu","ConHealthID"
    
    
register_cvar("Advertise","50"
    
set_task(get_cvar_float("Advertise"),"advertise" "b")   
}
public 
ConHealthID(id
{
    static 
CsTeams:team
    
team cs_get_user_team(id); 
    
    switch(
team
    { 
        case 
ZP_TEAM_ZOMBIE
        { 
            
Zombie_Menu(id); 
        } 
        case 
ZP_TEAM_HUMAN
        { 
            
Human_Menu(id); 
        } 
    } 

public 
Zombie_Menu(id
{
    new 
menumenu_create("[ZP] Health Menu [Zombie]","Zombie_Handle"
    
menu_additem(menu,"1000 HP \r[10 Ammo]"
    
menu_additem(menu,"5000 HP \r[20 Ammo]")
    
menu_additem(menu,"7000 HP \r[35 Ammo]"
    
menu_additem(menu,"10000 HP \r[50 Ammo]"
    
menu_additem(menu,"50000 HP \r[90 Ammo]"
    
menu_display(id,menu

public 
Zombie_Handle(id,menu,item

    if(
item==MENU_EXIT)                         
    {                                            
        
menu_destroy(menu)                       
        return 
PLUGIN_CONTINUE             
    
}                                           
    switch(
item)  
    {    
        case 
0:   /* 1000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 10 ){
                
ColorChat(idNORMAL"^4[ZP] ^3Nemas dovoljno Ammo Packova.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 1000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 10);
                
ColorChat(idNORMAL"^4[ZP] ^3Kupio si 1000 HP i to te je kostalo 10 Ammo.")
                return 
PLUGIN_HANDLED
            
}
        } 
        case 
1:   /* 5000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 20 ){
                
ColorChat(idNORMAL"^4[ZP] ^3Nemas dovoljno Ammo Packova.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 5000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 20);
                
ColorChat(idNORMAL"^4[ZP] ^3Kupio si 5000 HP i to te je kostalo 20 Ammo.")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
2:   /* 7000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 35 ){
                
ColorChat(idNORMAL"^4[ZP] ^3Nemas dovoljno Ammo Packova.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 7000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 35);
                
ColorChat(idNORMAL"^4[ZP] ^3Kupio si 7000 HP i to te je kostalo 35 Ammo.")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
3:   /* 10000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 50 ){
                
ColorChat(idNORMAL"^4[ZP] ^3Nemas dovoljno Ammo Packova.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 10000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 50);
                
ColorChat(idNORMAL"^4[ZP] ^3Kupio si 10000 HP i to te je kostalo 50 Ammo.")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
4:   /* 50000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 90 ){
                
ColorChat(idNORMAL"^4[ZP] ^3Nemas dovoljno Ammo Packova.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 50000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 90);
                
ColorChat(idNORMAL"^4[ZP] ^3Kupio si 50000 HP i to te je kostalo 90 Ammo.")
                return 
PLUGIN_HANDLED
            
}
        }    
    } 
}
public 
Human_Menu(id
{
    new 
menumenu_create("[ZP] Health Menu [Human]","Human_Handle"
    
menu_additem(menu,"100 HP \r[5 Ammo]"
    
menu_additem(menu,"500 HP \r[10 Ammo]")
    
menu_additem(menu,"1000 HP \r[15 Ammo]"
    
menu_additem(menu,"2500 HP \r[20 Ammo]"
    
menu_additem(menu,"5000 HP \r[40 Ammo]"
    
menu_display(id,menu

public 
Human_Handle(id,menu,item

    if(
item==MENU_EXIT)                         
    {                                            
        
menu_destroy(menu)                       
        return 
PLUGIN_CONTINUE             
    
}                                           
    switch(
item)  
    {    
        case 
0:   /* 100 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo ){
                
ColorChat(idNORMAL"^4[ZP] ^3Nemas dovoljno Ammo Packova.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 100))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 5);
                
ColorChat(idNORMAL"^4[ZP] ^3Kupio si 100 HP i to te je kostalo 5 Ammo.")
                return 
PLUGIN_HANDLED
            
}
        } 
        case 
1:   /* 500 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 10 ){
                
ColorChat(idNORMAL"^4[ZP] ^3Nemas dovoljno Ammo Packova.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 500))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 10);
                
ColorChat(idNORMAL"^4[ZP] ^3Kupio si 500 HP i to te je kostalo 10 Ammo.")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
2:   /* 1000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 15 ){
                
ColorChat(idNORMAL"^4[ZP] ^3Nemas dovoljno Ammo Packova.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 1000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 15);
                
ColorChat(idNORMAL"^4[ZP] ^3Kupio si 1000 HP i to te je kostalo 15 Ammo.")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
3:   /* 2500 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 20 ){
                
ColorChat(idNORMAL"^4[ZP] ^3Nemas dovoljno Ammo Packova.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 2500))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 20);
                
ColorChat(idNORMAL"^4[ZP] ^3Kupio si 2500 HP i to te je kostalo 20 Ammo.")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
4:   /* 5000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 40 ){
                
ColorChat(idNORMAL"^4[ZP] ^3Nemas dovoljno Ammo Packova.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 5000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 40);
                
ColorChat(idNORMAL"^4[ZP] ^3Kupio si 5000 HP i to te je kostalo 40 Ammo.")
                return 
PLUGIN_HANDLED
            
}
        }
    }     
}
public 
advertise()
{
    
ColorChat(0NORMAL"^4[ZP] ^3Napisite /hpmenu da otvorite Health Shop")
    return 
PLUGIN_HANDLED


Images:

- Zombie Menu

Code:
http://slike.milf-hosting.info/images/1330358805.jpg
- Human Menu

Code:
http://slike.milf-hosting.info/images/1330358950.jpg
for every 50 seconds published advertisements in chat.

Thanks: PU13|V|4ST3|2_SN1P3R

Plugin is on Serbian Language. Sorry... Who has time to be translated. I will later.

Sorry for bad English.
Attached Files
File Type: sma Get Plugin or Get Source (hpshop.sma - 752 views - 7.1 KB)
__________________
Hi I'm from Serbian and i don't speak English good.
Miljan9 is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-27-2012 , 13:12   Re: [ZP] Addons Health Shop
Reply With Quote #2

Two warnings while compiling fix them
You didnt return the value You forgot to add PLUGIN_HANDLED
__________________

Last edited by H.RED.ZONE; 02-27-2012 at 13:40.
H.RED.ZONE is offline
Johnnynho123
Member
Join Date: Dec 2011
Location: Gradiska, Republic of Sr
Old 02-29-2012 , 07:47   Re: [ZP] Addons Health Shop
Reply With Quote #3

Yeah, fix them i translated it but i cannot compile becouse of these errors !
__________________


Forum: www.Adrenaline-Zone.info
Johnnynho123 is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-29-2012 , 10:00   Re: [ZP] Addons Health Shop
Reply With Quote #4

Quote:
Originally Posted by Johnnynho123 View Post
Yeah, fix them i translated it but i cannot compile becouse of these errors !
You are joking me he just didnt return the handle but i see he wont fix it...
Here is a fix and translated now you can test it if it works...
Attached Files
File Type: sma Get Plugin or Get Source (zp_heal_shop.sma - 761 views - 9.0 KB)
__________________

Last edited by H.RED.ZONE; 02-29-2012 at 10:00.
H.RED.ZONE is offline
naSTR
Veteran Member
Join Date: Dec 2011
Location: Asia, Mongolia
Old 03-01-2012 , 06:42   Re: [ZP] Addons Health Shop
Reply With Quote #5

Bug. When counting down the t-virus terrorist player can buy 50.000hp LOL
__________________
naSTR is offline
Garrey
Member
Join Date: Jan 2010
Old 02-07-2013 , 12:06   Re: [ZP] Addons Health Shop
Reply With Quote #6

Quote:
Originally Posted by naSTR View Post
Bug. When counting down the t-virus terrorist player can buy 50.000hp LOL
I had the same problem first ;)
I added checks - if the user is alive, if user is survivor/nemesis and if the round have started.

PHP Code:
#include <amxmodx>
#include <amxmisc> 
#include <cstrike> 
#include <fun>
#include <colorchat>
#include <zombieplague>

#define PLUGIN "[ZP] Addon Health Shop"
#define VERSION "1.0"
#define AUTHOR "MiljanX"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("say /hpmenu","ConHealthID"
    
register_concmd("say_team /hpmenu","ConHealthID"
    
    
register_cvar("Advertise","50"
    
set_task(get_cvar_float("Advertise"),"advertise" "b")   
}
public 
ConHealthID(id
{
    if (!
is_user_alive(id)) {
        
ColorChat(idNORMAL"^3[^4ZP^3] ^3You have to be ^4ALIVE^3")
        return;
    }    
    if (
zp_get_user_nemesis(id) || zp_get_user_survivor(id)) {
        
ColorChat(idNORMAL"^3[^4ZP^3] ^3You are survivor/nemesis so You ^4can't^3 buy HP")
        return;
    }
    
    if(!
zp_has_round_started()) {
        
ColorChat(idNORMAL"^3[^4ZP^3] ^3Round havent ^4started^3 yet")
        return;
    }
    
    static 
CsTeams:team
    
team cs_get_user_team(id); 
    
    switch(
team
    { 
        case 
ZP_TEAM_ZOMBIE
        { 
            
Zombie_Menu(id); 
        } 
        case 
ZP_TEAM_HUMAN
        { 
            
Human_Menu(id); 
        } 
    } 

public 
Zombie_Menu(id
{
    new 
menumenu_create("[ZP] Health Menu [Zombie]","Zombie_Handle"
    
menu_additem(menu,"1000 HP \r[9 Ammo Packs]"
    
menu_additem(menu,"5000 HP \r[40 Ammo Packs]")
    
menu_additem(menu,"7000 HP \r[60 Ammo Packs]"
    
menu_additem(menu,"10000 HP \r[85 Ammo Packs]"
    
menu_display(id,menu

public 
Zombie_Handle(id,menu,item

    if(
item==MENU_EXIT)                         
    {                                            
        
menu_destroy(menu)                       
        return 
PLUGIN_CONTINUE             
    
}                                           
    switch(
item)  
    {    
        case 
0:   /* 1000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo ){
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You do not have enough ^4ammo packs.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 1000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 9);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 1.000 HP")
                return 
PLUGIN_HANDLED
            
}
        } 
        case 
1:   /* 5000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 40 ){
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You do not have enough ^4ammo packs.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 5000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 40);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 5.000 HP")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
2:   /* 7000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 60 ){
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You do not have enough ^4ammo packs.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 7000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 60);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 7.000 HP")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
3:   /* 10000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 85 ){
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You do not have enough ^4ammo packs.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 10000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 85);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 10.000 HP")
                return 
PLUGIN_HANDLED
            
}
        }   
    } 
    return 
PLUGIN_HANDLED
}
public 
Human_Menu(id
{
    new 
menumenu_create("[ZP] Health Menu [Human]","Human_Handle"
    
menu_additem(menu,"100 HP \r[5 Ammo Packs]"
    
menu_additem(menu,"500 HP \r[10 Ammo Packs]")
    
menu_additem(menu,"1000 HP \r[18 Ammo Packs]"
    
menu_additem(menu,"2500 HP \r[40 Ammo Packs]"
    
menu_display(id,menu

public 
Human_Handle(id,menu,item

    if(
item==MENU_EXIT)                         
    {                                            
        
menu_destroy(menu)                       
        return 
PLUGIN_CONTINUE             
    
}                                           
    switch(
item)  
    {    
        case 
0:   /* 100 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo ){
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You do not have enough ^4ammo packs.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 100))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 5);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 100 HP")
                return 
PLUGIN_HANDLED
            
}
        } 
        case 
1:   /* 500 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 10 ){
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You do not have enough ^4ammo packs.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 500))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 10);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 500 HP")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
2:   /* 1000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 18 ){
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You do not have enough ^4ammo packs.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 1000))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 18);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 1000 HP")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
3:   /* 2500 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 40 ){
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You do not have enough ^4ammo packs.")
                return 
PLUGIN_HANDLED
            
}
            else {
                
set_user_health(id, (get_user_health(id) + 2500))
                new 
ammo_parice zp_get_user_ammo_packs(id)
                
zp_set_user_ammo_packs(id,ammo_parice 40);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 2500 HP")
                return 
PLUGIN_HANDLED
            
}
        }
    } 
    return 
PLUGIN_HANDLED
}
public 
advertise()
{
    
ColorChat(0NORMAL"^3[^4ZP^3] ^3Write ^4/hpmenu ^3to open Health Shop")
    return 
PLUGIN_HANDLED

__________________
People are like music, some speak the truth and others are just noise..
Garrey 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 21:14.


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