
βurak
Members-
Posts
375 -
Joined
-
Last visited
-
Days Won
22
Everything posted by βurak
-
hi, have you tried multiplying the coordinates by x and y instead of multiplying by screenW and screenH? example: dxDrawRectangle(x * 0.7727, y * 0.0208, x * 0.0547/100*vida, y * 0.1028, tocolor(255, 0, 0, 255), false)
-
If I'm not mistaken, you want to exit the loop when the condition is met, if so, you can exit the loop with the return command. if you want to continue the code from the bottom line you can also use break command setTimer(function() for i,v in ipairs(Table) do if (T1== v[1] and T2 == v[2] and T3 == v[3]) then outputChatBox('true') return else outputChatBox('false') end end end,1000,1)
-
If you are talking about the market text, it is not possible, you can hide and open it, but you cannot change the coordinates, for this you have to do it from scratch.
-
hello you don't need to use event, change thePlayer to hitElement in your first code and of course delete thePlayer from the parameter warpPedIntoVehicle(hitElement, jobVehicle)
-
you're right, i didn't think about that
-
hello you can use events you can create an event on client side and run it with triggerClientEvent on server side example: server addEventHandler("onPlayerJoin", root, function() triggerClientEvent(source, "testEvent", source) -- execute event end ) client addEvent("testEvent", true) addEventHandler("testEvent", root, function() --do something here end ) or you can browse this script of IIYAMA I also suggest you to use "onPlayerJoin" Event for key binding.
-
can you show the code and tell us where and what you want to do?
-
I'm not sure but you can try this local allCommands = {} addEventHandler("onResourceStart", resourceRoot, function(res) -- res = the resource that just started local resourceName = getResourceName(res) local commands = getCommandHandlers(res) -- get all commands from the resource if not (allCommands[resourceName]) then allCommands[resourceName] = {} end for _, command in pairs(commands) do table.insert(allCommands[resourceName], command) outputDebugString("Comand found in "..resourceName.." : "..command) end end) addCommandHandler("testing",function() end)
-
[HELP] Start the sound at a certain vehicle speed.
βurak replied to DatPsychopath's topic in Scripting
By the way, if the player suddenly jumps out of the car while driving at 100 kilometers speed, the sound may still work, you can add the following code line for this if(isPedInVehicle(localPlayer) == false) then setSoundPaused(soundChime, true) end -
[HELP] Start the sound at a certain vehicle speed.
βurak replied to DatPsychopath's topic in Scripting
hello you can use timer I edited Tekken's code, you can do it like this function getElementSpeed(theElement, unit) -- Check arguments for errors assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") local elementType = getElementType(theElement) assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") -- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) -- Setup our multiplier to convert the velocity to the specified unit local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) -- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit return (Vector3(getElementVelocity(theElement)) * mult).length end local soundChime = playSound("speedchime.mp3", true, false) setSoundPaused(soundChime, true) function speedchime() local theVehicle = getPedOccupiedVehicle(localPlayer) if(theVehicle and getElementModel(theVehicle) == 560) then -- is player have vehice and id is 560 ? if(getElementSpeed(theVehicle, 1) >= 100) then -- is speed equal or greater then 100 ? if(isSoundPaused(soundChime) == true) then -- is sound Paused ? setSoundPaused(soundChime, false) -- play sound end else if(isSoundPaused(soundChime) == false) then -- is sound not paused setSoundPaused(soundChime, true) -- pause sound end end end end local soundStatusUpdater = setTimer(speedchime, 200, 0) -
addEventHandler("onResourceStart", resourceRoot, function(res) local commandsList = {} --table to store commands for _, subtable in pairs( getCommandHandlers() ) do local commandName = subtable[1] local theResource = subtable[2] if not commandsList[theResource] then commandsList[theResource] = {} end table.insert( commandsList[theResource], commandName ) local commands = getCommandHandlers( theResource ) for _, command in pairs( commands ) do commandFound = command if commandFound then local resourceName = getResourceName(theResource) outputDebugString("Commands found in "..resourceName..": "..commandFound, 3, 255, 0, 0) end end end end)
-
hi you can use textlib for this kind of stuff I use it too it works example local screenW, screenH = guiGetScreenSize() test = dxText:create("Test", screenW/2, screenH/2, false) test:font("default-bold") test:scale(4.0) test:color(255,255,255,255) test:visible(false) addCommandHandler("fade", function() test:visible(true) Animation.createAndPlay(test, dxTextFadeIn(3000)) end )
-
local blip = createBlip(-715.8314, 2328.1269, 44.1525, 41, 2, 255, 0, 0, 255, 0, 1000) local finishMarker = createMarker(-715.8314, 2328.1269, 125.6, "cylinder", 3.0, 255, 0, 0, 255) addEventHandler("onMarkerHit", finishMarker, function(hitElement) if(getElementType(hitElement) == "player" and isElement(blip)) then destroyElement(blip) end end )
-
function removeBlip(posX, posY, posZ) for _,blip in ipairs(getElementsByType("blip")) do local x,y,z = getElementPosition(blip) if(posX == x and posY == y and posZ == z) then destroyElement(blip) end end end local blip = createBlip (-715.8314, 2328.1269, 44.1525, 41, 2, 255, 0, 0, 255, 0, 1000) setTimer(function() addCommandHandler ( "blip", function ( thePlayer ) for index, element in ipairs ( getAttachedElements ( thePlayer ) ) do if ( getElementType ( element ) == "blip" ) then destroyElement ( element ) end end end ) end, 5000, 0) end function finish() removeBlip (-715.8314, 2328.1269, 44.1525) end maybe something like this?
-
I don't understand. Do you want to create a panel for this function?
-
local theBlip = createBlip(0, 0, 4, 2, 255, 255, 255, 255) function removeBlip(posX, posY, posZ) for _,blip in ipairs(getElementsByType("blip")) do local x,y,z = getElementPosition(blip) if(posX == x and posY == y and posZ == z) then destroyElement(blip) end end end removeBlip(0, 0, 4)
-
merhaba bu şekilde yapabilirsin eğer freeroam scripti gibi scriptler kullanmıyorsanız sorunsuz çalışacaktır. local playerBlips = {} function setPlayerColorAndClearNick(player) local clearedNick = string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "") setPlayerName(player, clearedNick) local randomR = math.random(0, 255) local randomG = math.random(0, 255) local randomB = math.random(0, 255) if(not isElement(playerBlips[player])) then playerBlips[player] = createBlipAttachedTo(player, 0, 2, randomR, randomG, randomB, 255) end setPlayerNametagColor(player, randomR, randomG, randomB) end addEventHandler("onResourceStart", resourceRoot, function() for _,player in ipairs(getElementsByType("player")) do setPlayerColorAndClearNick(player) end end ) addEventHandler("onPlayerJoin", root, function() setPlayerColorAndClearNick(source) end ) addEventHandler("onPlayerQuit", root, function() if(isElement(playerBlips[source])) then destroyElement(playerBlips[source]) playerBlips[source] = nil end end )
-
thank you yes i thought of doing that too
-
hello, I tried your solution but it didn't work, instead I transferred the rotation finder codes to the client side and ran it with triggerClientEvent on the server side, no problems at the moment. works interestingly server function zombieBehaviour() for i=1,#zombies do -- face toward zombie to player if(zombieDatas[zombies[i]].Target ~= nil) then if(isElement(zombies[i])) then triggerClientEvent(root, "faceTowardZombie", zombies[i], zombies[i], zombieDatas[zombies[i]].Target) end end end end behaviourUpdater = setTimer(zombieBehaviour, 130, 0) client function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end return t end addEvent("faceTowardZombie", true) addEventHandler("faceTowardZombie", root, function(theZombie, theTarget) local zombieX, zombieY, zombieZ = getElementPosition(theZombie) local playerX, playerY, playerZ = getElementPosition(theTarget) local rotX, rotY, rotZ = getElementRotation(theZombie, "default") setElementRotation(theZombie, rotX, rotY, findRotation(zombieX, zombieY, playerX, playerY), "default", true) end ) I think I'll have to rewrite these script, thank you for your answers.
-
https://streamable.com/y18hzw what I'm talking about is a bug like this, this bug never happens on the client side, I tested it many times, the script in the video is server side distortion occurs in the rotation of the ped as in the video
-
Let me take a video of this
-
The problem is that if you hit the peds with a fist from the face, the rotation will break down at some point, I know it will work fine you can try it it. is not possible for scripts to mix because I only run this script, all other scripts are default scripts
-
I simplified the code but it still makes the same error 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 zSkins = {13,22,56,67,68,69,70,92,97,105,107,108,126,127,128,152,162,167,188,195,206,209,212,229,230,258,264,277,280,287} local zombies = {} local zombieDatas = {} local behaviourUpdater local theZombie = createPed(0, 0, 0, 4) local theTarget = getPlayerFromName("Burak2346") function zombieBehaviour() local zombieX, zombieY, zombieZ = getElementPosition(theZombie) local playerX, playerY, playerZ = getElementPosition(theTarget) setElementRotation (theZombie, zombieX, zombieY, findRotation(zombieX, zombieY, playerX, playerY), "default", true) end behaviourUpdater = setTimer(zombieBehaviour, 130, 0) I'm sure there is something on the server side peds