Raised This Month: $ Target: $400
 0% 

info_player_start and info_player_deathmatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 04-23-2011 , 08:40   info_player_start and info_player_deathmatch
Reply With Quote #1

Hello! How Can I get coords form:

info_player_deathmatch and:
info_player_start

And spawn on it something?
Screeaam.. is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-23-2011 , 09:03   Re: info_player_start and info_player_deathmatch
Reply With Quote #2

find_ent_by_class + pev_origin
__________________
Arkshine is offline
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 04-23-2011 , 09:33   Re: info_player_start and info_player_deathmatch
Reply With Quote #3

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?
Screeaam.. is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-23-2011 , 10:04   Re: info_player_start and info_player_deathmatch
Reply With Quote #4

You forget Float: for ctOr and ttOr, and Origin[3].
__________________
Arkshine is offline
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 04-23-2011 , 10:10   Re: info_player_start and info_player_deathmatch
Reply With Quote #5

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.
Screeaam.. is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-23-2011 , 10:12   Re: info_player_start and info_player_deathmatch
Reply With Quote #6

You should look at the existing tutorials/plugins about finding a location, it will be helpful.
__________________
Arkshine is offline
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 04-23-2011 , 10:22   Re: info_player_start and info_player_deathmatch
Reply With Quote #7

In which plugin can I find such a thing?
Screeaam.. is offline
Reply


Thread Tools
Display Modes

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 19:48.


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