Jump to content

DarkMagic

Members
  • Posts

    17
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

DarkMagic's Achievements

Square

Square (6/54)

0

Reputation

  1. The full script has 945 line … there is no problem with the 34th line . but if i use this "function" debug says that . If u use attachElement instead of attachElementToBone then it works But the attachElement is not that good , cause when i crouch then the object stays in the air, but if i run the object "follows" me but not attaches to my character!
  2. debugscript says:[ERROR][string"?"]:34:attempt to call global 'type' (a number value)
  3. Hi guys! I want to make a script like : when i use the item then the script attcahes a kevlar vest to my character , but it's not working the code : elementVest = {} function createVest () x,y,z = getElementPosition(source) elementVest[source] = createObject(1242,x,y,z) exports.bone_attach:attachElementToBone(elementVest[source],source,3,0,0,0,3,-5,0) setElementCollisionsEnabled(elementVest[source], false) setObjectScale(elementVest[source], 1.2) end addEvent("createVest", true) addEventHandler("createVest", getRootElement(), createVest) debugscript says:[ERROR][string"?"]attempt to call global 'type' (a number value)
  4. Still not working : debug says : ERROR:mta_shootingrange:SourceC.lua:22:attempt to index field '?' (a userdata value) Code: < local monitorSize = {guiGetScreenSize()} local panelSize = {300, 350} local panelPos = {monitorSize[1]/2-panelSize[1]/2, monitorSize[2]/2-panelSize[2]/2} local ped = {} local marker = {} local pedPos = { {1539.3648681641, -1354.3519287109, 329.46493530273, 0, 0, 180, "Jacky", 10}, } local weapons= {{"M4"}, {"AK-47"}, {"MP5"}, {"UZI/Tec-9"}, {"Colt-45"}, {"Desert Eagle"}, {"Silenced Colt"}, {"Sörétes"}} local Font1 = dxCreateFont("files/Roboto.ttf", 10) show = false local marker = createMarker(1539.3648681641, -1354.3519287109, 328.46493530273, "cylinder", 1, 100, 158, 100, 240, localPlayer) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () for index, value in ipairs (pedPos) do if isElement(ped[index]) then -- we want to get a possible ped from ped table not pedPos destroyElement(ped[index]) -- same here else ped[index] = createPed(value[8], value[1], value[2], value[3]) setElementRotation(ped[index], 0, 0, 90) ped[index]:setData("ped:shooting", true) ped[index]:setData("ped:shooting", true) setElementFrozen(ped[index], true) ped[index]:setData("ped:name", "Name") ped[index]:setData("name:tags", "Tag") end end end) />
  5. local monitorSize = {guiGetScreenSize()} local panelSize = {300, 350} local panelPos = {monitorSize[1]/2-panelSize[1]/2, monitorSize[2]/2-panelSize[2]/2} local pedPos = {} local pedPos = { {1539.3648681641, -1354.3519287109, 329.46493530273, 0, 0, 180, "Jacky", 10}, } local weapons= {{"M4"}, {"AK-47"}, {"MP5"}, {"UZI/Tec-9"}, {"Colt-45"}, {"Desert Eagle"}, {"Silenced Colt"}, {"Sörétes"}} local Font1 = dxCreateFont("files/Roboto.ttf", 11) show = false addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () for index, value in ipairs (pedPos) do if isElement(pedPos[index]) then destroyElement(pedPos[index]) else pedPos[index] = createPed(value[8], value[1], value[2], value[3]) setElementRotation(pedPos[index], 0, 0, 90) pedPos[index]:setData("ped:shooting", true) pedPos[index]:setData("ped:shooting", true) setElementFrozen(pedPos[index], true) pedPos[index]:setData("ped:name", value[7]) pedPos[index]:setData("name:tags", "Shooting Range") end end end) function panelRender() if not show then return end dxDrawRectangle(panelPos[1], panelPos[2], panelSize[1], panelSize[2], tocolor(0, 0, 0, 160)) dxDrawRectangle(panelPos[1], panelPos[2], panelSize[1], panelSize[2]-320, tocolor(0, 0, 0, 200)) dxDrawText(" Name - #7cc576Shootingrange", panelPos[1]+580, panelPos[2]-25, panelSize[1]+100, panelSize[2]+70, tocolor(255, 255, 255, 255), 1, Font1, "center", "center", false, false, false, true) dxDrawText("Welcome " ..getPlayerName(localPlayer):gsub("_", " ") .. " to the Shootingrange!", panelPos[1]+10, panelPos[2]+50, panelSize[1]-100, panelSize[2]-400, tocolor(255, 255, 255, 255), 1, Font1) show = true for _, value in ipairs(weapons) do if value[1] == "M4" then dxDrawText(value[1], panelPos[1], panelPos[2], panelSize[1], panelSize[2], tocolor(255, 255, 10, 255)) end end end addEventHandler("onClientRender", root, panelRender) function mutat() show = true if show then panelRender () end end addCommandHandler("mutat", mutat) that ' s the script
  6. The create ped now working , but there is an another error: ERROR:mta_shootingrange:SourceC.lua:22:attempt to index field '?' (a userdata value)
  7. Hello guys! I wnt to make a Ped , with Name, Tags etc. but the script says error :/. Debugscript says:ERROR:mta_shootingrange/sourceC.lua : 14 : attempt to index global 'ped'(a nil value) Here is the script: local pedPos = { {1539.3648681641, -1354.3519287109, 329.46493530273, 0, 0, 180, "Jacky", 10}, } addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () for index, value in ipairs (pedPos) do if isElement(pedPos[index]) then destroyElement(pedPos[index]) else ped[index] = createPed(value[8], value[1], value[2], value[3]) setElementRotation(ped[index], 0, 0, 90) ped[index]:setData("ped:shooting", true) ped[index]:setData("ped:shooting", true) setElementFrozen(ped[index], true) ped[index]:setData("ped:name", value[7]) ped[index]:setData("name:tags", "Shooting Range") end end end)
  8. It' s good now! Thanks ! Can i do this : If i reach 200 km/h then the spoiler comes up .
  9. Hi guys! I want to make a script that moves the car rear spoiler when i type the command . But it not working Here is the script : addCommandHandler("spoiler", function() local theVeh = getPedOccupiedVehicle(localPlayer) local getComponent = getVehicleComponents(theVeh) if getComponent == "movspoiler_23.5_1800" then if (theVeh) then for k in pairs (getComponent) do local x, y, z = getVehicleComponentPosition(theVeh, k) setVehicleComponentPosition(theVeh, k, x+1, y+1, z+1) --outputChatBox(k) end end end end )
  10. No I didn't . I do it now It's working now! Thanks for the help :)!
  11. Hi guys! I want to load a kevlarvest model , but the script is not working Debugscript said:ERROR:zg_armor/client.lua.29:attempt to call global 'EngineLoadTXD' (a nil value) The script : txd = engineLoadTXD ( "armor.txd" ) engineImportTXD ( txd, 1242) dff = engineLoadDFF ( "armor.dff", 1242 ) engineReplaceModel ( dff, 1242)
  12. Thank u guys! Mr.Loki ' s solution solved the problem . Thanks for the help! Have a nice day !
  13. Not working Debugscript said :[ERROR]script\client.lua:382:attempt to call local 'clip' (a boolean value)
  14. Hi guys! I want to make script that tell me how much ammo left in my gun , but the getweaponAmmo is not working The script: function ammoRender () local ammo = getWeaponAmmo(theWeapon) local clip = getWeaponClipAmmo(theWeapon) dxDrawText(ammo .. "|" .. clip, 1600/oX*x, 100/oY*y, _, _, _, 2/oX*x, "pricedown", "left", "top") end addEventHandler("onClientRender", root, ammoRender)
×
×
  • Create New...