Mr.Loki

Members
  • Content count

    433
  • Joined

  • Last visited

Community Reputation

78 Popular

About Mr.Loki

  • Rank
    Thug
  • Birthday 04/08/93

Details

  • Location
    TT
  • Interests
    Give me an apple... and I'll eat it!

Recent Profile Visitors

1,231 profile views
  1. Auto Respawn

    No prob
  2. Auto Respawn

    Try something like this. This is a Server script. function RespawnStuff( ... ) -- Code to respawn stuff end addCommandHandler( "respawnall", function( plr, cmd, sec ) local time = sec and (sec * 1000) or 1000 setTimer( RespawnStuff, time, 1, ... ) outputChatBox( "Stuff will be respawned in "..sec.." seconds." ) end)
  3. Are you using any script to change the weapons?
  4. I still am not sure of what you are trying to accomplish. Do you want to change the ped/player's weapon? If so then use this setPedWeaponSlot.
  5. Please read the guidelines before posting.
  6. attemt to call local v (userdata value)

    Try using Sublime Text 3 with Lua Linter addon. Works like a charm
  7. dxDrawTextOnElement, dxDrawRectangle3D

    I modified the custom function a bit... but this is what it does. I hope this helps. Also added another arg to set the background colour or hide it. https://gfycat.com/UnimportantHiddenIberianmole function Draw() local vehs = getElementsByType("vehicle") local players = getElementsByType("player") for k,v in ipairs(vehs) do if getPedOccupiedVehicle( localPlayer ) ~= v then dxDrawTextOnElement (v, getVehiclePlateText(v), 0.75, _, _, _, _, _, 2, _, tocolor(0,0,0,255)) end end for k,v in ipairs(players) do if v ~= localPlayer then dxDrawTextOnElement (v, getPlayerName(v), _, _, _, _, _, _, 1) end end end addEventHandler ("onClientRender", getRootElement(), Draw) function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,bgColor,checkBuildings,checkVehicles,checkPeds,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getCameraMatrix() local distance = distance or 20 local height = height or 1 local checkBuildings = checkBuildings or true local checkVehicles = checkVehicles or false local checkPeds = checkPeds or false local checkObjects = checkObjects or true local checkDummies = checkDummies or true local seeThroughStuff = seeThroughStuff or false local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false local ignoredElement = ignoredElement or nil if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then if bgColor then local tw = dxGetTextWidth( text, size or 1, font or "arial" ) local tw = tw-((distanceBetweenPoints / distance)*(tw/2)) local th = (12*size)-((distanceBetweenPoints / distance)*12) dxDrawRectangle( sx-(tw/2)-1, sy-(th/2)-1, tw+3, th+3 , bgColor) end dxDrawText(text, sx+2, sy+2, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") end end end end
  8. Client getElementData

    The problem is that the there is no data for "deaths" on the player so it is returning a boolean( a true/false value ) which would be false in your case. function KDShow(player) local deaths = getElementData ( localPlayer, "deaths" ) dxDrawText(deaths or 0, 86, 367, 193, 388, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end What I've done is made a simple check to see if deaths == false. If deaths == false it will use the or operator and return 0. If deaths == a number or anything, it will show that value of "deaths" instead. local deaths = (getElementData ( localPlayer, "deaths" ) or 0)
  9. Invisible weapons

    Make the texture transparent
  10. [HELP]replace model

    engineLoadTXD engineLoadDFF engineImportTXD engineReplaceModel There is a search bar on the forum.
  11. help

    show us the "loadTurfs" function because there's nothing to work with here.
  12. A little problem

    addCommandHandler("sendmoney",function(player,cmd,targetPlayerName,money) money = tonumber(money) and math.floor(tonumber(money)) or nil if not (targetPlayerName) or not (money) then outputChatBox("use /" .. cmd .. " [Player] [Amount]",player,255,0,0,true) else local targetPlayer = getPlayerFromName (targetPlayerName) if targetPlayer then if (targetPlayer==player) then outputChatBox(" You cant give money to yourself.",player,255,0,0,true) elseif money <= 0 then outputChatBox(" Minimum ammount is 1.",player,255,0,0,true) elseif getPlayerMoney(player) >= money and money > 0 and targetPlayer~=player then takePlayerMoney(player,money) givePlayerMoney(targetPlayer,money) outputChatBox ( "You gave " .. targetPlayerName .. " " .. money .. "$", player, 0, 255, 0, true) -- THIS LINE outputChatBox ( "" .. player .. "gave you " .. money .. "$", targetPlayer, 0, 255, 0, true ) -- THIS LINE else outputChatBox(" You dont have enough money.",player,177,9,45,true) end end end end) You have to read through your code carefully.
  13. distance

    You already calculated the distance so all you have to do it check if the distance is less than 50 or 5 function dxDrawImageOnElement() local playerPosition = {getElementPosition(localPlayer)} local elementPosition = {getElementPosition(data.element)} local distance = math.floor(getDistanceBetweenPoints3D(elementPosition[1], elementPosition[2], elementPosition[3], playerPosition[1], playerPosition[2], playerPosition[3])) local coords = {getScreenFromWorldPosition(elementPosition[1], elementPosition[2], elementPosition[3]+0.3)} local clear = isLineOfSightClear(elementPosition[1], elementPosition[2], elementPosition[3], playerPosition[1], playerPosition[2], playerPosition[3], false, false, false, false, true, false, false, nil) if coords[1] and clear and distance <= 50 then -- Check if the distance is less than "50" dxDrawText(distance.."m", coords[1], coords[2] + sy/38, coords[1], coords[2], tocolor(255, 255, 255, 255), 2, "default-bold", "center", "center", false, false) dxDrawImage(coords[1], coords[2], data.width, data.height, data.image..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end end Since you are scripting with tables like this I suggest you learn to use OOP and Vectors it's very similar and much simpler to use. For example: function dxDrawImageOnElement() local player = localPlayer.position local elem = Vector3(getElementPosition(data.element)) local distance = (player-elem).length local coords = Vector2(getScreenFromWorldPosition(elem+Vector3(0,0,0.3))) local clear = isLineOfSightClear(elem, player, false, false, false, false, true, false, false, nil) if coords.x and clear then dxDrawText(distance.."m", coords.x, coords.y + sy/38, coords.x, coords.y, tocolor(255, 255, 255, 255), 2, "default-bold", "center", "center", false, false) dxDrawImage(coords.x, coords.y, data.width, data.height, data.image..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end end
  14. [HELP] a string value

    setElementData(theElement, "checkpoint", (tonumber(playerKOTHPoints) and playerKOTHPoints+1 or 1)) ok try this instead
  15. Render a 3D-map

    Use a render target along with dxDrawMaterialLine3D.