Raised This Month: $ Target: $400
 0% 

Detecting entity inside a zone


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Creater RJ
Junior Member
Join Date: Jun 2017
Old 06-27-2017 , 22:20   Detecting entity inside a zone
Reply With Quote #1

Is it possible to detect a non - player entity inside a zone ? buyzone, escapezone, etc
Creater RJ is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-28-2017 , 09:57   Re: Detecting entity inside a zone
Reply With Quote #2

Yes.

I'l show a method when i will have free time, until then i will post just the function i use:

Code:
bool:isPlayer(i) {     new classname[8];     pev( i, pev_classname, classname, charsmax(classname) );     return  classname[0] == 'p'         && classname[1] == 'l'         && classname[2] == 'a'         && classname[3] == 'y'          && classname[4] == 'e'         && classname[5] == 'r'         && classname[6] == EOS; }
__________________
Project: Among Us

Last edited by Craxor; 06-28-2017 at 15:15.
Craxor is offline
Send a message via ICQ to Craxor
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 06-28-2017 , 10:13   Re: Detecting entity inside a zone
Reply With Quote #3

Quote:
Originally Posted by Craxor View Post
Code:
return bool:(classname[0]=='p'&&classname[1]=='l'&&classname[3]=='y'&&classname[5]=='r');
It is already bool and you should check all 7 cells.
Code:
return classname[0] == 'p' && classname[1] == 'l' && classname[2] == 'a' && classname[3] == 'y' && classname[4] == 'e' && classname[5] == 'r' && classname[6] == EOS;
But easier and better just check for is_user_connected or is_user_alive or 1 <= player <= MaxPlayers (get_maxplayers()).
__________________

Last edited by PRoSToTeM@; 06-28-2017 at 10:14.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Creater RJ
Junior Member
Join Date: Jun 2017
Old 06-28-2017 , 10:58   Re: Detecting entity inside a zone
Reply With Quote #4

Quote:
Originally Posted by Craxor View Post
Yes.

I'l show a method when i will have free time, until then i will post just the function i use:

PHP Code:
bool:isPlayer(i)
{
    new 
classname[8];
    
pevipev_classnameclassnamecharsmax(classname) );

    return 
bool:(classname[0]=='p'&&classname[1]=='l'&&classname[3]=='y'&&classname[5]=='r');

Sorry i didnt get you, i want to detect a non-player entity inside a zone , something like cs_get_user_mapzones(player) which will work only for players , i want for non-player entity
Creater RJ is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-28-2017 , 15:18   Re: Detecting entity inside a zone
Reply With Quote #5

Yes, you can use my function to check if is a non player by doing:

Code:
if( !isPlayer(ent) ) { }

Also i've editet the func with prostemato suggestions, check again the code.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-28-2017 , 16:16   Re: Detecting entity inside a zone
Reply With Quote #6

Quote:
Originally Posted by Craxor View Post
Yes, you can use my function to check if is a non player by doing:

Code:
if( !isPlayer(ent) ) { }

Also i've editet the func with prostemato suggestions, check again the code.
That's not what he is asking....
He's asking how to check if an entity is inside a zone. I think I posted some snippet for that 2/3 times some years ago, you may try to search...
__________________

Last edited by HamletEagle; 06-28-2017 at 16:16.
HamletEagle is offline
Creater RJ
Junior Member
Join Date: Jun 2017
Old 06-28-2017 , 18:55   Re: Detecting entity inside a zone
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
That's not what he is asking....
He's asking how to check if an entity is inside a zone. I think I posted some snippet for that 2/3 times some years ago, you may try to search...
I tried searching your posts and didnt get any related title for this it will be great if you can do the favour, thanks in advance
Creater RJ is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 06-28-2017 , 17:19   Re: Detecting entity inside a zone
Reply With Quote #8

Depending what zone you want to check...
baneado is offline
Creater RJ
Junior Member
Join Date: Jun 2017
Old 06-28-2017 , 18:57   Re: Detecting entity inside a zone
Reply With Quote #9

Quote:
Originally Posted by baneado View Post
Depending what zone you want to check...
It may be any zone, escape zone, buyzone or bombsite zone as i am going to create it myself using valve hammer, I just want to detect if that entity is inside that zone/area
Creater RJ is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-28-2017 , 23:26   Re: Detecting entity inside a zone
Reply With Quote #10

Check 'zone info' by alka.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
Reply



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 23:08.


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