Raised This Month: $ Target: $400
 0% 

Don't know how to fix errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The-Disaster
Member
Join Date: Jul 2008
Old 01-13-2009 , 07:43   Don't know how to fix errors
Reply With Quote #1

This is my first plugin and i tried to make it to work with Zombie-Plague
but i couldn't

Code:
#include <amxmodx>
#include <fun>
#include <zombieplague>

#define PLUGIN "Buy Health Points"
#define VERSION "1.0"
#define AUTHOR "The-Disaster"

new g_itemid_buyhp
new g_item_name
new on_off
new price


public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /buyhp", "addhp")
    on_off = register_cvar("zp_buyhp", "1")
    price = register_cvar("zp_buyhp_price", "5")
    g_itemid_buyhp = zp_register_extra_item(g_item_name, get_pcvar_num(price), ZP_TEAM_ANY = 0)
}

public addhp(id)
{
    new price_ap = zp_get_user_ammo_packs(id)
    zp_set_user_ammo_packs(id, price_ap - get_pcvar_num(price))
    if (get_pcvar_num(on_off) == 1)
    {
        if (price_ap >= get_pcvar_num(price))
        {
             set_user_health(id, ( get_user_health(id)+1000 ))
             client_print(id, print_chat,"[ZP] You Gained 1000HP!")
        }
        else
        {
        client_print(id, print_chat,"[ZP] Not enough Ammopacks!")
        }

}
}
Could some one help me please to fix this plugin
__________________
The-Disaster is offline
zwfgdlc
Senior Member
Join Date: May 2006
Old 01-13-2009 , 08:29   Re: Don't know how to fix errors
Reply With Quote #2

try this.not tested.
Code:
#include <amxmodx> #include <fun> #include <zombieplague> #define PLUGIN "Buy Health Points" #define VERSION "1.0" #define AUTHOR "The-Disaster" new g_itemid_buyhp new on_off new price public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     on_off = register_cvar("zp_buyhp", "1")     price = register_cvar("zp_buyhp_price", "5")     if((g_itemid_buyhp = zp_register_extra_item("item name", get_pcvar_num(price), ZP_TEAM_HUMAN)) == -1     ||!get_pcvar_num(on_off))     pause("ad"); } public zp_extra_item_selected(id,itemid) {     if(!is_user_alive(id)) return PLUGIN_HANDLED;     if(itemid==g_itemid_buyhp)     {         if(zp_get_user_ammo_packs(id) < get_pcvar_num(price))         {             client_print(id, print_chat,"[ZP] Not enough Ammopacks!");             return PLUGIN_HANDLED;         }else{             set_user_health(id,1000);             zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id)-get_pcvar_num(price));             client_print(id, print_chat,"[ZP] You Gained 1000HP!");         }     }     return PLUGIN_CONTINUE; }

Last edited by zwfgdlc; 01-13-2009 at 08:39.
zwfgdlc is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-13-2009 , 09:25   Re: Don't know how to fix errors
Reply With Quote #3

Ye, u made a plugin for him, still I think the thread was that he don't know how to fix them. Don't know do you want just a working plugin, but Anyway here's still some information you can use not depending what you want:
1. The compiler shows you the line where the error is, go to that line.
2. If you see straigth some mistake there, ofc fix it.
3. If you didn't still get it, if there's some native, go to incs and confirm it.
4. Still not getting it, search from forums for using that native.
5. If it's something with normal variables, or for example copying string, just go to pawn tutorial in wiki and read it to learn. (Also other tutorials)
6. In the last thing, if you can't figure it out, post here.
SnoW is offline
Send a message via MSN to SnoW
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 01:39.


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