zezim Posted July 29, 2022 Share Posted July 29, 2022 Hey guys, Who can help me? I need to export a function to another code but I can't. I need export it: setElementData(player, "Suspiro.Algemado", false) I need to send it here: addEvent('Pedro.onPlayerPreso', true) addEventHandler('Pedro.onPlayerPreso', root, function(player, tempo, id, motivo) if tonumber(tempo) and tonumber(id) and motivo then if tonumber(tempo) <= config.TempoMax then local receiver = getPlayerFromID(id) if isElement(receiver) then local posP = {getElementPosition(player)} local posR = {getElementPosition(receiver)} if getDistanceBetweenPoints3D(posP[1], posP[2], posP[3], posR[1], posR[2], posR[3]) <= 3 then triggerClientEvent(player, 'Pedro.printPrisao', player) message(player, 'Player was arrested.', 'info') getElementData(receiver, "Suspiro.Algemado", false) Please see the last line of the code and tell me if it's right. Link to comment
Vampire Posted July 30, 2022 Share Posted July 30, 2022 Hello @zezim I'm moving this to the Scripting section as it's more suitable so you can get better assistance. Link to comment
vzScripter Posted July 30, 2022 Share Posted July 30, 2022 1 hour ago, zezim said: Hey guys, Who can help me? I need to export a function to another code but I can't. I need export it: setElementData(player, "Suspiro.Algemado", false) I need to send it here: addEvent('Pedro.onPlayerPreso', true) addEventHandler('Pedro.onPlayerPreso', root, function(player, tempo, id, motivo) if tonumber(tempo) and tonumber(id) and motivo then if tonumber(tempo) <= config.TempoMax then local receiver = getPlayerFromID(id) if isElement(receiver) then local posP = {getElementPosition(player)} local posR = {getElementPosition(receiver)} if getDistanceBetweenPoints3D(posP[1], posP[2], posP[3], posR[1], posR[2], posR[3]) <= 3 then triggerClientEvent(player, 'Pedro.printPrisao', player) message(player, 'Player was arrested.', 'info') getElementData(receiver, "Suspiro.Algemado", false) Please see the last line of the code and tell me if it's right. I can't understand exactly what you want to do, but there are 2 alternatives for what you showed. 1 - Set a value for elementData: setElementData(receivier, 'Suspiro.Algemado', false) 2 - Check with if statement: if not getElementData(receivier, 'Suspiro.Algemado') then -- Code that will execute after verification (if elementData value 'Suspiro.Algemado' is not true) end 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