Raised This Month: $ Target: $400
 0% 

Register Touch...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 08-29-2015 , 09:43   Re: Register Touch...
Reply With Quote #1

you could of done it easily by looking over the lasermine, jetpack or supply box code... that is the way i've learnt how to deal with entities...
all you had to do is copy paste the entity creation and touch functions, then edit them a little...

anyway, here you have an example ( sorry, i didn't have time to finish it, but im sure you can do it yourself )

this way, may i ask if the public Event_NewRound is correct? i mean it works, but in some cases i seen looping to get the entities removed

Code:
#define ClassUC "uclip"

public plugin_init()
{
    register_touch(ClassUC, "player", "Touch")
}

public Event_NewRound()
{
    remove_entity_name(ClassUC)
}

public Create_Entity(id)
{
    new ent = create_entity("info_target")
    if(!is_valid_ent(ent)) return;
    
    new Float:Aim[3], Float:Origin[3]
    velocity_by_aim(id, 32, Aim)
    entity_get_vector(id, EV_VEC_origin, Origin)
    Origin[0] += 2*Aim[0]
    Origin[1] += 2*Aim[1]
    entity_set_string(ent, EV_SZ_classname, ClassUC)
    entity_set_model(ent, ModelJetpack_W)
    entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
    entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
    entity_set_size(ent, Float:{-8.0, -8.0, -8.0}, Float:{8.0, 8.0, 8.0})
    entity_set_float(ent, EV_FL_gravity, 1.25)
    entity_set_vector(ent, EV_VEC_origin, Origin)
    velocity_by_aim(id, 400, Aim)
    entity_set_vector(ent, EV_VEC_velocity, Aim)
}

public Touch(ent, id)
{
    if(is_valid_ent(ent) && is_user_connected(id))
    {
        if(!is_user_alive(id)) return PLUGIN_HANDLED;
        
        entity_set_int(ent, EV_INT_solid, SOLID_NOT)
        remove_entity(ent)
    }
    
    return PLUGIN_CONTINUE;
}

Last edited by Depresie; 08-29-2015 at 09:46.
Depresie 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 22:14.


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