Add camera position on login

This commit is contained in:
Lennart Kampshoff
2018-09-22 00:14:38 +02:00
parent 24a8c975cf
commit 12a5ba79ad
5 changed files with 21 additions and 4 deletions

View File

@@ -8,6 +8,12 @@ var loginBrowser;
loginBrowser = mp.browsers.new('package://Login/login.html');
mp.gui.chat.activate(false);
mp.gui.cursor.show(true, true);
mp.game.ui.displayHud(false);
mp.game.ui.displayRadar(false);
var loginCam = mp.cameras.new('login', new mp.Vector3(-1883.736, -781.4911, 78.27616), new mp.Vector3(3.185999, 0, -79.59519), 40);
loginCam.setActive(true);
mp.game.cam.renderScriptCams(true, false, 0, true, false);
mp.events.add('loginInformationToServer', (password) => {
@@ -28,7 +34,9 @@ mp.events.add('registerSuccess', () => {
}
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
loginCam.setActive(false);
mp.game.cam.renderScriptCams(false, false, 0, true, false);
mp.game.ui.displayRadar(true);
});
mp.events.add('loginSuccess', () => {
mp.gui.chat.push("Erfolgreich eingeloggt!")
@@ -38,7 +46,9 @@ mp.events.add('loginSuccess', () => {
}
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
loginCam.setActive(false);
mp.game.cam.renderScriptCams(false, false, 0, true, false);
mp.game.ui.displayRadar(true);
});
mp.events.add('loginFail', (reason) => {

View File

@@ -11,11 +11,15 @@ namespace reallife_gamemode
{
public class Main : Script
{
public static readonly Vector3 DEFAULT_SPAWN_POSITION = new Vector3(-427.5189, 1116.453, 326.7829);
public static readonly float DEFAULT_SPAWN_HEADING = 340.8f;
[ServerEvent(Event.ResourceStart)]
public void OnResourceStart()
{
NAPI.Server.SetCommandErrorMessage("~r~[FEHLER]~s~ Dieser Command existiert nicht.");
NAPI.Util.ConsoleOutput("reallife-gamemode resource loaded!");
NAPI.Server.SetDefaultSpawnLocation(DEFAULT_SPAWN_POSITION, DEFAULT_SPAWN_HEADING);
NAPI.Server.SetAutoSpawnOnConnect(false);
}
}
}

View File

@@ -20,7 +20,8 @@ namespace reallife_gamemode.Server.Events
[ServerEvent(Event.PlayerConnected)]
public void OnPlayerConnected(Client player)
{
player.Position = new Vector3(-1883.736, -781.4911, -10);
player.FreezePosition = true;
}
}

View File

@@ -40,6 +40,7 @@ namespace reallife_gamemode.Server.Events
else
{
player.TriggerEvent("loginSuccess");
NAPI.Player.SpawnPlayer(player, Main.DEFAULT_SPAWN_POSITION, Main.DEFAULT_SPAWN_HEADING);
}
}
}

View File

@@ -29,6 +29,7 @@ namespace reallife_gamemode.Server.Events
registerUser.SaveChanges();
}
player.TriggerEvent("registerSuccess");
NAPI.Player.SpawnPlayer(player, Main.DEFAULT_SPAWN_POSITION, Main.DEFAULT_SPAWN_HEADING);
}
else if (player.SocialClubName == checkedUser.SocialClubName)
{