Xabi Posted July 16, 2018 Author Posted July 16, 2018 It receives an array of strings, where the first one string is the function's name to execute on the browser and the rest of the strings are the parameters passed to that function.
Roven Posted July 16, 2018 Posted July 16, 2018 Thanks. And the name forumName in the database for that name socialName - the name of the account in social club forumName???
Xabi Posted July 16, 2018 Author Posted July 16, 2018 2 hours ago, Roven said: Thanks. And the name forumName in the database for that name socialName - the name of the account in social club forumName??? It's not used currently, so you can leave it empty.
Roven Posted July 18, 2018 Posted July 18, 2018 (edited) mp.events.add('guiReady', () => { // Remove health regeneration mp.game.player.setHealthRechargeMultiplier(0.0); // Remove weapons from the vehicles mp.game.player.disableVehicleRewards(); // Freeze the player until he logs in mp.players.local.freezePosition(true); // Show the login panel when all is loaded /*loginTimer = setInterval(function() { // Get the time from the server let serverTime = mp.players.local.getVariable('SERVER_TIME'); if(serverTime !== undefined) { // Clear the timer clearInterval(loginTimer); loginTimer = undefined; // Set the hour from the server let time = serverTime.split(':'); let hours = parseInt(time[0]); let minutes = parseInt(time[1]); let seconds = parseInt(time[2]); mp.game.time.setClockTime(hours, minutes, seconds); } // Show the login window mp.events.call('accountLoginForm'); }, 100);*/ // Show the login window mp.events.call('accountLoginForm'); }); Good. I still wonder... Why is the accountLoginForm method executed when I don't call the guiReady method? I call the method guiReady in the backend, but he's here in the client side is invoked itself Edited July 18, 2018 by Roven
Xabi Posted July 18, 2018 Author Posted July 18, 2018 15 minutes ago, Roven said: mp.events.add('guiReady', () => { // Remove health regeneration mp.game.player.setHealthRechargeMultiplier(0.0); // Remove weapons from the vehicles mp.game.player.disableVehicleRewards(); // Freeze the player until he logs in mp.players.local.freezePosition(true); // Show the login panel when all is loaded /*loginTimer = setInterval(function() { // Get the time from the server let serverTime = mp.players.local.getVariable('SERVER_TIME'); if(serverTime !== undefined) { // Clear the timer clearInterval(loginTimer); loginTimer = undefined; // Set the hour from the server let time = serverTime.split(':'); let hours = parseInt(time[0]); let minutes = parseInt(time[1]); let seconds = parseInt(time[2]); mp.game.time.setClockTime(hours, minutes, seconds); } // Show the login window mp.events.call('accountLoginForm'); }, 100);*/ // Show the login window mp.events.call('accountLoginForm'); }); Good. I still wonder... Why is the accountLoginForm method executed when I don't call the guiReady method? I call the method guiReady in the backend, but he's here in the client side is invoked itself It's not a method, it's an event that gets called when the player has fully loaded the client scripts.
Roven Posted July 18, 2018 Posted July 18, 2018 Is the guiReady event raised on the server side? Or just the Rage system on the client side calls?
Xabi Posted July 19, 2018 Author Posted July 19, 2018 16 hours ago, Roven said: Is the guiReady event raised on the server side? Or just the Rage system on the client side calls? Only clientside.
Roven Posted July 19, 2018 Posted July 19, 2018 Thank you! Here are two methods InitializePlayerData(player); Initialize Player Skin(player); Since the skin of the player is given by the method Task.Factory.StartNew(() => { AccountModel account = DataBase.GetAccount(player.Name); switch (account.Status) { case -1: NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + Messages.INF_ACCOUNT_DISABLED); NAPI.Player.KickPlayer(player, Messages.INF_ACCOUNT_DISABLED); break; case 0: NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + Messages.INF_ACCOUNT_NEW); NAPI.Player.KickPlayer(player, Messages.INF_ACCOUNT_NEW); break; default: // Welcome message String welcomeMessage = String.Format(Messages.GEN_WELCOME_MESSAGE, player.Name); NAPI.Chat.SendChatMessageToPlayer(player, welcomeMessage); NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_WELCOME_HINT); NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_HELP_HINT); NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_TICKET_HINT); if (account.Skin > 0) { // Load selected character PlayerModel character = DataBase.LoadCharacterInformationById(account.Skin); SkinModel skin = DataBase.GetCharacterSkin(account.Skin); NAPI.Player.SetPlayerName(player, character.RealName); NAPI.Player.SetPlayerSkin(player, character.Sex == 0 ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01); LoadCharacterData(player, character); PopulateCharacterSkin(player, skin); } else { // Set the default skin a_c_coyote NAPI.Player.SetPlayerSkin(player, PedHash.Strperf01SMM); } // Make the player invisible NAPI.Entity.SetEntityTransparency(player, 255); // Activate the login window NAPI.Data.SetEntitySharedData(player, EntityData.SERVER_TIME, DateTime.Now.ToString("HH:mm:ss")); break; } }); // Set the default skin a_c_coyote NAPI.Player.SetPlayerSkin(player, PedHash.Strperf01SMM); Can you tell what they do I why ask, just studying this project
Xabi Posted July 19, 2018 Author Posted July 19, 2018 1 hour ago, Roven said: Thank you! Here are two methods InitializePlayerData(player); Initialize Player Skin(player); Since the skin of the player is given by the method Task.Factory.StartNew(() => { AccountModel account = DataBase.GetAccount(player.Name); switch (account.Status) { case -1: NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + Messages.INF_ACCOUNT_DISABLED); NAPI.Player.KickPlayer(player, Messages.INF_ACCOUNT_DISABLED); break; case 0: NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + Messages.INF_ACCOUNT_NEW); NAPI.Player.KickPlayer(player, Messages.INF_ACCOUNT_NEW); break; default: // Welcome message String welcomeMessage = String.Format(Messages.GEN_WELCOME_MESSAGE, player.Name); NAPI.Chat.SendChatMessageToPlayer(player, welcomeMessage); NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_WELCOME_HINT); NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_HELP_HINT); NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_TICKET_HINT); if (account.Skin > 0) { // Load selected character PlayerModel character = DataBase.LoadCharacterInformationById(account.Skin); SkinModel skin = DataBase.GetCharacterSkin(account.Skin); NAPI.Player.SetPlayerName(player, character.RealName); NAPI.Player.SetPlayerSkin(player, character.Sex == 0 ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01); LoadCharacterData(player, character); PopulateCharacterSkin(player, skin); } else { // Set the default skin a_c_coyote NAPI.Player.SetPlayerSkin(player, PedHash.Strperf01SMM); } // Make the player invisible NAPI.Entity.SetEntityTransparency(player, 255); // Activate the login window NAPI.Data.SetEntitySharedData(player, EntityData.SERVER_TIME, DateTime.Now.ToString("HH:mm:ss")); break; } }); // Set the default skin a_c_coyote NAPI.Player.SetPlayerSkin(player, PedHash.Strperf01SMM); Can you tell what they do I why ask, just studying this project If you have questions about the API, you have them documented on the wiki: https://wiki.gtanet.work/index.php?title=Main_Page https://wiki.rage.mp/index.php?title=Main_Page
Recommended Posts