Jump to content

Walid

Members
  • Posts

    1,491
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Walid

  1. function getPositionInfrontOfElement(element, meters) if (not element or not isElement(element)) then return false end local meters = (type(meters) == "number" and meters) or 3 local posX, posY, posZ = getElementPosition(element) local _, _, rotation = getElementRotation(element) posX = posX - math.sin(math.rad(rotation)) * meters posY = posY + math.cos(math.rad(rotation)) * meters rot = rotation + math.cos(math.rad(rotation)) return posX, posY, posZ , rot end
  2. The solution is: 1) Always call downloadFile for files with download="false". 2) Only use the file after onClientFileDownloadComplete is triggered. 3) You are using fileExists to skip downloadFile, but fileExists does not check the file content. downloadFile automatcially checks the existing file first, and will immediately trigger onClientFileDownloadComplete if download is not required. Just remove fileExists().
  3. This plugin adds select all toolbar button which makes possible to select entire contents of the document. It makes it is easier to e.g. apply any formatting to a larger text fragment.
  4. local mkl = createMarker ( 1274.0817871094, -1657.0938720703, 13.546875 ,"cylinder", 1.5, 0, 255, 0, 255 ) function createVehicleForPlayer ( thePlayer ) if thePlayer and getElementType( thePlayer ) == "player" and not isPedInVehicle (thePlayer) then local x ,y ,z = getElementPosition ( thePlayer ) local createdVehicle = createVehicle (597, x + 5, y, z ) if ( not createdVehicle ) then outputChatBox ( "Error spawning vehicle.", thePlayer, 255, 0, 0 ) else outputChatBox ( "The vehicle was created successfully.", thePlayer, 0, 255, 0 ) end end end addEventHandler( "onMarkerHit", mkl, createVehicleForPlayer )
  5. Try this: function getSortedTable() local sortedTable = {} local players = getElementsByType("player") for i=1, #players do local playerName = getPlayerName(players[i]) local money = getPlayerMoney(players[i]) table.insert(sortedTable,{['name'] = playerName,['value'] = money}) end table.sort(sortedTable, function(a, b) return a.value > b.value end ) return sortedTable end function show10RichestPlayers() local sortedPlayers = getSortedTable() for i=1, 10 do outputChatBox(sortedPlayers[i].name.." - $"..sortedPlayers[i].value, root, 0, 255, 0) end end addCommandHandler('show10', show10RichestPlayers)
  6. Sorry i don't undrestand what you want exactly, if you want to get the target position just get the aiming vector from turret's rotation and combine it with turret's position using getVehicleComponentPosition and then transform the result into world coordinate by multiplying it by vehicle's matrix (you need to use getElementMatrix). in case you don't know the turrent component (misc_a, misc_d , misc_b) .
  7. un-check (because if you check it you will hide file name extension). Anyways all what you need to do is: Start Windows Explorer, you can do this by opening up any folder. Click Organize. Click Folder and search options. Click the View tab. Scroll down until you notice Hide extensions for known file types, un-check this line by clicking the check box. Click OK Now rename the file replace .txt with .lua
  8. All what you need is isPedInVehicle , getPedOccupiedVehicle , getVehicleOccupants , setVehicleLightState , setVehicleHeadLightColor , setVehicleOverrideLights , setTimer, isTimer, killTimer .
  9. Using startResource on player login is very very very bad idea, simply you can use something like: -- Server side addEventHandler("onPlayerLogin", root, function(_,account) local check = getAccountData(account, "FirstTime") if check then outputChatBox("This is not the first time for you!", source, 255, 0, 0) else outputChatBox("You're playing for the first time!", source, 0, 255, 0) setElementPosition ( source, 1254.50049, -790.40015, 92.03018 ) setAccountData(account, "FirstTime", true) triggerClientEvent(source,"EventName",source) end end ) -- Client side addEvent("EventName", true ) addEventHandler("EventName", root, function () guiSetVisible(yourGui, not guiGetVisible(yourGui)) showCursor(guiGetVisible(yourGui)) end )
  10. What are you trying to do?! as far as i know the resource will be started for all players.
  11. As i undrestand you want to change the picture when the player click an item, so All what you need is guiStaticImageLoadImage.
  12. Walid

    [ HELP ]

    Check if the calibri.ttf exist in your resource folder also you need to add the correct path in meta.xml file. <file src="calibri.ttf" type="client" /> Note: use more descriptive topic titles in the future, instead of just help.
  13. What about this (untested) addEventHandler("onClientVehicleEnter", getRootElement(), function(player, seat) if player == localPlayer then local radioID = getElementData (source, "radioID" ) if radioID and radioID >= 0 then local sound = getSoundsBlyat[source] if sound and isElement(sound) then local meta = getSoundMetaTags(sound) title = meta.title end end end end ) -- "onClientPlayerRadioSwitch" addEventHandler("onClientPlayerRadioSwitch", getLocalPlayer(), function (station) if isPedInVehicle ( localPlayer ) then if station ~= 0 then local vehicle = getPedOccupiedVehicle ( localPlayer ) -- use the same code here and make sure you keep title (global variable) end end end ) addEventHandler ( "onClientRender", root, function ( ) if title then -- draw sound title here end and
  14. You need the customblips resource to draw text on F11 map.
  15. -- Added addCommandHandler (press T /cv) function cv(player) local Ped = createPed ( 287, 0, 0, 3 ) local Vehicle = createVehicle ( 487, 1290.68958, -785.93646, 96.55399 ) setVehicleColor( Vehicle, 0, 0, 0, 0, 250, 250 ) warpPedIntoVehicle ( Ped, Vehicle ) end addCommandHandler("cv",cv) -- Or create it onResourceStart function cv() local Ped = createPed ( 287, 0, 0, 3 ) local Vehicle = createVehicle ( 487, 1290.68958, -785.93646, 96.55399 ) setVehicleColor( Vehicle, 0, 0, 0, 0, 250, 250 ) warpPedIntoVehicle ( Ped, Vehicle ) end addEventHandler ("onResourceStart", resourceRoot, cv )
  16. Try to use SetModEnabled > "onClientFileDownloadComplete".
  17. All what you need is Method 1 -- Functions getElementPosition() createEffect() setEffectSpeed() attachEffect() dxCreateShader() dxCreateTexture() engineApplyShaderToWorldTexture() -- Events onClientRender Method 2 createObject() -- 2780 smoke machine setElementCollisionsEnabled() setObjectScale() isPedInVehicle() getPedOccupiedVehicle() attachElements()
×
×
  • Create New...