AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Set origin within a range (https://forums.alliedmods.net/showthread.php?t=162585)

bibu 07-20-2011 17:09

Set origin within a range
 
What can I use, to set the origin of the player within a range/radius of 100 on the ground.

PHP Code:

            new origin[3]
            
get_user_origin(tempidorigin)
            
            
set_user_origin(idorigin


nikhilgupta345 07-20-2011 17:19

Re: Set origin within a range
 
You mean randomly in a 100 unit radius?

bibu 07-20-2011 17:20

Re: Set origin within a range
 
Just around yes, so it won't be in the exact same of the origin cause of stuck possibilities. The range could go up to 200 I think.

nikhilgupta345 07-20-2011 17:21

Re: Set origin within a range
 
Well, you could use the exact same origin and then have a plugin to prevent stuck

bibu 07-20-2011 17:22

Re: Set origin within a range
 
Well not just cause of stuck, will do that for sure. Just I want to manipulate the origin abit.

Exolent[jNr] 07-20-2011 18:59

Re: Set origin within a range
 
Code:
new random_origin[3] random_origin[0] = random(100) random_origin[1] = origin[1] + random(sqroot(10000 - (random_origin[0] * random_origin[0]))) random_origin[0] += (random(2) ? origin[0] : -origin[0]) random_origin[2] = origin[2]

That will generate a random origin within a 100 radius, only taking into account a horizontal radius.

bibu 07-21-2011 00:55

Re: Set origin within a range
 
Quote:

Error: Undefined symbol "sqrt".

nikhilgupta345 07-21-2011 00:58

Re: Set origin within a range
 
Could you really not search and find the square root function yourself?

http://www.amxmodx.org/funcwiki.php?go=func&id=75

Exolent[jNr] 07-21-2011 09:07

Re: Set origin within a range
 
Quote:

Originally Posted by bibu (Post 1515037)
Error: Undefined symbol "sqrt".

Fixed code.

Quote:

Originally Posted by nikhilgupta345 (Post 1515040)
Could you really not search and find the square root function yourself?

http://www.amxmodx.org/funcwiki.php?go=func&id=75

Not the float one.

bibu 07-27-2011 06:56

Re: Set origin within a range
 
Still it doesn't change the origin at all.


All times are GMT -4. The time now is 00:56.

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