AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check if a user is in a bombsite? (https://forums.alliedmods.net/showthread.php?t=28907)

SweatyBanana 05-25-2006 16:23

Check if a user is in a bombsite?
 
Umm..cant find it in functions...how would I do this?

Hawk552 05-25-2006 17:27

You can try cs_get_user_plant.

Also, if that doesn't work, you can find all bombsites and just check in PreThink if they're anywhere near the site, in a certain radius.

SweatyBanana 05-25-2006 17:32

But thats the point...I dont want it when they are planting...I want it when they are in the site.

Hawk552 05-25-2006 17:39

Quote:

Originally Posted by SweatyBanana
But thats the point...I dont want it when they are planting...I want it when they are in the site.

If you actually read the function instead of blindly claiming that I'm wrong, you would see that it checks if they are capable of planting. I don't know if it takes into account whether they have the bomb or not.

You can also hook StatusIcon, I just don't remember the parameters for the bomb icon.

SweatyBanana 05-25-2006 17:47

Oooooo..

See what I thought that function was saying is if they were a terrorist with the bomb...


Not that they could plant the bomb in that spot.

Hawk552 05-25-2006 17:48

Quote:

Originally Posted by SweatyBanana
Oooooo..

See what I thought that function was saying is if they were a terrorist with the bomb...


Not that they could plant the bomb in that spot.

Whatever, worst case scenario is that you have to search around the player for the bombsite. Just use find_sphere_class every client frame or whatever, and check if there's a bomb entity around.

SweatyBanana 05-25-2006 17:49

Quote:

Whatever, worst case scenario is that you have to search around the player for the bombsite. Just use find_ent_sphere every client frame or whatever, and check if there's a bomb entity around.
Checking every client frame causes lag... Ive been reading through the includes :P

Hawk552 05-25-2006 17:50

Quote:

Originally Posted by SweatyBanana
Quote:

Whatever, worst case scenario is that you have to search around the player for the bombsite. Just use find_ent_sphere every client frame or whatever, and check if there's a bomb entity around.
Checking every client frame causes lag... Ive been reading through the includes :P

No, it doesn't. You'd be surprised how much is done in client_PreThink on the game mod level. Very resource intensive stuff should be kept out of there, but I think this should cause no problems.

EDIT: You can even do it outside of client_PreThink. Just don't use a set_task, client_PreThink is actually less resource intensive.

Kraugh 05-26-2006 03:01

players and bombsites are both rectangular, sphere calculations won't always work accurately in this instance.

Hawk552 05-26-2006 08:15

Quote:

Originally Posted by Kraugh
players and bombsites are both rectangular, sphere calculations won't always work accurately in this instance.

I don't think he needs to know if they're exactly in the bombsite, just somewhere around it.


All times are GMT -4. The time now is 16:21.

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