Jump to content

Problem with spawn with skin


elmy2424

Recommended Posts

hi, i want to spawn the players with the skin they select but it dont happends, as you can see i made two triggerServerEvents functions in every function of the skin buttons. the first is to chenge the value of the variable skinID serverside and the other triggerserverevent should spawns the players with skin but it dont happends.(the player spawn in the xyz points with the rotation but not with the skin)

dont worry about the gui elemnts or the other functions all of those works fine.

whats wrong?

note: the server.lua file is in other resource.

client.lua

  
        function boton1f ( ) 
            guiSetVisible(skinsgui,false) 
            showCursor(false) 
            triggerServerEvent("boton1",getRootElement()) 
            triggerServerEvent("spawnbeforelogin",getLocalPlayer(),spawnX,spawnY,spawnZ,skinID) 
        end 
         
        function boton2f ( ) 
            guiSetVisible(skinsgui,false) 
            showCursor(false) 
            triggerServerEvent("boton2",getRootElement()) 
            triggerServerEvent("spawnbeforelogin",getLocalPlayer(),spawnX,spawnY,spawnZ,skinID) 
        end 
         
        function boton3f ( ) 
            guiSetVisible(skinsgui,false) 
            showCursor(false) 
            triggerServerEvent("boton3",getRootElement()) 
            triggerServerEvent("spawnbeforelogin",getLocalPlayer(),spawnX,spawnY,spawnZ,skinID) 
        end 
         
        function boton4f ( ) 
            guiSetVisible(skinsgui,false) 
            showCursor(false) 
            triggerServerEvent("boton4",getRootElement()) 
            triggerServerEvent("spawnbeforelogin",getLocalPlayer(),spawnX,spawnY,spawnZ,skinID) 
        end 
         
        function boton5f ( ) 
            guiSetVisible(skinsgui,false) 
            showCursor(false) 
            triggerServerEvent("boton5",getRootElement()) 
            triggerServerEvent("spawnbeforelogin",getLocalPlayer(),spawnX,spawnY,spawnZ,skinID) 
        end 
         
        function boton6f ( ) 
            guiSetVisible(skinsgui,false) 
            showCursor(false) 
            triggerServerEvent("boton6",getRootElement()) 
            triggerServerEvent("spawnbeforelogin",getLocalPlayer(),spawnX,spawnY,spawnZ,skinID) 
        end 
         
        function boton7f ( ) 
            guiSetVisible(skinsgui,false) 
            showCursor(false) 
            triggerServerEvent("boton7",getRootElement()) 
            triggerServerEvent("spawnbeforelogin",getLocalPlayer(),spawnX,spawnY,spawnZ,skinID) 
        end 
         
        function boton8f ( ) 
            guiSetVisible(skinsgui,false) 
            showCursor(false) 
            triggerServerEvent("boton8",getRootElement()) 
            triggerServerEvent("spawnbeforelogin",getLocalPlayer(),spawnX,spawnY,spawnZ,skinID) 
        end 
         
        function boton9f ( ) 
            guiSetVisible(skinsgui,false) 
            showCursor(false) 
            triggerServerEvent("boton9",getRootElement()) 
            triggerServerEvent("spawnbeforelogin",getLocalPlayer(),spawnX,spawnY,spawnZ,skinID) 
        end 
         
        function boton10f ( ) 
            guiSetVisible(skinsgui,false) 
            showCursor(false) 
            triggerServerEvent("boton10",getRootElement()) 
            triggerServerEvent("spawnbeforelogin",getLocalPlayer(),spawnX,spawnY,spawnZ,skinID) 
        end 
         
         

server.lua

local spawnX, spawnY, spawnZ = -1902.7969970703, 1158.2810058594, 45.512100219727 
local skinID = 0 
  
addEventHandler("onResourceStart",getRootElement(), 
   function () 
    createVehicle(425,-1913.5,1100.6,47.5,20,0,90) 
    createVehicle(487,-1910.63,1132.16,47.18,0,0,90) 
   end 
 )  
addEvent ("guestf",true) 
addEvent("spawnbeforelogin",true) 
addEvent("boton1",true) 
addEvent("boton2",true) 
addEvent("boton3",true) 
addEvent("boton4",true) 
addEvent("boton5",true) 
addEvent("boton6",true) 
addEvent("boton7",true) 
addEvent("boton8",true) 
addEvent("boton9",true) 
addEvent("boton10",true) 
  
  
addEventHandler("boton1",getRootElement(), 
function () 
  local skinID = 17 
end 
) 
  
addEventHandler("boton2",getRootElement(), 
function () 
  local skinID = 20 
end 
) 
  
addEventHandler("boton3",getRootElement(), 
function () 
  local skinID = 21 
end 
) 
  
addEventHandler("boton4",getRootElement(), 
function () 
  local skinID = 22 
end 
) 
  
addEventHandler("boton5",getRootElement(), 
function () 
  local skinID = 7 
end 
) 
  
addEventHandler("boton6",getRootElement(), 
function () 
  local skinID = 14 
end 
) 
  
addEventHandler("boton7",getRootElement(), 
function () 
  local skinID = 15 
end 
) 
  
addEventHandler("boton8",getRootElement(), 
function () 
  local skinID = 16 
end 
) 
  
addEventHandler("boton9",getRootElement(), 
function () 
  local skinID = 18 
end 
) 
  
addEventHandler("boton10",getRootElement(), 
function () 
  local skinID = 19 
end 
) 
  
function joinHandler() 
    spawnPlayer(source,spawnX,spawnY,spawnZ,120,skinID) 
    setCameraTarget(source, source) 
    fadeCamera(source,true) 
end 
addEventHandler("spawnbeforelogin", getRootElement(), joinHandler) 
  
  

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...