ForcePlayerPosition on all players
Discussion in 'Rust Development' started by just1n_rocks, Jun 3, 2015.
-
Wulf Community Admin
Loop through all players and run the function on each.
https://github.com/OxideMod/Oxide/blob/master/Oxide.Ext.Rust/RustPlugin.cs#L247 -
how exactly would i come about that i understand why you would loop it but not really how to get each player into it
-
Wulf Community Admin
For Lua, something like this:
If you need it for C#, you'd need to change it around a bit.Code:local playerList = global.BasePlayer.activePlayerList:GetEnumerator() while playerList:MoveNext() do local player = playerList.Current rust.ForcePlayerPostion(player,destination.x,destination.y,destination.z) end -
oh there is a global class
-
Wulf Community Admin
That's only used for non-C# languages. -
so in c# would i just use playerlist?
[DOUBLEPOST=1433296780][/DOUBLEPOST]k I got it to get the enum and cycle through it but i cant take the specific player out of it
[DOUBLEPOST=1433302295,1433291465][/DOUBLEPOST]i think i got it
[DOUBLEPOST=1433302341][/DOUBLEPOST]Code:[ChatCommand("start")] void start(string command,string[] args) { gamestarted = true; foreach (BasePlayer player in BasePlayer.activePlayerList) { ForcePlayerPosition(player, "-590.5, 2.3, 51.6".ToVector3()); player.Respawn(); }Code:[ChatCommand("start")] void start(string command,string[] args) { gamestarted = true; foreach (BasePlayer player in BasePlayer.activePlayerList) { ForcePlayerPosition(player, "-590.5, 2.3, 51.6".ToVector3()); player.Respawn(); }
