Cronoss Posted February 1, 2022 Share Posted February 1, 2022 (edited) I was testing the "create character" system I been working on with a friend, and we did not expect this... when we both register our accounts and create our characters we can't see each other, we are invisibles, I don't know how to prevent this or what did I scripted wrong, please, help This is the part that TP our characters and I think here it's the problem: (Client-Side) addEventHandler("onClientGUIClick", btnSeleccionar, function() showCursor(false) guiSetVisible(ventanaElegirSkinsM, false) setElementPosition ( getLocalPlayer(), 1742.9543457031,-1862.6853027344,13.575992584229) setElementDimension( getLocalPlayer(), 0) setElementRotation( getLocalPlayer(), -0, 0, 357.78338623047) setElementInterior( getLocalPlayer(), 0) triggerServerEvent("descongelar", getLocalPlayer(), localPlayer) setPlayerMoney(2500) All the rest of the code runs like I wanted, the money, the triggerevent, the position, etc, but for some reason, the script send us to different "interiors" or "dimensions". And, most important thing is that when we both create our character, we can't see each other new nickname, the skin neither Edited February 1, 2022 by Cronoss Link to comment
βurak Posted February 1, 2022 Share Posted February 1, 2022 (edited) there doesn't seem to be a problem here, everything seems correct are you sure there is a problem here? by the way, make sure to use setPlayerMoney on server side because it doesn't work on client side wiki: Note: Using this function client side (not recommended) will not change a players money server side. addEventHandler("onClientGUIClick", btnSeleccionar, function() showCursor(false) guiSetVisible(ventanaElegirSkinsM, false) setElementPosition ( getLocalPlayer(), 1742.9543457031,-1862.6853027344,13.575992584229) setElementDimension( getLocalPlayer(), 0) setElementRotation( getLocalPlayer(), -0, 0, 357.78338623047) setElementInterior( getLocalPlayer(), 0) triggerServerEvent("descongelar", getLocalPlayer(), localPlayer) setPlayerMoney(2500) -- <-- this Edited February 1, 2022 by Burak5312 Link to comment
Cronoss Posted February 1, 2022 Author Share Posted February 1, 2022 (edited) Here it's the part of the code that triggers the gui to create the character: function registroHRP(user, clavecreada) if(addAccount(user, clavecreada))then triggerClientEvent(source, "cerrar", source) logIn(source, getAccount(user, clavecreada), clavecreada) setElementPosition(source, 209.41818237305,-33.872188568115,1001.9296875) setElementInterior(source, 1) setElementDimension(source, 0) setPedRotation(source, 180) setElementFrozen(source, true) setCameraMatrix (source, 207.53846740723,-37.582496643066,1001.8046875, 209.41818237305,-33.872188568115,1001.9296875, 0, 100 ) triggerClientEvent(source, "crearPJ", source) triggerClientEvent(source, "pararmusicaycamara", source) -- stop music and camera matrix else -----gotta add a text here------------ end end (Server-Side) If the problem isn't there I don't know where could be Edited February 1, 2022 by Cronoss Link to comment
βurak Posted February 1, 2022 Share Posted February 1, 2022 Where are the player spawn codes? can you add it please? Link to comment
Cronoss Posted February 1, 2022 Author Share Posted February 1, 2022 Quote the player spawn codes What you mean with that? (sorry if I'm being annoying) are you saying where the players spawn in first place when they enter in the server? Link to comment
βurak Posted February 1, 2022 Share Posted February 1, 2022 where spawnPlayer function is used after players choose skin Link to comment
Cronoss Posted February 1, 2022 Author Share Posted February 1, 2022 I didn't added spawnPlayer function, it only works with "setelementposition, interior, dimension, etc", this is the code AFTER the player choosing the skin: addEventHandler("onClientGUIClick", btnSeleccionar, function() showCursor(false) guiSetVisible(ventanaElegirSkinsM, false) ---------------Here starts the TP-------------- setElementPosition ( getLocalPlayer(), 1742.9543457031,-1862.6853027344,13.575992584229) setElementDimension( getLocalPlayer(), 0) setElementRotation( getLocalPlayer(), -0, 0, 357.78338623047) setElementInterior( getLocalPlayer(), 0) triggerServerEvent("descongelar", getLocalPlayer(), localPlayer) ----Just a function that unfreezes the player------ setPlayerMoney(2500) end, false) end also, I edited a little bit the freeroam/play gamemode, so if I stop the "Login resource" this is what you see: (maybe this is the problem?) click Link to comment
βurak Posted February 1, 2022 Share Posted February 1, 2022 (edited) setElementDimension( getLocalPlayer(), 0) setElementInterior( getLocalPlayer(), 0) Can you try to transfer these codes to the server side, it can be inside the descongelar event. Apart from this, there may be other codes that you did not show here, I did not see a problem in the codes you sent. Edited February 1, 2022 by Burak5312 Link to comment
Cronoss Posted February 1, 2022 Author Share Posted February 1, 2022 I think the problem it's solved, but now we can't see the skin that we chose, I see him with the CJ default skin and he sees me like that too, here is the code of the skin selection (the code that you helped me to make I must say, thank you for that): local currentTableID = 1 setElementModel(localPlayer, tablaSkinsHombre[currentTableID]) addEventHandler("onClientGUIClick", btnSiguienteSkin, function() if(currentTableID > #tablaSkinsHombre) then currentTableID = 1 end setElementModel(localPlayer, tablaSkinsHombre[currentTableID]) currentTableID = currentTableID + 1 end, false) addEventHandler("onClientGUIClick", btnAnteriorSkin, function() if(currentTableID < 1) then currentTableID = 188 end setElementModel(localPlayer, tablaSkinsHombre[currentTableID]) currentTableID = currentTableID - 1 end, false) addEventHandler("onClientGUIClick", btnSeleccionar, function() showCursor(false) guiSetVisible(ventanaElegirSkins, false) setElementPosition ( getLocalPlayer(), 1742.9543457031,-1862.6853027344,13.575992584229) setElementDimension( getLocalPlayer(), 0) setElementRotation( getLocalPlayer(), -0, 0, 357.78338623047) setElementInterior( getLocalPlayer(), 0) triggerServerEvent("descongelar", getLocalPlayer(), localPlayer) ----------------------At this point its just the setplayermoney and the end------------------------- Link to comment
๖ۣۜζ͜͡RapGod Posted February 1, 2022 Share Posted February 1, 2022 (edited) Because your skin is being set client side. Try using the setElementModel in the server side script. This should fix your problem. Edited February 1, 2022 by ๖ۣۜζ͜͡RapGod 1 1 Link to comment
Cronoss Posted February 1, 2022 Author Share Posted February 1, 2022 I understand the solution but how should I do it? I'm not asking for the code, I want to know if I should make a "triggerServerEvent" or something like that, if that's the case, could you explain me how to transfer the "table" and "currentid" to the server-side? Because I tried and it doesn't get any error but it doesn't work neither. Thanks for your time, I appreciate your help Link to comment
βurak Posted February 1, 2022 Share Posted February 1, 2022 (edited) Create an event on the server side to change the player's skin addEvent("setPlayerSkin", true) addEventHandler("setPlayerSkin", root, function(ID) setElementModel(source, ID) end ) then call it with triggerServerEvent this can be inside the btnSeleccionar event You don't need to delete the setElementModel function on the client side for this, just trigger it on the server side after the player selects the final skin triggerServerEvent("setPlayerSkin", localPlayer, tablaSkinsHombre[currentTableID]) Edited February 1, 2022 by Burak5312 1 Link to comment
Cronoss Posted February 1, 2022 Author Share Posted February 1, 2022 (edited) Got a little problem with the skins but I solved it, that's why I didn't respond till now, thank you! Edited February 1, 2022 by Cronoss Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now