Search the Community

Showing results for tags 'setelementdata'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
  • Archive
  • Private Bugtracker

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



About Me





Found 10 results

  1. Iae rapaziada, seguinte. Eu to fazendo um script que é divido em três partes a parte 1 (Carregamento), parte 2 (Entrega do produto) e parte 3 (Revenda ao consumidor final) o meu plano final é fazer trabalhos interligados! Porém no momento estou fazendo tudo junto o Entregador faz o carregamento e entrega ( a parte de revenda ainda não desenvolvi!). O meu problema esta sendo na hora de colocar o produto no caminhão em setElementData(CamiNaMarker, "Caminhao:ProntoPcarregar", DataCaminhao + 1) ( linha 77). O máximo são 20 produtos que o Entregador pode colocar dentro do caminhão então sendo assim eu queria que cada vez que ele colocasse o produto no caminhão seria adicionado +1 no elementData até chegar aos 20! Após isso ele poderia retirar o caminhão da marker e fazer sua entrega! Erro no debugscript: Trabalho-CarregadorACPT\server.Lua:111: attempt to perform arithmetic on upvalue 'DataCaminhao' (a userdata value) Segue abaixo o script: MarkerCaminhao = createMarker(-486.762, -4996.24, 1.478 -1, "cylinder", 3.0, 210, 10, 10, 100) IniJob = createMarker(-476.458, -5001.667, 1.47 -1, "cylinder", 2.0, 3, 120, 210, 210) --EntJob = createMarker(-485.388, -4982.361, 1.478 -1, "cylinder", 2.0, 210, 120, 3, 210) local rad = math.random(13, 45) function CarregadorPegar (Jog) local fX, fY, fZ = getElementPosition( Jog ); if isElementWithinMarker(Jog, IniJob) then setPedAnimation( Jog, "CARRY", "liftup", 1.0, false ); setTimer(function() --caixa = createObject(2912, 0, 0, 0) setPedAnimation( Jog, nil ); setPedAnimation( Jog, "CARRY", "crry_prtial", 4.1, true, true, true ); toggleControl(Jog,"jump", false) toggleControl(Jog,"fire", false) caixa = createObject( 2912, fX, fY, fZ ); exports.bone_attach:attachElementToBone( caixa, Jog, 4, 0, 0.4, - 0.6, -90, 0, 0 ); setElementData(Jog, "Pegou:Caixa.Crgador", caixa) end, 1000, 1) end end addCommandHandler("pegar", CarregadorPegar) function PorCaminhao (cami) local CamiNaMarker = getVehicleInMarker( MarkerCaminhao ) outputChatBox("01") if (CamiNaMarker) and getElementModel(CamiNaMarker) == 499 then outputChatBox("02") setElementData(CamiNaMarker, "Caminhao:ProntoPcarregar", CamiNaMarker) outputChatBox("03") local x, y, z = getElementPosition(CamiNaMarker) outputChatBox("04") m1 = createMarker(x, y, z -1, "cylinder", 2.0, 0, 255, 255, 255) outputChatBox("05") attachElements(m1, CamiNaMarker, 0, - 4.2, - 1) outputChatBox("06") setElementFrozen(CamiNaMarker, true) outputChatBox("07") --end else outputChatBox("Este veiculo não pertence ao trabalho de entregador!") end end addCommandHandler("carregar", PorCaminhao) function CarregadorEntregar ( Jog) if getElementType( Jog ) == "player" and getElementData( Jog, "Pegou:Caixa.Crgador" ) then --if isElementWithinMarker(Jog, m1) then outputChatBox("01") local CamiNaMarker = getVehicleInMarker( MarkerCaminhao ) outputChatBox("02") local DataCaminhao = getElementData(CamiNaMarker, "Caminhao:ProntoPcarregar") outputChatBox("02") if (CamiNaMarker) then outputChatBox("03") if ( DataCaminhao ) then outputChatBox("04") setPedAnimation( Jog, "CARRY", "putdwn", 1.0, false, false, false, true ); outputChatBox("05") setTimer(function() if ( DataCaminhao ) == 20 then outputChatBox("caminhão cheio") else outputChatBox("06") DeleteBox( Jog ); outputChatBox("07") setElementData(CamiNaMarker, "Caminhao:ProntoPcarregar", DataCaminhao + 1) outputChatBox("08") --givePlayerMoney( Jog, rad); --outputChatBox("Você ganhou R$"..rad,Jog) setPedAnimation( Jog, "CARRY", "liftup", 0.0, false, false, false, false ); outputChatBox("09") toggleControl(Jog,"jump", true) toggleControl(Jog,"fire", true) end end, 1000, 1) else outputChatBox("Estacione o Caminhão Primeiro!") end end --end end end addCommandHandler("por", CarregadorEntregar) function TirarCaminhao (cami) local CamiNaMarker = getVehicleInMarker( MarkerCaminhao ) outputChatBox("01") if (CamiNaMarker) and getElementModel(CamiNaMarker) == 499 then outputChatBox("02") if getElementData(CamiNaMarker, "Caminhao:ProntoPcarregar") == 20 then outputChatBox("03") setElementData(CamiNaMarker, "Caminhao:Carregado", 20) outputChatBox("04") detachElements(m1, CamiNaMarker) outputChatBox("05") destroyElement(m1) outputChatBox("06") setElementFrozen(CamiNaMarker, false) outputChatBox("07") end end end addCommandHandler("carregado", TirarCaminhao)
  2. Добрый день. Боги скриптеры, подскажите пожалуйста, после того как я создал setElementData или local money, нужно ли их очищать/удалять при дисконекте игрока? Спасибо за ответ
  3. First of all, sorry for bad English. I am creating a script and I used the getElementData function to get data stored in the user account and then the setElementData function to get the information through the getElementData on the client but the script has the following error in debugging: Bad argument @ setElementData [Expect element at argument 1, got nil] SCRIPT: [SERVER-SIDE] function setarDados_Entrar(source) local acc = getPlayerAccount(source) local habl = getAccountData(acc, "hablt") local ficha = getAccountData(acc, "fichacriminal") setElementData(source, "hblt", habl)--In that error line setElementData(source, "fich", ficha) -- In that error line end function setarDados_Iniciar() local acc = getPlayerAccount(player) local habl = getAccountData(acc, "hablt") local ficha = getAccountData(acc, "fichacriminal") setElementData(player, "hblt", habl)--In that error line setElementData(player, "fich", ficha)--In that error line end function setarDados_Mudar(player) local acc = getPlayerAccount(player) local habl = getAccountData(acc, "hablt") local ficha = getAccountData(acc, "fichacriminal") setElementData(player, "hblt", habl)--In that error line setElementData(player, "fich", ficha)--In that error line end addEventHandler("onPlayerLogin", getRootElement(), setarDados_Entrar) addEventHandler("onResourceStart", root, setarDados_Iniciar) addEventHandler("onAccountDataChange", root, setarDados_Mudar)
  4. itHyperoX

    vehicle ID

    Hello, how can i make something thins? I want set id for each vehicle which is spawned. Then i can create /getcar command. I dont want to save this forever. local vehS = 0 function createVeh(player,CMD,veh) local vehName = getVehicleIDFromName(veh) local x, y, z = getElementPosition(player) if vehName == false then --- else vehS + 1 theveh = createVehicle(vehName,x+5,y,z) setElementData(theveh,"vehID",vehS) end end addCommandHandler("cv",createVeh)
  5. Xwad

    can't store data

    My problem is that it's not storing the data in the local mg = {}. The debugscript says: bad argumentum @ 'setElememtData' expected element at argument 1, got table Thanks in advance! function mg_pos() createMG(-2861.9, 19.4, 15.83, 0, 0, 188) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), mg_pos) --MG 1 local mg = {} function createMG(posX,posY,posZ,rotX,rotY,rotZ) local weapon_base = createObject ( 1897, posX,posY,posZ,rotX,rotY,rotZ) local weapon = createObject ( 356, 0,0,0) attachElements ( weapon, weapon_base, -0.55, 0, 0.75, 0, 0, 0) setElementData ( mg, "weapon_base", weapon_base) setElementData ( mg, "weapon", weapon) end
  6. Hello guys, for some reason debugscript is saying this..Heres my script piece: setElementData(p, "acc:admin", 7) if not getElementData(p, "acc:admin") > 0 then return end Nothing else changes acc:admin. Edit: Found the solution: setElementData(p, "acc:admin", 7) if not (getElementData(p, "acc:admin") > 0) then return end But, i still don't understand, so can someone explain me whats the difference between those code blocks?
  7. So I have a quick question regarding the setElementData function. While the wiki states that it can cause quite a bit of load on the net and server CPU I assume that this is only the case for server elements... What happens if I use setElementData on something that exists only on a client? Say a gui element or any kind of element that has been created on a client. Is the data still synced with the other clients or is it kept to the client the element exists on? 3aGl3
  8. Hi there, I want to make my server as safe as I can. So it is only logic, that I heed the advice from the wiki: Script security Well, the second part (with checking the validness of client and arguments) is very easy for me to do. But for the first part, I can only assume it works, but can't test it, as I don't have a hacked client. I don't want a real hacked client, but still, I would like to test, if a rouge client would get catched and reported by my script security (I only changed the "oputputConsole" to a error report system I already have implemented). With best regards, another MTA:SA freak.
  9. Hi! This script makes possible to play a 3d sound (looped sound) by pressing the CTRL button, and stop the sound when the CTRL button is "up". Well, it has a really annoying sync bug. As you can see, there is a setElementData function in my client side script, that stores the sound element. When the player stops pressing the CTRL button then the script stops the sound with the stored element. Well the problem is that when another player press the CTRL button then the setElementData will be overwritted, and will cause really strange, annoying bugs. So the bug is: when player1 press CTRL, and after that player2 also press CTRL then the sound for player1 will not stop anymore, because player2 owerwrited the setElementData, when he pressed CTRL. Well, its not easy to explain, so i hope you understood me. Is the any way to avoid this owerwriting? or do i have to do this another way, without setElementData? Thanks in advance. client --start sound function start_fire_sound() if isPedInVehicle (localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) if getElementModel(veh) == 476 then triggerServerEvent ( "start_fire_sound", resourceRoot, veh ) end end end bindKey("lctrl", "down", start_fire_sound) function start_fire_c(veh) local x,y,z = getElementPosition (veh) local sound_fire = playSound3D("files/fire.wav",x,y,z, true) setSoundMaxDistance( sound_fire, 500 ) setSoundVolume(sound_fire, 1) attachElements ( sound_fire, veh, 0,0,0 ) setElementData(localPlayer, "sound_fire", sound_fire) end addEvent( "start_fire_sound", true ) addEventHandler( "start_fire_sound", localPlayer, start_fire_c ) --stop sound function stop_fire_sound() if isPedInVehicle (localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) if getElementModel(veh) == 476 then triggerServerEvent ( "stop_fire_sound", resourceRoot, veh ) end end end bindKey("lctrl", "up", stop_fire_sound) function stop_fire_sound_c(veh) local x,y,z = getElementPosition (veh) local sound_fire_lastshot = playSound3D("files/fire_lastshot.wav",x,y,z, false) setSoundMaxDistance( sound_fire_lastshot, 500 ) setSoundVolume(sound_fire_lastshot, 1) attachElements ( sound_fire_lastshot, veh, 0,0,0 ) local sound_fire = getElementData(localPlayer, "sound_fire") stopSound(sound_fire) end addEvent( "stop_fire_sound", true ) addEventHandler( "stop_fire_sound", localPlayer, stop_fire_sound_c ) server function start_fire_sound(veh) triggerClientEvent ("start_fire_sound", getRootElement(), veh) end addEvent( "start_fire_sound", true ) addEventHandler( "start_fire_sound", getRootElement(), start_fire_sound ) function stop_fire_sound(veh) triggerClientEvent ("stop_fire_sound", getRootElement(), veh) end addEvent( "stop_fire_sound", true ) addEventHandler( "stop_fire_sound", getRootElement(), stop_fire_sound )
  10. السلام عليكم ورحمة الله وبركاته انا بفضل الله ثم بفضلكم عرفت اشياء كثيرة عن البرمجة لكني ما سألت قبل عن الداتا setElementData وانا نوب مرة فيها انا ابي اسوي داتا من ملف مثلاً يكون اسمه theData وابي اجيب الداتا في ملف آخر مثلاً getData لكن بشروط اذا الداتا حقت الملف الاول = الداتا حقت الملف الثاني يخرج كلمة في الشات : تم تثبيت الاضافة واذا الملف الاول لا يساوي الملف الثاني في الداتا تخرج رسالة اخرى تقول : لم يتم تثبيت الاضافة هذا اللي ابيه - اتمنى مساعدة