AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Don't know how to fix errors (https://forums.alliedmods.net/showthread.php?t=83662)

The-Disaster 01-13-2009 07:43

Don't know how to fix errors
 
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 :)

zwfgdlc 01-13-2009 08:29

Re: Don't know how to fix errors
 
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; }

SnoW 01-13-2009 09:25

Re: Don't know how to fix errors
 
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.


All times are GMT -4. The time now is 01:39.

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