Raised This Month: $ Target: $400
 0% 

[REQ] Need little editing in Health Shop plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
liivar07
Junior Member
Join Date: Jan 2013
Old 02-06-2013 , 17:30   [REQ] Need little editing in Health Shop plugin
Reply With Quote #1

Could someone please edit this plugin so
- shop can't be opened before first zombie
- nemesis and survivors can't open the shop
- dead players can't open the shop

Here is the code:
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
{
    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 Packs]"
    
menu_additem(menu,"5000 HP \r[20 Ammo Packs]")
    
menu_additem(menu,"7000 HP \r[35 Ammo Packs]"
    
menu_additem(menu,"10000 HP \r[50 Ammo Packs]"
    
menu_additem(menu,"50000 HP \r[90 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 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) + 1000))
                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 1.000 HP")
                return 
PLUGIN_HANDLED
            
}
        } 
        case 
1:   /* 5000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 20 ){
                
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 20);
                
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 35 ){
                
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 35);
                
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 50 ){
                
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 50);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 10.000 HP")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
4:   /* 50000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 90 ){
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You do not have enough ^4ammo packs.")
                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"^3[^4ZP^3] ^3You bought ^4 50.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[15 Ammo Packs]"
    
menu_additem(menu,"2500 HP \r[20 Ammo Packs]"
    
menu_additem(menu,"5000 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 15 ){
                
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 15);
                
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 20 ){
                
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 20);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 2500 HP")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
4:   /* 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 5000 HP")
                return 
PLUGIN_HANDLED
            
}
        }
    } 
    return 
PLUGIN_HANDLED
}
public 
advertise()
{
    
ColorChat(0NORMAL"^3[^4ZP^3] ^3Write ^4/hpmenu ^3to open Health Shop")
    return 
PLUGIN_HANDLED
}  
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang10266\\ f0\\ fs16 \n\\ par }
*/ 

Last edited by liivar07; 02-07-2013 at 10:39.
liivar07 is offline
Torge
Veteran Member
Join Date: Oct 2011
Old 02-06-2013 , 19:41   Re: [REQ] Need little editing in Health Shop plugin
Reply With Quote #2

Try this.

I'm not sure whether the first zm part works, just let me know:

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))
        return;
    
    if (
zp_get_user_nemesis(id) || zp_get_user_survivor(id))
        return;
    
    new 
iPlayers[32], iNumplayer;
    
get_players(iPlayersiNum"a");
    
    for (new 
iNumi++)
    {
        
player iPlayers[i];
    
        while (!
zp_get_user_first_zombie(player))
            return;
        else
        {        
            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 Packs]"
    
menu_additem(menu,"5000 HP \r[20 Ammo Packs]")
    
menu_additem(menu,"7000 HP \r[35 Ammo Packs]"
    
menu_additem(menu,"10000 HP \r[50 Ammo Packs]"
    
menu_additem(menu,"50000 HP \r[90 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 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) + 1000))
                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 1.000 HP")
                return 
PLUGIN_HANDLED
            
}
        } 
        case 
1:   /* 5000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 20 ){
                
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 20);
                
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 35 ){
                
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 35);
                
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 50 ){
                
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 50);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 10.000 HP")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
4:   /* 50000 HP */
        
{                       
            new 
ammo zp_get_user_ammo_packs(id)
            
            if(
ammo 90 ){
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You do not have enough ^4ammo packs.")
                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"^3[^4ZP^3] ^3You bought ^4 50.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[15 Ammo Packs]"
    
menu_additem(menu,"2500 HP \r[20 Ammo Packs]"
    
menu_additem(menu,"5000 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 15 ){
                
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 15);
                
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 20 ){
                
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 20);
                
ColorChat(idNORMAL"^3[^4ZP^3] ^3You bought ^4 2500 HP")
                return 
PLUGIN_HANDLED
            
}
        }
        case 
4:   /* 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 5000 HP")
                return 
PLUGIN_HANDLED
            
}
        }
    } 
    return 
PLUGIN_HANDLED
}
public 
advertise()
{
    
ColorChat(0NORMAL"^3[^4ZP^3] ^3Write ^4/hpmenu ^3to open Health Shop")
    return 
PLUGIN_HANDLED


Last edited by Torge; 02-07-2013 at 16:34. Reason: updated (again)
Torge is offline
liivar07
Junior Member
Join Date: Jan 2013
Old 02-07-2013 , 09:16   Re: [REQ] Need little editing in Health Shop plugin
Reply With Quote #3

I tried it and everything besides the first zm thing works.
You can still try to edit it but if you don't know how then it's still ok.
The most important thing is that dead players, nemesises and survivors can't open it. And you did eliminate it

Thanks

E: I just found out that player can not open hpmenu AFTER first zm spawns. Sometimes it works and sometimes it doesn't
This is a mayor problem.

Last edited by liivar07; 02-07-2013 at 10:52.
liivar07 is offline
Torge
Veteran Member
Join Date: Oct 2011
Old 02-07-2013 , 13:42   Re: [REQ] Need little editing in Health Shop plugin
Reply With Quote #4

No problem.

I removed that non-worked stuff.

EDIT: I updated. If first zm thing works, let me know!

Last edited by Torge; 02-07-2013 at 16:34.
Torge is offline
liivar07
Junior Member
Join Date: Jan 2013
Old 02-08-2013 , 16:46   Re: [REQ] Need little editing in Health Shop plugin
Reply With Quote #5

It works

Many thanks.
liivar07 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 00:08.


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