小迷糊 发表于 2005-1-8 14:10:16

请金闪闪及各位大人帮助看一下这个AMX原码,问题出在那里,我为什么编译不上运行不了!

//   amx_girlthrow <authid, nick or #userid>
//   amx_ungirlthrow <authid, nick or #userid>
// cvars:
//   amx_girlthrow 0 or 1 - makes all players throw like a girl

#include <amxmod>
#include <amxmisc>
#include <xtrafun>
new const HEGRENADE_MODEL[] = "models/w_hegrenade.mdl"
new girlthrow

public grenid(parm[]){
        new id = parm
        new string, grenadeid = 0
        do
        {
                grenadeid = get_grenade_id(id, string, 31, grenadeid)
        }
        while (grenadeid &&!equali(HEGRENADE_MODEL,string));

        if (grenadeid)
        {
                new grenage_vel
                grenage_vel = 0
                grenage_vel = 0
                grenage_vel = 0
                set_entity_velocity(grenadeid, grenage_vel)
        }

}

public TextMsg(id){
        new cvar = get_cvar_num("amx_girlthrow")
        if (!girlthrow && !cvar) return PLUGIN_CONTINUE
       
        new name
        read_data(3, name, 31)
        if (id==find_player("a",name))
        {
                new parm
                parm = id
                set_task(0.001,"grenid",50,parm,1)
        }
       
        return PLUGIN_CONTINUE
}

public amx_girlthrow(id,level,cid) {
    if (!cmd_access(id,level,cid,3))
      return PLUGIN_HANDLED

    new arg
    read_argv(1,arg,31)
    new player = cmd_target(id,arg,1)
    if (!player) return PLUGIN_HANDLED
       
    girlthrow = 1
       
    new sthrowtime
    read_argv(2,sthrowtime,7)
    new Float:throwtime = floatstr(sthrowtime)
       
    new param
    param = player
    new name
    get_user_name(player, name , 31)
    set_task( throwtime ? throwtime : 99999.0 ,"ungirlthrow",player,param,1)
    set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
    show_hudmessage(0,"%s throws like a girl!",name)
    return PLUGIN_HANDLED
}


public ungirlthrow(param[]) {
    new id = param
    if (!girlthrow) return PLUGIN_HANDLED
    girlthrow = 0
        new name
    get_user_name(id, name , 31)
    set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
    show_hudmessage(0,"%s no longer throws like a girl.",name)
    return PLUGIN_HANDLED
}

public amx_ungirlthrow(id,level,cid) {
    if (!cmd_access(id,level,cid,2))
      return PLUGIN_HANDLED
    new arg
    read_argv(1,arg,31)
    new player = cmd_target(id,arg,1)
    if (!player) return PLUGIN_HANDLED
    new param
    param = player
    ungirlthrow(param)
    return PLUGIN_HANDLED
}

public client_disconnect(id) {
    new param
    param = id
    ungirlthrow(param)
    return PLUGIN_CONTINUE
}

public plugin_init()
{
        register_plugin("Throw Like a Girl","0.1","blah")
        register_cvar("amx_girlthrow","0")
        register_concmd("amx_girlthrow","amx_girlthrow",ADMIN_LEVEL_A,"<authid, nick or #userid> ")
    register_concmd("amx_ungirlthrow","amx_ungirlthrow",ADMIN_LEVEL_A,"<authid, nick or #userid>")
    register_event("TextMsg","TextMsg","b","2&#Game_radio", "4&#Fire_in_the_hole")
        return PLUGIN_CONTINUE
}

注:是AMX 插件,能在AMX 0.97上运行就可!

nwb13 发表于 2005-1-8 19:06:03

麻烦帖一下你编译时的提示

金闪闪 发表于 2005-1-9 14:39:24

如果没猜错的话,是提示你少了xtrafun.h文件。 :43:
页: [1]
查看完整版本: 请金闪闪及各位大人帮助看一下这个AMX原码,问题出在那里,我为什么编译不上运行不了!