-
Posts
605 -
Joined
-
Last visited
-
Days Won
1
Everything posted by JeViCo
-
Try to separate functions next time. Here: function info ( command,msg ) if command == "info" then message = msg addEventHandler("onClientRender", getRootElement(), drawText) elseif command == "stopinfo" then removeEventHandler("onClientRender", getRootElement(), drawText) message = nil end end addCommandHandler("info", info) addCommandHandler("stopinfo", info) function drawText() local screenW, screenH = guiGetScreenSize () local localPlayerName = getPlayerName(getLocalPlayer()) dxDrawText(""..message.." Hosted by: "..localPlayerName.."", (screenW * 0.0000) + 1, (screenH * 0.0000) + 1, (screenW * 0.4539) + 1, (screenH * 0.0260) + 1, tocolor(0, 0, 0, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText(""..message.." Hosted by: "..localPlayerName.."", screenW * 0.0000, screenH * 0.0000, screenW * 0.4539, screenH * 0.0260, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end
-
Hello everyone! Рow can I make the aiming in my first person script? Each weapon shoots at one point\\\ GTA default aiming should be enough for me\
-
well\ i met another problem. I tried to place blips using your function, function from another script to get coords but i can't see them\ :с what am i doing wrong
-
i found minimap script where i got essential calculations. Thanks anyway
-
Hello everyone! How can i make minimap using custom image? I made something like this: local radarX, radarY, radarWidth, radarHeight = 120, 420, 258, 128 local x, y = getElementPosition(localPlayer) local mapsize = 3072 --print(x) dxDrawImageSection(radarX, radarY, radarWidth, radarHeight, x/6000, y/-6000, 270, 270, "files/radar_map.jpg") I know that gta sa's map size is 6000x6000 and my image resolution is 3072x3072. I can't understand what to do right now
-
i think you can. Use colshapes or colspheres attached to npcs
-
you should hit ped to make it attack you in your script
-
what do you mean?
-
insert into register function serial check function and that's it
-
it didn't help me at all
-
local ped_ = {} local peds = { {-2374.55151, -595.38910, 132.11719}, {-2376.55908, -596.57813, 132.11719}, {-2376.33325, -591.77344, 132.11171}, } function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end function spawnPed(i) ped_[i] = createPed(math.random(26,41),peds[i][1],peds[i][2],peds[i][3]) setElementData(ped_[i],"ped:custom_ped",true) setElementData(ped_[i],"ped:index",i) end addEventHandler("onClientResourceStart",resourceRoot,function() for i=1,#peds do spawnPed(i) end end) function atirar () if source then if getElementData(source,"ped:custom_ped") then ped = source givePedWeapon(ped, 31, 500, true) setPedControlState(ped, "fire", true) end end end addEvent ("pedAtira", true) addEventHandler("onClientPedDamage", root, atirar) --addEventHandler ("pedAtira", getRootElement(), atirar) function stopatirar () for _, ped in ipairs(getElementsByType("ped")) do if getElementData(ped,"ped:custom_ped") then if isElementStreamedIn (ped) then givePedWeapon(ped, 31, 500, false) setPedControlState(ped, "fire", false) end end end end addEvent ("stopPedatira", true) addEventHandler ("stopPedatira", getRootElement(), stopatirar) function handleRespawn() if getElementData(source,"ped:custom_ped") then index = getElementData(source,"ped:index") setTimer(destroyElement, 1000, 1, source) setTimer(spawnPed, 1500, 1, index) end end addEventHandler("onClientPedWasted", getRootElement(), handleRespawn) function rota () for _, ped in pairs(getElementsByType("ped")) do if getElementData(ped,"ped:custom_ped") then if isElementStreamedIn (ped) then local x1 ,y1, z1 = getElementPosition(ped) local x2, y2, z2 = getElementPosition(localPlayer) setPedAimTarget(ped, x2, y2, z2) setElementRotation(ped, 0,0,180+findRotation( x2, y2, x1, y1 )) end end end end addEventHandler("onClientRender", root, rota)
-
mods/deathmatch/resources/
-
Hello everyone! How can i make ElementData different in all dimensions? For example i want to make marker with ElementData attached to it for each dimension
-
local ped = {} local peds = { {-2374.55151, -595.38910, 132.11719}, {-2376.55908, -596.57813, 132.11719}, {-2376.33325, -591.77344, 132.11171}, } function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end local pedsParent = createElement("pedsParent") local id = {} -- do not edit this table for i=1,#peds do ped[i] = createPed(math.random(26,41),peds[i][1],peds[i][2],peds[i][3]) setElementData(ped[i],"ped:index",i) function spawnPed(i) ped[i] = createPed(math.random(26,41),peds[i][1],peds[i][2],peds[i][3]) setElementParent(ped[i], pedsParent) end function handleRespawn() if getElementData(source,"ped:index") then index = getElementData(source,"ped:index") setTimer(destroyElement, 1000, 1, source) setTimer(spawnPed, 1500, 1, index) end end addEventHandler("onPedWasted", pedsParent, handleRespawn) function rotationpedd () local x1 ,y1, z = getElementPosition(ped[i]) local x2, y2, sz = getElementPosition(localPlayer) setPedAimTarget(ped[i], x2, y2, sz) setPedRotation(ped[i], findRotation( x1, y1, x2, y2 )) end addEventHandler("onClientRender", root, rotationpedd) function atirar () givePedWeapon(ped[i], 31, 500, true) setPedControlState(ped[i], "fire", true) end addEventHandler("onClientPedDamage", root, atirar) addEvent ("pedAtira", true) addEventHandler ("pedAtira", getRootElement(), atirar) function stopatirar () givePedWeapon(ped[i], 31, 500, false) setPedControlState(ped[i], "fire", false) end addEvent ("stopPedatira", true) addEventHandler ("stopPedatira", getRootElement(), stopatirar) end i guess i fixed handlerRespawn. Check it
-
peds = nil i = nil you should iterate everything through peds table: local ped = {} local peds = { {-2374.55151, -595.38910, 132.11719}, {-2376.55908, -596.57813, 132.11719}, {-2376.33325, -591.77344, 132.11171}, } function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end for i=1,#peds do ped[i] = createPed(math.random(26,41),peds[i][1],peds[i][2],peds[i][3]) function rotationpedd () local x1 ,y1, z = getElementPosition(ped[i]) local x2, y2, sz = getElementPosition(localPlayer) setPedAimTarget(ped[i], x2, y2, sz) setPedRotation(ped[i], findRotation( x1, y1, x2, y2 )) end addEventHandler("onClientRender", root, rotationpedd) function atirar () givePedWeapon(ped[i], 31, 500, true) setPedControlState(ped[i], "fire", true) end addEventHandler("onClientPedDamage", root, atirar) addEvent ("pedAtira", true) addEventHandler ("pedAtira", getRootElement(), atirar) function stopatirar () givePedWeapon(ped[i], 31, 500, false) setPedControlState(ped[i], "fire", false) end addEvent ("stopPedatira", true) addEventHandler ("stopPedatira", getRootElement(), stopatirar) end also i fixed some mistakes here
-
client.lua addEventHandler("onClientResourceStart",resourceRoot,function() setPlayerHudComponentVisible("all",false) setPlayerHudComponentVisible("crosshair",true) end) meta.xml <meta> <info author="JeViCo" description="" version="1.0" type="script" /> <script src="hud.lua" type="client" cache="false"/> </meta>
-
--
-
dream of each mta user)
- 2 replies
-
- map editor
- objects
-
(and 1 more)
Tagged with:
-
Yes. I removed false and that solved a problem (for me)
-
Check this You also should know lua basics to make your own script correct
-
Hello everyone! I've recently replaced whole gta map with a new one but some objects i can still see: When i come closer it disappears. If i return to start position, it appears again. Code: for i=550,20000 do removeWorldModel(i,10000,0,0,0) end setOcclusionsEnabled(false) I also tried to switch on setOcclusionsEnabled but nothing happened
-
You should use createObjectPreview + postGUI and dxDrawImage + onClientRender. Try to change this exports['object_preview']:createObjectPreview(ped, 0, 0, 180, 0.5, 0.5, 0.5, 0.5, true, true, false) to this exports['object_preview']:createObjectPreview(ped, 0, 0, 180, 0.5, 0.5, 0.5, 0.5, true, true) I don't know why but it works:
-
check it again: https://wiki.multitheftauto.com/wiki/ExecuteSQLQuery it says that function returns table this is not correct if ( result == 0 ) or ( not result ) then try to use this: if ( #result == 0 ) or ( not result ) then same problem here: function isPlayerSave(serial) local sel = executeSQLQuery("SELECT serial FROM players_save WHERE serial=?",serial) if #sel == 0 then return false else return true end end var = {} #var means that you are counting table's indexes. For example: namelist = { {"food","drink"}, {"weapons"}, {"cars"} } outputChatBox( #namelist ) you will see number 3 in chat
-
original topic
-
solved. SERVER_IP = "127.0.0.1" function getServerIp() return SERVER_IP end fetchRemote("http://checkip.dyndns.com/", function (response) if response ~= "ERROR" then SERVER_IP = response:match("<body>Current IP Address: (.-)</body>") or "127.0.0.1" end end ) i used SERVER_IP variable after fetchRemote function. I used it inside of function and it solved my problem