AE86 发表于 2007-3-18 04:22:56

游戏中拥有直升机插件 存在好些BUG请高手修复

原贴地址:
http://www.dt-club.net/forum/thread/71/24614.htm?highlight=%E7%9B%B4%E5%8D%87%E6%9C%BA
希望高手能修正几个问题。
1、飞机只有上升,没有下降,似乎不够人性化
2、升空后发射炮弹后机体会自动爆炸
3、升空后好像不能移动、视角也不是很好
4、最重要的是,用力这个插件后,活着的玩家走到死亡玩家尸体旁边,就会把尸体一起拖着走,1拖2拖3拖4……靠近多少尸体就会拖多少。。。



//Includes
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <fun>

//Roflcopter 0.4 mod
//fairieclan.vze.com
//Pinkfairie

new roflcopterent //invis sold
new roflcopterent2 //Copter mdl
new heli_is; //Is inhelicopter
new heli_isup; //Is going up
new Float:angles //Angles
new Float:angles2 //Angles
new Float:bullettime //Times to prevent crashing
new bullet
new smoketrail

//Initation
public plugin_init(){
        register_plugin("roflcopter","0.5","Pink | C.H.M"); //Register Plugin

        register_clcmd("+heli", "heliup_plus") //Register Commands
        register_clcmd("-heli", "heliup_minus")

        register_touch("bullet_ent","player","touch_bullet");

        register_clcmd("/rocket", "rocket2")
        register_clcmd("say /autobind", "autobind")

        register_concmd("amx_roflcopter","cmd_roflcopter",ADMIN_LEVEL_A,"<name> <0|1> - 直升机 1 开启 0 关闭");
}

public client_putinserver(id) { //Join server
        angles = 0.0
        angles = 0.0
        angles = 0.0
        remove_task(id,0); //Remove current tasks
        heli_check(id) //Play helicopter check
        heli_sound(id)//Play helicopter sound
        heli_is = 0 //Make them not a helicopter
}

public heli_check(id) {
        if(is_user_connected(id) == 0) { //If not connected, stop and go back
                return PLUGIN_HANDLED;
        }

        if(heli_is > 0) { //If is a helicopter
                remove_entity(roflcopterent) //remove the two ents...
                remove_entity(roflcopterent2)// """ "
                entity_get_vector(id,EV_VEC_angles,angles2) //get the players angels

                angles = angles2 //Keep copter on the player but let the copter have moving physics

                set_entity_visibility(id, 0) //Make the person invisable so the 2nd ent looks like them! :)
                if(is_user_alive(id) == 0) { //If dead, Remove the chopper and exit them from the copter
                        heli_is = 0 //Not a heli
                        client_print(id,print_chat,"* [直升机] 你已经死亡直升机坠毁.^n"); //Message
                }
                new origin //Origin varible
                get_user_origin(id,origin); //Get origin

                //Entity1
                roflcopterent = create_entity("info_target"); // create entity
                set_entity_visibility(roflcopterent, 0) //make the solid enity invisable
                entity_set_model(roflcopterent,"models/copter.mdl"); // set model
                entity_set_vector(roflcopterent,EV_VEC_angles,Float:{0.0,0.0,0.0}); //set vector
                new Float:choppos; //new pos
                choppos = float(origin);
                choppos = float(origin);
                choppos = float(origin -60); //make it 60 coords below feet
                entity_set_origin(roflcopterent,choppos); //Set the origin
                entity_set_int(roflcopterent,EV_INT_solid, 2) //Make it solid
                new Float:maxs = {16.0,16.0,16.0} //How big solid?
                new Float:mins = {-16.0,-16.0,-16.0} //How big solid?
                entity_set_size(roflcopterent,mins,maxs) //set size

                //Entity2
                roflcopterent2 = create_entity("info_target"); // create entity
                entity_set_model(roflcopterent2,"models/copter.mdl"); // set model
                entity_set_vector(roflcopterent2,EV_VEC_angles,angles);
                new Float:choppos2;
                choppos2 = float(origin);
                choppos2 = float(origin);
                choppos2 = float(origin);
                entity_set_origin(roflcopterent2,choppos2);
                entity_set_int(roflcopterent2,EV_INT_solid, 2)


                if(heli_isup > 0) { //If holding in the heliup key
                        origin += 50 //Make them go up! woo!
                }

                set_user_origin(id,origin); //Set it
                set_task(0.1,"heli_check",id); //Loop
                return PLUGIN_HANDLED;
        }
        set_entity_visibility(id, 1)
        set_task(0.1,"heli_check",id); //If not in helicopter, Loop
        return PLUGIN_HANDLED;
}

public heli_sound(id) {
        if(is_user_connected(id) == 0) { //If not connected, stop and go back
                return PLUGIN_HANDLED;
        }
        if(heli_is > 0) { //If is a helicopter
                emit_sound(id, CHAN_VOICE, "PinkRPG/roflcopter.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) //player a heli sound
                set_task(1.5,"heli_sound",id); //Loop
                return PLUGIN_HANDLED;
        }
        set_task(1.5,"heli_sound",id); //If not in helicopter, Loop
        return PLUGIN_HANDLED;
}

public heliup_plus(id) {
        heli_isup = 1
}

public heliup_minus(id) {
        heli_isup = 0
}



public cmd_roflcopter(id,level,cid) {
        if(!cmd_access(id,level,cid,3)) {
                return PLUGIN_HANDLED;
        }
        new arg1, arg2
        read_argv(1,arg1,255);
        read_argv(2,arg2,255);
        new player = cmd_target(id,arg1,2); //make the first arugment the player
        new heli_onoff = str_to_num(arg2); //Make the 2nd one a number
        if(!player) { //Player not exist, Stop
                return PLUGIN_HANDLED;
        }
        if (heli_onoff > 1 || heli_onoff < 0) {
                console_print(id,"* [直升机] 你的数字必须是 1 或 2.^n");
                return PLUGIN_HANDLED;
        }

        if(heli_onoff < 1) { //if they put 0, make them stop being a roflcopter
                heli_is = 0
                client_print(player,print_chat,"* [直升机] 管理员关闭了直升机插件.^n");
                remove_entity(roflcopterent)
                remove_entity(roflcopterent2)
                return PLUGIN_HANDLED;
        }
        if(heli_onoff > 0) { //Make them a helicopter if they put 1 :)
                heli_is = 1
                client_print(player,print_chat,"* [直升机] 管理员开启直升机插件.(绑定一个键位 +heli 飞机升空, /rocket 发射炮弹.)^n");
                return PLUGIN_HANDLED;
        }
        return PLUGIN_HANDLED;
}

public plugin_precache() {
        precache_sound( "PinkRPG/roflcopter.wav")
        precache_model( "models/copter.mdl")
        precache_model( "models/rpgrocket.mdl")
        smoketrail = precache_model("sprites/smoke.spr")
}

public client_PreThink(id) {

        if(heli_is > 0) { //if is in the helicopter

                new button = entity_get_int(id,EV_INT_button); // get buttons

                if((button & IN_FORWARD)){ //If going forward
                        angles = 330.0 //Dip forward
                }
                else {
                        angles = 0.0
                }
                if((button & IN_BACK)){ //Going back?
                        angles = 30.0 //Dip back!
                }


                if((button & IN_MOVELEFT)){ //If going left
                        angles = 330.0 //Swing to the side
                }
                else {
                        angles = 0.0
                }
                if((button & IN_MOVERIGHT)){ //If going right
                        angles = 30.0 //Swing to the side
                }

        }


}


public rocket2(id) {
        if(heli_is > 0) { //if in heli
                if(get_gametime() < bullettime + 1.0) { //if recently fired missel ingame, stop to prevent crashing
                        return PLUGIN_HANDLED;
                }
                bullettime = get_gametime() //Reset time so they can fire again in .5 seconds
                new origin, Float:Angle //Create the angle the missle points
                get_user_origin(id,origin); //Get the origin of the player
                entity_get_vector(id, EV_VEC_v_angle, Angle) //Make angle = to person's so the missle will be pointing forward when fired
                bullet = create_entity("info_target") //Create the bullet already!
                entity_set_string(bullet, EV_SZ_classname, "bullet_ent") //Give it a classname
                entity_set_model(bullet, "models/rpgrocket.mdl") //Make it the classic tfc model <3

                new Float:bulletpos; //New pos
                bulletpos = float(origin); //Make the bullet = to the players origin in XYZ
                bulletpos = float(origin);
                bulletpos = float(origin);
                entity_set_origin(bullet,bulletpos); //Set it

                entity_set_vector(bullet, EV_VEC_angles, Angle) //Set the angle, So it looks forward
                entity_set_int(bullet, EV_INT_movetype, 5) //Movetype 5, rocket
                entity_set_edict(bullet, EV_ENT_owner, id) //Set the edict so it can fire when moving forward

                //Make this solid!
                new Float:mins = {-5.0, -5.0, -5.0} //set the minimums
                new Float:maxs = {5.0, 5.0, 5.0} //maxs
                entity_set_vector(bullet, EV_VEC_mins, mins) //Set the vector
                entity_set_vector(bullet, EV_VEC_maxs, maxs) // " " "
                entity_set_int(bullet, EV_INT_solid, 2) // Now actually make it solid

                //Set the vector's velocity
                new Float:Velocity
                VelocityByAim(id, 1000, Velocity)
                entity_set_vector(bullet, EV_VEC_velocity, Velocity)

                //SEND IT OFF!
                message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
                write_byte(22)
                write_short(bullet)
                write_short(smoketrail)
                write_byte(30)
                write_byte(3)
                write_byte(255)
                write_byte(255)
                write_byte(255)
                write_byte(255)
                message_end()
                set_task(0.9,"remove_bullet",id);
                return PLUGIN_HANDLED;
        }
        return PLUGIN_HANDLED;
}


public basic_explosion(id) {
        new vec1
        get_user_origin(id,vec1)
        message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
        write_byte( 12 )
        write_coord(vec1)
        write_coord(vec1)
        write_coord(vec1)
        write_byte( 188 ) // byte (scale in 0.1's)
        write_byte( 10 ) // byte (framerate)
        message_end()
}

public touch_bullet(ent,id) { //If a player and the bullet touch
        new origin, Float:forigin //make an origin, and a float
        get_user_origin(id,origin,0) //Get user origin
        IVecFVec(origin,forigin) //Convert to float
        basic_explosion(id) //Play an explosion
        user_silentkill(id) //Silent kill
        radius_damage(forigin,50,25) //Make some splash damage
        return PLUGIN_HANDLED
}

public autobind(id) {
        client_cmd(id, "bind uparrow +heli")
        client_cmd(id, "bind downarrow /rocket")
}

public remove_bullet(id) {
        new Float:origin
        entity_get_vector(bullet,EV_VEC_origin, origin)

        new Float:vec1,iVec1
        entity_get_vector(bullet,EV_VEC_origin, vec1)
        FVecIVec(vec1,iVec1)
        message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
        write_byte( 12 )
        write_coord(iVec1)
        write_coord(iVec1)
        write_coord(iVec1)
        write_byte( 188 ) // byte (scale in 0.1's)
        write_byte( 10 ) // byte (framerate)
        message_end()

        radius_damage(origin,50,25) //Make some splash damage
        remove_entity(bullet) //Remove rocket

        return PLUGIN_HANDLED;
}

kila华少 发表于 2007-8-13 15:40:11

回复: 游戏中拥有直升机插件 存在好些BUG请高手修复

唉```没想到```3月到现在```````
页: [1]
查看完整版本: 游戏中拥有直升机插件 存在好些BUG请高手修复