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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.