AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   info_player_start and info_player_deathmatch (https://forums.alliedmods.net/showthread.php?t=155523)

Screeaam.. 04-23-2011 08:40

info_player_start and info_player_deathmatch
 
Hello! How Can I get coords form:

info_player_deathmatch and:
info_player_start

And spawn on it something?

Arkshine 04-23-2011 09:03

Re: info_player_start and info_player_deathmatch
 
find_ent_by_class + pev_origin

Screeaam.. 04-23-2011 09:33

Re: info_player_start and info_player_deathmatch
 
Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#include <engine>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Screeaam"

new const g_w_npc[] = "models/charsi.mdl";

new const spawnEntString[2][] = {"info_player_start","info_player_deathmatch"}

public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        register_clcmd("say /make", "respawn");
}

public plugin_precache() 
{
        engfunc(EngFunc_PrecacheModel, g_w_npc);
}

public respawn(id)
{
        client_print(id, print_chat, "DEBUG NPC");
        new ct = find_ent_by_class(id, spawnEntString[0]);
        new tt = find_ent_by_class(id, spawnEntString[1]);
       
        new ctOr[3], ttOr[3];
       
        pev(ct,pev_origin, ctOr);
        pev(tt,pev_origin, ttOr);
       
        Create_NPC(ctOr);
        Create_NPC(ttOr);
}

public Create_NPC(Origin[3])
{
        new Float:flOrigin[3]
        IVecFVec(Origin, flOrigin)

        new charsi_ent = create_entity("info_target")

        if(pev_valid(charsi_ent))
        {
                entity_set_string(charsi_ent, EV_SZ_classname, "npc")
                               
                entity_set_int(charsi_ent, EV_INT_solid, SOLID_BBOX)
                entity_set_int(charsi_ent, EV_INT_movetype, MOVETYPE_NONE)
                entity_set_edict(charsi_ent, EV_ENT_owner, 0)

                drop_to_floor(charsi_ent)

                entity_set_vector(charsi_ent, EV_VEC_origin, flOrigin)
               
                entity_set_model(charsi_ent, g_w_npc)
                entity_set_size(charsi_ent, Float:{-12.5, -12.5, -56.5}, Float:{12.5, 12.5, 66.5})               

                entity_set_float(charsi_ent,EV_FL_nextthink,halflife_time() + 0.01)
        }
}

Why doesn't work?

Arkshine 04-23-2011 10:04

Re: info_player_start and info_player_deathmatch
 
You forget Float: for ctOr and ttOr, and Origin[3].

Screeaam.. 04-23-2011 10:10

Re: info_player_start and info_player_deathmatch
 
It works. And now I know if an area where you want to spawn ent is a player and if is, it should search for another location?

Sorry for my english.

Arkshine 04-23-2011 10:12

Re: info_player_start and info_player_deathmatch
 
You should look at the existing tutorials/plugins about finding a location, it will be helpful.

Screeaam.. 04-23-2011 10:22

Re: info_player_start and info_player_deathmatch
 
In which plugin can I find such a thing?


All times are GMT -4. The time now is 19:48.

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