Raised This Month: $51 Target: $400
 12% 

Solved Check if player is within entity range.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
cheatscom
Junior Member
Join Date: Oct 2013
Location: I forget
Old 05-30-2020 , 07:58   Check if player is within entity range.
Reply With Quote #1

Hello,

I've been trying to create a script that will check if the client is within range of a specific entity, specifically a bomb plant zone within a map.

If they get within range of this entity I would like to be able to perform certain actions, but I'm having some trouble getting it to work. Essentially I want to compare [Player Position] with [Entity Position], where the entity is static in the map and player position will be dynamically updating.

Code:
decl Float:bombpos[3], Float:clientpos[3];
	
  new BombZone = CreateEntityByName("ddd_bomb_plant_zone");
  
  GetClientAbsOrigin(client, clientpos);
  GetEntPropVector(BombZone, Prop_Send, "ddd_bomb_plant_zone", bombpos);
		
    if(GetVectorDistance(clientpos, bombpos) < 100)
	 {
	   //Let me know that you're within range of this entity.
       PrintToChat(client, "In bomb zone");
     }
Notes:
1. "ddd_bomb_plant_zone" is an entity that already exists in the map.
2. There are multiple "ddd_bomb_plant_zone"(s) if that makes any difference.

What I'm currently doing is probably horribly wrong (please forgive me, this is all quite new stuff), any examples of how to add/change this and what I'm doing incorrectly would be much appreciated.

Thank you in advance for your time.

Last edited by cheatscom; 05-31-2020 at 05:43.
cheatscom is offline
 



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 18:36.


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