Jump to content
Sign in to follow this  
kmiles1990

Select Spawns

Recommended Posts

Is there any way to add spawns to specific players? Basically if I want this specific steamId to have an option to either spawn at this certain spot, or spawn randomly. Is that something that can be done?

Share this post


Link to post
Share on other sites
18 minutes ago, kmiles1990 said:

Is there any way to add spawns to specific players? Basically if I want this specific steamId to have an option to either spawn at this certain spot, or spawn randomly. Is that something that can be done?

Yes you can, but you have to develop this function, is easy, i am not at home now to do

Share this post


Link to post
Share on other sites
Just now, LastS said:

Yes you can, but you have to develop this function, is easy, i am not at home now to do

When you get home, could you possibly show me an example? Just not sure where to start with this one.

Share this post


Link to post
Share on other sites
1 minute ago, kmiles1990 said:

When you get home, could you possibly show me an example? Just not sure where to start with this one.

Yeep

Share this post


Link to post
Share on other sites

I don't have any code available right now but it would be something along the lines of an if-statement, comparing the player.GetIdentity().GetId() (believe this one was the Steam ID) to an ID you specified. Then spawn that person at the specified location. Else spawn randomly.

Share this post


Link to post
Share on other sites

a little search and read others post is enough.

unpbo the dta/scripts.pbo file and search in that folder to know what functions you can use

Edited by Sentepu

Share this post


Link to post
Share on other sites
4 hours ago, Sentepu said:

a little search and read others post is enough.

unpbo the dta/scripts.pbo file and search in that folder to know what functions you can use

That post literally has nothing to do with my question.

Share this post


Link to post
Share on other sites
5 hours ago, IMT said:

I don't have any code available right now but it would be something along the lines of an if-statement, comparing the player.GetIdentity().GetId() (believe this one was the Steam ID) to an ID you specified. Then spawn that person at the specified location. Else spawn randomly.

Yea I know how to determine which steamId, the problem is what do I put to spawn a character at a specific location in the init.c

Share this post


Link to post
Share on other sites

you have all the ID part there with a switch, create character is already in the init.c ...

Share this post


Link to post
Share on other sites

Hmm, so basically in the CreateCharacter, I would just check for the specific ID, and if it matches, set to POS part to the vector coordinates I want?

Share this post


Link to post
Share on other sites

That being said though, how do I allow the specific player to choose there spawn on death?

Share this post


Link to post
Share on other sites
10 hours ago, LastS said:

Yeep

Would it be something like this?

override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		
		
		string SteamId_Admin = "76561198109829398"; // SteamID
		
		if (player.GetIdentity().GetPlainId() == SteamId_Admin) {
			
			Entity playerEnt;
			playerEnt = GetGame().CreatePlayer(identity, characterName, pos /*How would I add the positon? as a vector?*/, 0, "NONE");//Admin Positon
			Class.CastTo(m_player, playerEnt);
			
			GetGame().SelectPlayer(identity, m_player);
			// Could I put it on a timer? Like 60 minute cool down? If he spawned here, he will spawn randomly on death for the next 60 minutes until CD is done?
		} else {
			
			Entity playerEnt;
			playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
			Class.CastTo(m_player, playerEnt);
			
			GetGame().SelectPlayer(identity, m_player);
		}
			
		return m_player;
	}

 

Share this post


Link to post
Share on other sites
On 14-11-2018 at 7:34 PM, kmiles1990 said:

bump Can something like this be done?

override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{		
		Entity playerEnt;
		playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
		Class.CastTo(m_player, playerEnt);
		GetGame().SelectPlayer(identity, m_player);
		switch(player.GetIdentity().GetPlainId()){
			case "76561198109829398":
				player.SetPosition("3413.27 24 14808.81"); // tisy
				break;
			case "xxxxxxxxxxxxxxxxx":
				player.SetPosition("6106.24 24 7736.40"); //stary sobor
				break;
			default:
				//normal players
				break;
		}
		return m_player;
	}

untested.

Share this post


Link to post
Share on other sites
On 11/20/2018 at 4:09 AM, kaspar rave said:

override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{		
		Entity playerEnt;
		playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
		Class.CastTo(m_player, playerEnt);
		GetGame().SelectPlayer(identity, m_player);
		switch(player.GetIdentity().GetPlainId()){
			case "76561198109829398":
				player.SetPosition("3413.27 24 14808.81"); // tisy
				break;
			case "xxxxxxxxxxxxxxxxx":
				player.SetPosition("6106.24 24 7736.40"); //stary sobor
				break;
			default:
				//normal players
				break;
		}
		return m_player;
	}

untested.

Any update regarding this? Tested yet?

Share this post


Link to post
Share on other sites

Did anyone test this and get it working?

One of the things that would have been on my wishlist from the start was ability to spawn certain characters at certain locations, very handy for server events :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×