AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Findout if Player is on CT or T Base (https://forums.alliedmods.net/showthread.php?t=26058)

XCoder 03-26-2006 10:36

Findout if Player is on CT or T Base
 
Hello,

I have an simpel Problem with an Script.
I try to check via an "IF" if the player is on his OWN Base or on ENEMYS Base.

I tryd with if(cs_get_user_buyzone(id)>0), but this works only for own Buyzone, and if the Map didnt have an Buyzone... it want works...


So i need the Vars to check if the player is on own or enemy base..
Please help...


Thanks a lot.

XCoder

VEN 03-26-2006 12:19

There are no nice ways.

Brad 03-26-2006 12:39

Not a very helpful response, VEN.

FatalisDK 03-26-2006 12:44

Something like this should work. (more experienced coders can optimize this I bet)

Code:
new Float:origin[3] entity_get_vector(id, EV_VEC_origin, origin) new ent = find_entity_sphere(id, origin, 128.0) while(ent > 0) {     new classname[32]     entity_get_string(ent, EV_SZ_classname, classname, 31)     if(equal(classname, "info_player_start"))     {         //Player is near CT spawn     }     if(equal(classname, "info_player_deathmatch"))     {         //Player is near T spawn     }     ent = find_entity_sphere(ent, origin, 128.0) }

VEN 03-26-2006 12:47

Quote:

Not a very helpful response, VEN.
But he better know the truth.
Quote:

Player is near
That's what i mean.

Hawk552 03-26-2006 15:30

Quote:

Originally Posted by FatalisDK
Something like this should work. (more experienced coders can optimize this I bet)

Slight optimization:
Code:
    new Float:vOrigin[3],szClassname[32],iEnt     entity_get_vector(id,EV_VEC_origin,vOrigin)     while((iEnt = find_ent_in_sphere(id,vOrigin,128.0)) != 0)     {         entity_get_string(iEnt,EV_SZ_classname,szClassname,31)                 if(equal(szClassname,"info_player_start"))         {             //Player is near CT spawn         }         else if(equal(szClassname,"info_player_deathmatch"))         {             //Player is near T spawn         }     }

Brad 03-26-2006 15:37

That code tells you when you're near a spawn point but that doesn't necessarily mean you're in a buy zone.

Just wanted to make that clear in case being in the buyzone is what he's really after.

XCoder 03-27-2006 01:54

um okay thanks verry much, but i dont understand what this makes

else if(equal(szClassname,"info_player_deathmatch" ))

What info_player_deathmatch means?
Is this normal for Terror Base?


Greets

XCoder

FatalisDK 03-27-2006 01:55

Yes, it's a T spawn point.

XCoder 03-27-2006 02:02

Okay great...

Then should it work like i want it ...
I will try it out now!

Hope Server dont crash :)


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

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