AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   find_ent_in_sphere (https://forums.alliedmods.net/showthread.php?t=141063)

Schwabba 10-19-2010 05:33

find_ent_in_sphere
 
I wanna remove all ent's 50 units around a player:

PHP Code:

    new origin[3]
    
get_user_origin(idorigin0)
    new 
ent = -1
    
while((ent find_ent_in_sphere(ent,origin,50.0)) != 0) { // warning 213: tag mismatch on this line
        
remove_entity(ent)
    } 


issen1 10-19-2010 05:38

Re: find_ent_in_sphere
 
Code:
// find_ent_in_sphere ( StartEntity, Float:origin[3], Float:radius ) // -> new Float:origin[3]

Schwabba 10-19-2010 05:41

Re: find_ent_in_sphere
 
Same problem, but now on get_user_origin.

issen1 10-19-2010 05:47

Re: find_ent_in_sphere
 
No, this time the tag mismatch comes from get_user_origin, because it's returning an int array.

You might consider using pev or entity_get_vector, because they are returning a float array. Not sure, though.

Schwabba 10-19-2010 06:25

Re: find_ent_in_sphere
 
PHP Code:

    new Float:origin[3];
    
pev(id,pev_origin,origin);
    new 
ent = -1
    
while((ent find_ent_in_sphere(ent,origin,50.0)) != 0) {
        
remove_entity(ent)
    } 

Now Server crashes :/

EDIT: LOL, i removed myself.. omg.. now it works.. thank you

mottzi 10-19-2010 11:10

Re: find_ent_in_sphere
 
Write here, what the error was, then other people can search if they have the same problem.

issen1 10-19-2010 11:49

Re: find_ent_in_sphere
 
Quote:

Originally Posted by mottzi (Post 1329380)
Write here, what the error was, then other people can search if they have the same problem.

He did write what the problem was. He removed his own player entity, thus stopping the LAN-server.

Edit: Look one post later. Thanks.

Exolent[jNr] 10-19-2010 17:51

Re: find_ent_in_sphere
 
Quote:

Originally Posted by issen1 (Post 1329425)
He did write what the problem was. He removed his own player entity, thus stopping the LAN-server.

Actually, if you use remove_entity() (or FM's EngFunc_RemoveEntity) on a player, the server will crash.
It wasn't specific to him being the LAN owner.

Schwabba 10-19-2010 19:47

Re: find_ent_in_sphere
 
Exactly that was the problem.


All times are GMT -4. The time now is 10:19.

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