Raised This Month: $ Target: $400
 0% 

Detecting entity inside a zone


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-28-2017 , 09:57   Re: Detecting entity inside a zone
Reply With Quote #1

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 #2

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 #3

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
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