Jump to content

setElementPosition not working!


Recommended Posts

Posted

Hi, I found bug, I have code:

function teleportEnd() 
    teleporting = 0 
    fadeCamera(true) 
    local localPlayer = getLocalPlayer() 
    if (setElementPosition(localPlayer, 0.0, 0.0, 10.0) == true) then 
        outputChatBox("Teleported succesfully") 
    else 
        outputChatBox("Not Teleported!") 
    end 
    teleported = 1 
    outputChatBox("Teleported!") 
end 

client-side

And everything is working, but setElementPosition is not working! I have message "Teleported succesfully" and "Teleported!" on the chat. But my position doesn't change!

Everything is ok, please help me.

Posted

Try making the script server side instead.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

It should work i think you use it on server side.

Show meta.xml

Also use

[xml][/xml]
 

tags.

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted
  
function teleportEnd() 
    teleporting = 0 
    fadeCamera(true) 
    local localPlayer = getLocalPlayer() 
    if ( setElementPosition ( localPlayer, 0.0, 0.0, 10.0, true ) ) then 
        outputChatBox("Teleported succesfully") 
    else 
        outputChatBox("Not Teleported!") 
    end 
    teleported = 1 
    outputChatBox("Teleported!") 
end 
  

Posted

On server-side still not working!

code: (client-side)

function teleportEnd() 
    teleportuje = 0 
    fadeCamera(true) 
    triggerServerEvent("playerTeleport", getLocalPlayer()) 
    teleported = 1 
    outputChatBox("Teleportowano!") 
end 

code: (server-side)

function teleportPlayer() 
    setElementPosition(source, 0.0, 0.0, 10.0) 
    outputChatBox("Teleported!", source) 
end 
  
addEvent("playerTeleport", true) 
addEventHandler("playerTeleport", getRootElement(), teleportPlayer) 

meta.xml:

<meta> 
    <info author="Radek" type="script" name="Woda-Kolor" /> 
    <min_mta_version client="1.3.0" server="1.3.0" /> 
    <file src="/sounds/hell.mp3" /> 
 <file src="/sounds/thunder1.mp3" /> 
 <file src="/sounds/thunder2.mp3" /> 
 <file src="/sounds/thunder_and_wind.mp3" /> 
    <file src="/sounds/Duch.mp3" /> 
 <file src="/sounds/dziwne.mp3" /> 
 <file src="/sounds/Frankenstein.mp3" /> 
 <file src="/sounds/glos.mp3" /> 
    <file src="/sounds/naczynia.mp3" /> 
 <file src="/sounds/noc1.mp3" /> 
 <file src="/sounds/noc2.mp3" /> 
 <file src="/sounds/Policja.mp3" /> 
    <file src="/sounds/smiech1.mp3" /> 
 <file src="/sounds/smiech2.mp3" /> 
 <file src="/sounds/smiech3.mp3" /> 
 <file src="/sounds/Ufo.mp3" /> 
<file src="/sounds/bron/shotgun.mp3" /> 
<file src="/sounds/bron/wystrzal.wav" /> 
<file src="/sounds/bron/colt.wav" /> 
<file src="/models/tractor.txd" /> 
<file src="/models/tractor.dff" /> 
  
    <file src="/pictures/wasted.jpg" /> 
    <file src="/pictures/kluczyki.jpg" /> 
    <file src="/pictures/smieci.jpg" /> 
    <file src="/pictures/szukam.jpg" /> 
  
    <script src="moje-client.lua" type="client" /> 
    <script src="moje.lua" type="server" /> 
  
</meta> 

Also I use official zombie mode.

HELP!

Posted

Your original code works perfectly fine, I get warped to position: 0, 0, 10.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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