Racey66 0 Posted February 26, 2021 Is there anyone who knows how to add a code to our init.c file so that we can enter a steam i.d. and that player will spawn in a specific location? There would be about 20 or so Steam id,s so hopefully if it can be done their numbers could be added to a string of some kind. $$ Donation available to anyone who can help Share this post Link to post Share on other sites
Tisho 0 Posted October 3, 2021 You can make a list of strings and check if the each connected player is in the list then spawn them at a desired location Here's an example code: const int MaxSpecialPlayers=10; //number of players std::string SpecialPlayers[MaxSpecialPlayers]={ steam ids here seperated by comas }; for(unsigned char i=0;i<MaxSpecialPlayers;i++) { if(connected player==SpecialPlayers) { vector pos=coordinates of the place you want the player to spawn; Entity playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE"); } } Share this post Link to post Share on other sites
NoBeansForMe 14 Posted October 4, 2021 (edited) This code works for me: class CustomMission: MissionServer { // Default code for this class goes here. Put the code below at the bottom of this class. // Teleport player to a specified coordinate on connect depending on the SteamID - Code start override void InvokeOnConnect(PlayerBase player, PlayerIdentity identity) { super.InvokeOnConnect(player, identity); // Define the X and Z coordinates below where the player(s) will spawn when they connect. float xCoordinate = 4661; float zCoordinate = 10330; // Enter the SteamID or the BI-UID for the player(s) you want to spawn at the above coordinates. // Separate with a comma if you have more than one player. ref TStringArray spawnPlayers = {"76561198000000001", "76561198000000002", "76561198000000003"}; // Check if the current player is on the above list. If so, make him/her spawn at the specified coordinates. for (int i = 0; i < spawnPlayers.Count(); ++i ) { if(player.GetIdentity().GetId() == spawnPlayers[i] || player.GetIdentity().GetPlainId() == spawnPlayers[i]) { float yCoordinate = GetGame().SurfaceY(xCoordinate, zCoordinate); vector spawnCoordinates = Vector(xCoordinate, yCoordinate, zCoordinate); player.SetPosition(spawnCoordinates); break; } } } // Teleport player to a specified coordinate on connect depending on the SteamID - Code end }; This will apply to respawns as well. If a player with a matching SteamID dies he/she will respawn at the given coordinates. I haven't tried the code with multiple Steam ID's, but it should work. Edited October 4, 2021 by NoBeansForMe Share this post Link to post Share on other sites