Jump to content

setElementData problem


arezu

Recommended Posts

Posted

I have a problem with settings element data server sided.

outputChatBox("set playing: "..tostring(setElementData(player, "race.playing", true))) 
outputChatBox("set ghostmode: "..tostring(setElementData(player, "race.ghostmode", true))) 

It says in chatbox:

set playing: true

set ghostmode: false

There is no error in debugscript, so i dont know what the problem is.

Also, race.ghostmode element data for vehicles work, but not for players.

Posted

You're using setElementData, the function sets the element data, not gets.

outputChatBox("set playing: "..tostring(getElementData(player, "race.playing"))) 
outputChatBox("set ghostmode: "..tostring(getElementData(player, "race.ghostmode"))) 

Posted
You're using setElementData, the function sets the element data, not gets.
outputChatBox("set playing: "..tostring(getElementData(player, "race.playing"))) 
outputChatBox("set ghostmode: "..tostring(getElementData(player, "race.ghostmode"))) 

Yes i know that, but i used outputChatBox to see if it was successfully set (setting element data doesn't work for some reason for the second one).

Posted
Are you sure that the data isn't already "true"?

read wiki:

Returns true if the data was set succesfully, false otherwise.
Posted

I'm afraid the wiki is wrong then, take a look:

Executing client-side command: outputChatBox("set playing: "..tostring(setElementData(localPlayer, "race.playing", true))) outputChatBox("set ghostmode: "..tostring(setElementData(localPlayer, "race.ghostmode", true)))

set playing: true

set ghostmode: true

Command executed!

Executing client-side command: outputChatBox("set playing: "..tostring(setElementData(localPlayer, "race.playing", true))) outputChatBox("set ghostmode: "..tostring(setElementData(localPlayer, "race.ghostmode", true)))

set playing: false

set ghostmode: false

Command executed!

Posted

oh, so it returns false when new element data value is same as old, and onClientElementDataChange is not called.

Thanks for the help :)

wiki is not clear enough :(

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