View Single Post
Author Message
LondoN
Senior Member
Join Date: Dec 2015
Location: Roman, Romania.
Old 04-02-2021 , 19:25   why this not work?
Reply With Quote #1

i used a simple logic for getting player position in the map (upward) and slay if they are on a position up than a range. but didn't work, any solution or other method?

Code:
#include < amxmodx >
#include < amxmisc >
#include < engine >
#include < hamsandwich >

#define Y_AXIS_MAX		50
#define TASK_CHECK_ORIGIN	2932
#define ID_ORIGIN	(taskid - TASK_CHECK_ORIGIN)

new g_EntityOrigin [ 33 ] [ 3 ];

public plugin_init ( )	RegisterHam ( Ham_Spawn, "player", "OnPlayerSpawnPost", 1 );
public client_death ( iEntity, iVictim, ShouldGIB )	if ( task_exists ( iVictim + TASK_CHECK_ORIGIN ) ) remove_task ( iVictim + TASK_CHECK_ORIGIN );
public OnPlayerSpawnPost ( iEntity ) {
	if ( is_user_connected ( iEntity ) && is_user_alive ( iEntity ) ) {
		get_user_origin ( iEntity, g_EntityOrigin [ iEntity ] );
		set_task ( 25.0, "CheckOrigin", iEntity + TASK_CHECK_ORIGIN, .flags="b" );
	}
}

public CheckOrigin ( taskid ) {
	new iEntity = ID_ORIGIN;
	new iCurrentEntityOrigin [ 3 ];
	get_user_origin ( iEntity, iCurrentEntityOrigin );

	/*
	X - Determines your position East/West in the map. A positive value increases your position to the East. ...
	Y - Determines your position up/down in the map. A positive value increases your position upward. ...
	Z - Determines your position South/North in the map.
	*/

	if ( iCurrentEntityOrigin [ 1 ] - g_EntityOrigin [ iEntity ] [ 1 ] >= Y_AXIS_MAX )
		user_silentkill ( iEntity );
}
__________________
LondoN is offline