←  Pluginy

AMXX.pl: Support AMX Mod X i SourceMod

»

Modele

Zablokowany

  • +
  • -
G[o]Q - zdjęcie G[o]Q 04.01.2010

Mam kod ktory postawi model na mapie ale postawi on go po smierci gracza w miejscu ktorym on stal - taki nagrobek a chcialbym zeby model byl postawiony w miejscu gdzie wskazalismy celownikiem moglibyscie podac jak to zrobic?? ew wskazowki jakies :D


Cod:
#include <amxmodx>
#include <fakemeta>


#define MINS Float:{-12.650000, -22.070000, -3.950000} // definiujemy najmniejsze wartosci
#define MAXS Float:{19.870001, 8.390000, 20.540001} // definiujemy najwieksze wartosci obiektu

public plugin_init() {
    register_plugin("model", "1.0"," AUTHOR")
}
public client_death(killer,victim,weapon,hit,TK)
{
    static Float:victim_origin[3], Float:fNewOrigin[3]; // Tworzymy nowe wartosci Float
    // Ustawiamy pozycje dla obiektu!
    pev(victim,pev_origin,victim_origin); 
    new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"));
    fNewOrigin[0] = victim_origin[0] + 40.0;
    fNewOrigin[1] = victim_origin[1];
    fNewOrigin[2] = victim_origin[2] - 32.0;
    engfunc(EngFunc_SetOrigin,ent,fNewOrigin);
    
    if(!pev_valid(ent)) // Jezeli obiekt jest uszkodzony zatrzymujemy
        return 0;
    
    engfunc(EngFunc_SetModel,ent,"models/model.mdl"); // Ustawiamy model
    set_pev(ent,pev_classname,"model"); // Ustawiamy classe modelu,pomoze nam ona potem wyroznic model od reszty
    dllfunc(DLLFunc_Spawn, ent); // Stawiamy model
    set_pev(ent,pev_solid,SOLID_BBOX); // Ustawiamy trwalosc modelu
    set_pev(ent,pev_movetype,MOVETYPE_FLY); // Typ przesuwania ustawiamy na powietrze
    engfunc(EngFunc_SetSize,ent,MINS,MAXS); // Ustawiamy jego wielkosc!
    engfunc(EngFunc_DropToFloor,ent); // Ustawiamy go na ziemi ,aby nie latal
    
    return 0; // Zwracamy wartosc funkcji
}
Odpowiedz

  • +
  • -
G[o]Q - zdjęcie G[o]Q 05.01.2010

a moze jakis cod??
Odpowiedz

  • +
  • -
Miczu - zdjęcie Miczu 05.01.2010

Maruda jestes, ale masz jak chcesz:

#define DONT_IGNORE_MONSTERS            0
#define IGNORE_MONSTERS                 1
#define IGNORE_MISSILE                  2
#define IGNORE_GLASS                    0x100

engfunc(EngFunc_TraceLine, start, end, IGNORE_GLASS, 0, tr)

engfunc(EngFunc_TraceLine, start, end, DONT_IGNORE_MONSTERS, 0, tr)

engfunc(EngFunc_TraceLine, start, end, IGNORE_GLASS, 0, tr)

engfunc(EngFunc_TraceLine, start, end, IGNORE_GLASS, 0, tr)

// Description: This creates a trace handle! 
// It is important to use because we don't want our plugins to mess with eachothers info!
new ptr = create_tr2()

// Description: This creates a trace handle! 
// It is important to use because we don't want our plugins to mess with each others info!
free_tr2(ptr)

// Description: Gets/Sets information from/in the trace_handle
[g|s]et_tr2(trace_handle, CONSTANT, number_if_needed!)

enum TraceResult
{
	TR_AllSolid,		// int
	TR_StartSolid,		// int
	TR_InOpen,		// int
	TR_InWater,		// int
	TR_flFraction,		// float
	TR_vecEndPos,		// float array[3]
	TR_flPlaneDist,		// float
	TR_vecPlaneNormal,	// float array[3]
	TR_pHit,		// int (edict_t*)
	TR_iHitgroup,		// int
};

new allsolid = get_tr2(trace, TR_AllSolid)
	new startsolid = get_tr2(trace, TR_StartSolid)
	// TR_StartSolid is a boolean that says whether you were "inside" something 
	// (usually the world) when the trace started (point A)
	// TR_AllSolid tells you if you ever got out of the "inside" or not.
    
	new inopen = get_tr2(trace, TR_InOpen)
	// TR_InOpen means that the start point is in Open
	// That means in the world and not in an ent or something
	
	new hit = get_tr2(trace, TR_pHit)
	// What was hit by the traceline. It will either be a player index,
	// entity index, 0 (part of map), or -1 (didn't hit anything; 
	// doesn't happen with player tracelines).
    
	new hitgroup = get_tr2(trace, TR_iHitgroup)
	// If the traceline hit another player, returns will be HIT_HEAD,
	// HIT_CHEST, HIT_LEFTLEG... etc. If the traceline hit part of the
	// map, this returns HIT_GENERIC.
    
	new Float:fraction
	get_tr2(trace, TR_flFraction, fraction)
	// Returns a number between 0.0 and 1.0, indicating how far the
	// traceline traveled start to end before it hit something. Depending
	// on what conditions were passed to this traceline forward function,
	// it could either be a wall or another entity.
	
	new Float:end_origin[3]
	get_tr2(trace, TR_vecEndPos, end_origin)
	// The official end of the traceline. Not necesarily the same as the
	// second argument passed to this traceline forward function.
	
	new Float:normal[3]
	get_tr2(trace, TR_vecPlaneNormal, normal)
	// Returns a 1 unit long vector normal to the spot that it hit. Note
	// that "normal" has a special connotation here. It doesn't mean "regular."

stock is_wall_between_points(Float:start[3], Float:end[3], ignore_ent)
{
	// Create the trace handle! It is best to create it!
	new ptr = create_tr2()
	
	// The main traceline function!
	// This function ignores GLASS, MISSILE and MONSTERS!
	// Here is an example of how you should combine all the flags!
	engfunc(EngFunc_TraceLine, start, end, IGNORE_GLASS | IGNORE_MONSTERS | IGNORE_MISSILE, ignore_ent, ptr)
	
	// We are interested in the fraction parameter
	new fraction
	get_tr2(ptr, TR_flFraction, fraction)
	
	// Free the trace handle (don't forget to do this!)
	free_tr2(ptr)
	
	// If = 1.0 then it didn't hit anything!
	return (fraction != 1.0)
}
Odpowiedz

  • +
  • -
G[o]Q - zdjęcie G[o]Q 05.01.2010

ciesze sie ze skopiowales tamto no ale coz ja nie znam sie w ogóle na module fakemeta dlatego jakby ktos mogl powiedziec co mniej wiecej za co odpowiada i jak pobrac wspolrzedne celownika bo model na wsp postawic chyba umiem :D dodam ze chce zrobic sobie DR timer :D
Odpowiedz
Zablokowany