Dėl entity ar kažkas panašaus

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
User avatar
zirualas
Gana aktyvus vartotojas
Posts: 216
Joined: 2010 Oct 16 21:33
Skype: zirual
Location: Vilnius
Contact:

Dėl entity ar kažkas panašaus

Post by zirualas »

Norėjau paklausti kaip sukurti entity, event'e kuriame žmogus panaudoja attack1, ir būtent iš žaidėjo išeitu tas entity su mano norimu modeliu, ir jei jis paliečia žmogų, jam nuėma kažkiek gyvybių.
Last edited by zirualas on 2011 Apr 12 16:50, edited 1 time in total.

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: Dėl entity ar kažkas panašaus

Post by aaarnas »

Sukuri entity ir paleidi pagal žaidėjo taikymosi kryptį:

Code: Select all

 new Float:origin[3], Float:velocity[3]velocity_by_aim(id, 600, velocity)entity_get_vector(id, EV_VEC_origin, origin)            new ent = create_entity("info_target")entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY)entity_set_string(ent, EV_SZ_classname, "entity_klase")entity_set_model(ent, "model/modelis.mdl")entity_set_size(ent, Float:{-15.0, -15.0, -15.0}, Float:{15.0, 15.0, 15.0})entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)origin[2]+=10.0entity_set_origin(ent, origin)entity_set_edict(ent, EV_ENT_owner, id)entity_set_vector(ent, EV_VEC_velocity, velocity)
Ir touch forwarde po to tikrini ir darai žalą:

Code: Select all

public entity_klases_forwardas(ent, touched) {     if(!is_valid_ent(ent))  return FMRES_IGNORED;        static classname[30]    entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname))        if(!equal(classname, "entity_klase")) return FMRES_IGNORED;        new owner    owner = entity_get_edict(ent, EV_ENT_owner)        if(owner == touched) return FMRES_IGNORED;                 remove_entity(ent)            ExecuteHamB(Ham_TakeDamage, touched, 0, owner, 50.0, DMG_GENERIC)     return FMRES_IGNORED} 
Palikau CS pasaulį ;/ . Nebepasiekiamas.

User avatar
zirualas
Gana aktyvus vartotojas
Posts: 216
Joined: 2010 Oct 16 21:33
Skype: zirual
Location: Vilnius
Contact:

Re: Dėl entity ar kažkas panašaus

Post by zirualas »

Meta tokius warning'us
//// Nezinau.sma
// D:\Program Files\Steam\steamapps\zirualaz\counter-strike\cstrike\addons\amxmo
dx\scripting\Nezinau.sma(78) : warning 204: symbol is assigned a value that is n
ever used: "origin2"
// D:\Program Files\Steam\steamapps\zirualaz\counter-strike\cstrike\addons\amxmo
dx\scripting\Nezinau.sma(78) : warning 204: symbol is assigned a value that is n
ever used: "origin"
Plugin init rašiau šitą:

Code: Select all

register_forward(FM_Touch, "entity_klases_forwardas")
O entity kurimą dėjau čia:

Code: Select all

RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "wp_prim", 1) //čia plugin_init

Code: Select all

public wp_prim(weapon) {      static id    id = entity_get_int(weapon, EV_ENT_owner)             new Float:origin[3], Float:velocity[3]    velocity_by_aim(id, 600, velocity)    entity_get_vector(id, EV_VEC_origin, origin)               new ent = create_entity("info_target")    entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY)    entity_set_string(ent, EV_SZ_classname, "entity_klase")    entity_set_model(ent, "models/raketa.mdl")    entity_set_size(ent, Float:{-15.0, -15.0, -15.0}, Float:{15.0, 15.0, 15.0})    entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)    origin[2]+=10.0    entity_set_origin(ent, origin)    entity_set_edict(ent, EV_ENT_owner, id)    entity_set_vector(ent, EV_VEC_velocity, velocity)}
Nuėjus į serveri, nieko neįvyksta. :?

-- 2011 Bal 12 12:41 --

Radau alliedmoders tut'a bet kai į servą nueinu, parašau car nieko neivyksta:

Code: Select all

#include <amxmodx>#include <amxmisc>#include <engine> new g_Classname[] = "func_car"new g_Model[] = "models/car.mdl" public plugin_init(){    register_plugin("OMFG","HAX","LOL")       register_clcmd("say car","CmdSayCar")       register_touch(g_Classname,"player","TouchCar")} public plugin_precache()    precache_model(g_Model) public CmdSayCar(id){    new Ent = create_entity("info_target")    entity_set_string(Ent,EV_SZ_classname,g_Classname)    entity_set_model(Ent,g_Model)    entity_set_int(Ent,EV_INT_solid,SOLID_TRIGGER)    entity_set_size(Ent,Float:{-50.0,-50.0,-50.0},Float:{50.0,50.0,50.0})    entity_set_edict(Ent,EV_ENT_owner,id)} public TouchCar(Ptd,Ptr){    new Owner = entity_get_edict(Ptd,EV_ENT_owner)    if(Owner != Ptr)        return       client_print(Ptr,print_chat,"You have used this car. Due to time purposes, I'm not going to add code beyond this.")}

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests