Teleport to random position
How can I teleport a player to a random position in the map?
Dosnt matter if its on a wall or something because I can teleport him until this stock turns false PHP Code:
|
Re: Teleport to random position
To generate random valid origins: https://forums.alliedmods.net/showthread.php?t=309495
Then, just use EngFunc_SetOrigin |
Re: Teleport to random position
Quote:
PHP Code:
Also, I got 2 warnings when did that: CheckPointsForVisibility never used NumberOfOrigins is assigned and never used Edit: dont work Edit2: with ROGInitialize(250.0) works, thanks :) |
Re: Teleport to random position
You have an example plugin in the topic, read it. It does what you want already. But, long story short: you need to initialize the random origin generator(obviously, can't use something that was not initialized) and then you can just retrieve the next available origin and use EngFunc_SetOrigin.
Also, feel free to ignore any warning you may get. If you tried something, show the code. Saying "it does not work" is not helpful at all. How am I supposed(or anyone else) to know what you did wrong when you don't show what you did? |
Re: Teleport to random position
Quote:
|
Re: Teleport to random position
Are you absolutely sure about that? I can clearly see a call to ROGInitialize in plugin_init inside the example code. You aren't supposed to initialize it every single time, just once, in plugin_init(exactly like it is shown in the example code which you didn't bother to read).
You also didn't bother to post the full code so I had no way of knowing if you had ROGInitialize in plugin_init or not. To everyone: please comply with what is asked, we don't ask random stuff just for the sake of it. Stop making our job harder by being stubborn. If we ask you to post the entire plugin, post it, we have our reasons. Otherwise, if you insist on knowing better what is needed and what is not, just fix it by yourself. |
Re: Teleport to random position
Quote:
|
Re: Teleport to random position
I'm not sure what you are asking, the spawn points are validated as much as possible already.
If you have a certain map in mind where bad spawn points are generated, attach it. Also, it would be better to post in the ROG topic, not here. |
| All times are GMT -4. The time now is 11:41. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.