Raised This Month: $209 Target: $400
 52% 

why this not work?


Post New Thread Reply   
 
Thread Tools Display Modes
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
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-02-2021 , 19:46   Re: why this not work?
Reply With Quote #2

1. Dont code like that, it kills readability.

2. Change

new iEntity = taskid

to

new iEntity = taskid - TASK_CHECK_ORIGIN;
__________________

Last edited by Bugsy; 04-02-2021 at 19:46.
Bugsy is offline
LondoN
Senior Member
Join Date: Dec 2015
Location: Roman, Romania.
Old 04-04-2021 , 02:00   Re: why this not work?
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
1. Dont code like that, it kills readability.

2. Change

new iEntity = taskid

to

new iEntity = taskid - TASK_CHECK_ORIGIN;
Code:
#define ID_ORIGIN	(taskid - TASK_CHECK_ORIGIN)
Code:
new iEntity = ID_ORIGIN;
i can't understand why isn't working. distance from the ground (spawnpoint) must be in the range (curentorigin-spawnorigin >= max_range in air, then slay
__________________
LondoN is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-04-2021 , 06:48   Re: why this not work?
Reply With Quote #4

From when is [ 1 ] axis for vertical distance? Use [ 2 ] / z

Also:
Quote:
Originally Posted by Bugsy View Post
1. Dont code like that, it kills readability.
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...)

Last edited by JocAnis; 04-04-2021 at 06:49.
JocAnis 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 16:31.


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