Sign in to follow this  
Stefan Todorovski

[C#] Positioning the player problem

Recommended Posts

Hello, scripters! 😀
I'm new to the RAGE scene and recently started scripting my own gamemode. I'm using WiredPlayers gamemode as an example, but i have some strange issues. So far i succeeded creating VS solution, connecting it with MySQL database and player authentication system. But i have one problem with recreating the lobby system: I can't set the player position when they are logging in, but strangely enough i can change other player-related properties like skin.

Here is my code:

[ServerEvent(Event.PlayerConnected)]
public void OnPlayerConnected(Client player)
{
  NAPI.Player.SetPlayerSkin(player, PedHash.Stripper01SFY); // WORKS PERFECTLY
  player.Transparency = 255;
  InitializePlayerData(player); // CALLING THE INITIALIZEPLAYERDATA FUNCTION
  //Other stuff for logging the user
}

private void InitializePlayerData(Client player)
{
  player.Position = new Vector3(152.26, -1004.47, -99.00); //DOESN'T TELEPORT THE PLAYER AT THIS POSITION
  player.Dimension = Convert.ToUInt32(player.Value);
  player.Health = 100;
}

But when i finish logging in and i use the command /goto, it teleports me to that destination.

[Command("goto", "~y~USAGE: ~w~/goto")]
public void CMD_Goto(Client player)
{
	player.Position = new Vector3(152.26, -1004.47, -98.00);
}

Is there something i'm missing in order for this to work ?? 

Edited by Stefan Todorovski

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.