Jump to content

getElementData problem


Snoozy

Recommended Posts

I'm having problems since my fuction charaSelected does not seem to work as supposed.

I'm first calling the ServerEvent.

triggerServerEvent("charSelected",getLocalPlayer()) 

then it's supposed to:

I don't get my name changed, neither does it change the skin, I do however spawn.

function charaSelected() 
    spawnPlayer(source, 1910.55, -1714.46, 10, 0,getElementData(source,"CharacterSkin")) 
    setPlayerName(source,getElementData(source,"CharacterName")) 
    fadeCamera(source, true) 
    setCameraTarget(source) 
end 
addEvent("charSelected",true) 
addEventHandler("charSelected",getRootElement(),charaSelected) 

No errors nor warnings in /debugscript 3.

I'm guessing it has something to do with getElementData as the things not working is

setPlayerName, which got getElementData same goes for spawnPlayer, it does spawn but doesn't change skin.

Link to comment

Don't use element data:

local CharacterSkin = 26 
local CharacterName = "John" 
triggerServerEvent("charSelected", getLocalPlayer(), CharacterSkin, CharacterName) 

function charaSelected(CharacterSkin, CharacterName ) 
    spawnPlayer(source, 1910.55, -1714.46, 10, 0, CharacterSkin) 
    setPlayerName(source, CharacterName ) 
    fadeCamera(source, true) 
    setCameraTarget(source) 
end 
addEvent("charSelected",true) 
addEventHandler("charSelected",getRootElement(),charaSelected) 

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...