Jump to content

DRW

Members
  • Posts

    364
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by DRW

  1. Got it! Forgot to add totalAmmo behind killer, sorry for bothering you, thanks!
  2. The rest of the code has like 400 lines, but there is a part that sets the elementdata "oficiomercenario" to the player, with that should be enough for the player to be able to get the money and all those things, also, no debugscript problems.
  3. I'm making a mercenary script, the mercenary has to kill people and get money for it, if he dies, he will lose 2k dollars, but if he has less than that, then he won't lose anything, if it kills, he'll get 1k, if the wasted player has less than 500 dollars, then the wasted player won't lose any money. Now... what's wrong with this? It does not work. addEventHandler ("onPlayerWasted",getRootElement(),function(killer,weapon,bodypart) if killer then if getElementData (killer,"hacedm") then outputChatBox ("En zonas de DM las recompensas de Mercenario están canceladas.",killer) return end if getElementData (killer,"oficiomercenario") then if getPlayerMoney(source)<500 then setPlayerMoney (killer,getPlayerMoney(killer)+1000) outputChatBox ("¡Has matado a alguien y has recibido 1000$!",killer,255,0,0) return end local naombre = getPlayerName (source) setPlayerMoney (source,getPlayerMoney(source)-500) setPlayerMoney (killer,getPlayerMoney(killer)+1000) outputChatBox ("¡Has matado a alguien y has recibido 1000$!",killer,255,0,0) elseif getElementData (source,"oficiomercenario") then if getPlayerMoney (source)<2000 then setPlayerMoney (killer,getPlayerMoney(killer)+1000) return end setPlayerMoney (source,getPlayerMoney(source)-2000) setPlayerMoney (killer,getPlayerMoney(killer)+1000) end end end)
  4. Hello, I'm trying to make a script, but I have a problem, the world object does not get detected when the colShape touches it. I'd like the onClientColShapeHit event to be triggered when a world object touches the colShape, or at least to get a function that can trigger an event if a world object is in a certain distance from the back of the player, how can I do it? local x,y,z = getElementPosition(localPlayer) local cols = createColSphere (x+2,y,z,0.5) setDevelopmentMode (true) addEventHandler("onClientRender",getRootElement(),function() local screenWidth, screenHeight = guiGetScreenSize() if isElement(cols) then local playerrot = getPedRotation ( getLocalPlayer () ) local radRot = math.rad ( playerrot ) local radius = 1 local px,py,pz = getElementPosition( getLocalPlayer () ) local tx = px + radius * math.sin(radRot) local ty = py + -(radius) * math.cos(radRot) local tz = pz setElementPosition ( cols, tx, ty, tz ) end end) addEventHandler ("onClientColShapeHit",getRootElement(),function(theElement) if getElementType (theElement)=="object" then outputChatBox ("it works") end end)
  5. Hello, I'm modifying a 3D hud, it works, but only for some people, the problem is that I want to check if the rendering was unsuccessful, I mean, if it's not visible to players then cancel that and make the real hud be visible. How can I do that? --// --|| Created by KryPtoHolYx --|| for More free Scripts visit kryptoholyx.com --|| Thanks for Downloading --\\ local white = tocolor(255,255,255,255) function dxDrawImage3D(x,y,z,w,h,m,c,r) local lx, ly, lz = x+w, y+h, (z+tonumber(r or 0)) or z return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, m, h, c or white) end offsetboneZP = 52 --// valid are all bones offsetdistZP1 = 0.66 offsetdistZP2 = 0.30 rotoffsetZP1 = 215 rotoffsetZP2 = -90 zoffsetZP = -0.09 --// Settings C_Disable_GTA_HUD = false C_Creator_ScreenWidth = 1440 C_Creator_ScreenHeight = 900 s = {guiGetScreenSize()} --AMMO offsetboneAmmo = 23 --// valid are "muzzle" and all bones offsetdistAmmo1 = 0.15 offsetdistAmmo2 = 0.1 rotoffsetAmmo1 = 0 rotoffsetAmmo2 = -90 zoffsetAmmo = 0.1 --HEALTH offsetboneHealth = 32 --// valid are all bones offsetdistHealth1 = 0.1 offsetdistHealth2 = 0.1 rotoffsetHealth1 = 150 rotoffsetHealth2 = -90 zoffsetHealth = 0.1 --MONEY offsetboneMoney = 41 --// valid are all bones offsetdistMoney1 = 0.50 offsetdistMoney2 = 0.25 rotoffsetMoney1 = 230 rotoffsetMoney2 = -90 zoffsetMoney = -0.2 debug = false drawboxes = false drawammo = true drawhp = true drawmoney = true drawzp = true --\\ local function dxDrawTextBordered(text,x,y,tx,ty, color, size, font,right,top, clip, wordBreak, postGUI,colorCoded, subPixelPositioning) dxDrawText(text,x-1,y,tx-1,ty, tocolor(0, 0, 0, 255), size, font,right,top, clip, wordBreak, postGUI,colorCoded, subPixelPositioning) dxDrawText(text,x,y-1,tx,ty-1, tocolor(0, 0, 0, 255), size, font,right,top, clip, wordBreak, postGUI,colorCoded, subPixelPositioning) dxDrawText(text,x+1,y,tx+1,ty, tocolor(0, 0, 0, 255), size, font,right,top, clip, wordBreak, postGUI,colorCoded, subPixelPositioning) dxDrawText(text,x,y+1,tx,ty+1, tocolor(0, 0, 0, 255), size, font,right,top, clip, wordBreak, postGUI,colorCoded, subPixelPositioningpo) dxDrawText(text,x,y,tx,ty, color, size, font,right,top) end showPlayerHudComponent ( "all",false ) showPlayerHudComponent ( "radar", true) showPlayerHudComponent ( "crosshair", true ) showPlayerHudComponent ( "vehicle_name", false ) function findrotation (x,y,rz,dist,rot) local x = x+dist*math.cos(math.rad(rz+rot)) local y = y+dist*math.sin(math.rad(rz+rot)) return x,y end --// Making the dxdraws fit on all Resolutions ! _dxDrawRectangle = dxDrawRectangle _dxDrawText = dxDrawText function dxDrawRectangle(x,y,w,h,...) local x = s[1]*(x)/C_Creator_ScreenWidth local y = s[2]*(y)/C_Creator_ScreenHeight local w = s[1]*(w)/C_Creator_ScreenWidth local h = s[2]*(h)/C_Creator_ScreenHeight return _dxDrawRectangle(x,y,w,h,...) end function dxDrawText(text,x,y,w,h,...) local x = s[1]*(x)/C_Creator_ScreenWidth local y = s[2]*(y)/C_Creator_ScreenHeight local w = s[1]*(w)/C_Creator_ScreenWidth local h = s[2]*(h)/C_Creator_ScreenHeight return _dxDrawText(text,x,y,w,h,...) end --\\ --// Syncing the Fucking money setTimer(function () setElementData(localPlayer,"money",getPlayerMoney()) end,1000,0) --\\ magazines = { [22]=17, [23]=17, [24]=7, [25]=1, [26]=2, [27]=7, [28]=50, [29]=30, [30]=30, [31]=50, [32]=50, [33]=1, [34]=1, [35]=1, [36]=1, [37]=50, [38]=500, [41]=500, [42]=500, [43]=36, } --// Createds rTargets local rTarget = {} rTarget[localPlayer] = {} rTarget[localPlayer]["ammo"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[localPlayer]["health"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[localPlayer]["Money"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[localPlayer]["ZP"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()),function() if not rTarget then showPlayerHudComponent ( "all",true ) end end) addEventHandler("onClientRender",getRootElement(), function () if isPlayerInVehicle(localPlayer) then return end for index,player in ipairs(getElementsByType("player")) do if not isElementStreamedIn (player) then return end if getElementDimension(player) ~= getElementDimension(localPlayer) then return end if getElementInterior(player) ~= getElementInterior(localPlayer) then return end if not rTarget[player] then rTarget[player] = {} rTarget[player]["ammo"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth,s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[player]["health"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[player]["Money"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[player]["ZP"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) end -- // Total Ammo and Ammo for rTarget["ammo"] ammo = getPedAmmoInClip(player) atammo = getPedTotalAmmo(player) if magazines[getPedWeapon(player)] then tammo = math.floor((atammo-ammo)/magazines[getPedWeapon(player)]) -- // Updates the rTarget Ammo with the Informations from above dxSetRenderTarget ( rTarget[player]["ammo"],true ) if drawboxes then --// Draws the Borders around the Ammo local bbox = 0 for i=0,75,2 do bbox = bbox +1 if bbox == 1 then else bbox = 0 end end --\\ end dxDrawTextBordered ( ammo,200,170,200,170,tocolor(255,255,255,150),1.9,"pricedown","center", "center") dxDrawTextBordered ( atammo-ammo, 200,200,200,200,tocolor(255,255,255,150),1,"pricedown","center", "center") dxDrawTextBordered ( getWeaponNameFromID(getPedWeapon(localPlayer)), 200,240,200,200,tocolor(200,200,200,200),1,"pricedown","center", "center") dxSetRenderTarget () end dxSetRenderTarget (rTarget[player]["health"],true ) if drawboxes then --// Draws the Borders around the Ammo local bbox = 0 for i=0,75,2 do bbox = bbox +1 if bbox == 1 then dxDrawRectangle(150,(133+i),100,2,tocolor(0,0,0,150)) else bbox = 0 end end --\\ end dxDrawTextBordered (math.floor(getElementHealth(player)), 200,160,200,160,tocolor(200,0,0,255),2,"pricedown","center", "center") dxDrawTextBordered (math.floor(getPedArmor(player)), 200,190,200,190,tocolor(150,150,150,255),1.5,"pricedown","center", "center") dxSetRenderTarget () dxSetRenderTarget ( rTarget[player]["Money"],true ) dxDrawTextBordered ("$"..math.floor(getElementData(player,"money")), 115,160,200,160,tocolor(0,200,0,255),2,"pricedown","left", "center") dxDrawTextBordered ("EXP: "..getElementData(player,"Zombie kills"), 115,250,200,160,tocolor(255,255,255,255),2,"pricedown","left", "center") dxDrawTextBordered ("lVL"..getElementData(player,"levelnum"), 115,360,200,160,tocolor(255,255,255,255),3,"pricedown","left", "center") dxSetRenderTarget () dxSetRenderTarget ( rTarget[player]["ZP"],true ) dxDrawTextBordered ("ZP: "..math.floor(getElementData(player,"moneycoins")), 200,160,200,160,tocolor(0,252,254,255),2,"pricedown","left", "center") dxSetRenderTarget () --// Finds Positions for the rTarget Ammo if offsetboneAmmo ~= "muzzle" then sx,sy,z = getPedBonePosition(player,offsetboneAmmo) else sx,sy,z = getPedWeaponMuzzlePosition(player) end local rz = getPedRotation(player) x1,y1 = findrotation (sx,sy,rz,offsetdistAmmo1,rotoffsetAmmo1) x,y = findrotation (x1,y1,rz,offsetdistAmmo2,rotoffsetAmmo2) --// Draws Ammo rTarget if drawammo then if magazines[getPedWeapon(player)] then dxDrawMaterialLine3D ( x1,y1,z+zoffsetAmmo+0.5,x1,y1,z+zoffsetAmmo-0.5,rTarget[player]["ammo"], 1, tocolor(255,255,255,255),x,y,z) end end --// for Testing if debug then dxDrawLine3D(sx,sy,z,x1,y1,z+zoffsetAmmo) dxDrawLine3D(x1,y1,z+zoffsetAmmo,x,y,z+zoffsetAmmo) end --// Finds Positions for the rTarget Health local sx,sy,z = getPedBonePosition(player,offsetboneHealth) local rz = getPedRotation(player) x1,y1 = findrotation (sx,sy,rz,offsetdistHealth1,rotoffsetHealth1) x,y = findrotation (x1,y1,rz,offsetdistHealth2,rotoffsetHealth2) --// Draws health rTarget if drawhp then dxDrawMaterialLine3D ( x1,y1,z+zoffsetHealth+0.5,x1,y1,z+zoffsetHealth-0.5,rTarget[player]["health"], 1, tocolor(255,255,255,255),x,y,z) end --// for Testing
  6. Hello, I'm modifying a 3D hud, it works, but only for some people, the problem is that I want to check if the rendering was unsuccessful, I mean, if it's not visible to players then cancel that and make the real hud be visible. --// --|| Created by KryPtoHolYx --|| for More free Scripts visit kryptoholyx.com --|| Thanks for Downloading --\\ local white = tocolor(255,255,255,255) function dxDrawImage3D(x,y,z,w,h,m,c,r) local lx, ly, lz = x+w, y+h, (z+tonumber(r or 0)) or z return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, m, h, c or white) end offsetboneZP = 52 --// valid are all bones offsetdistZP1 = 0.66 offsetdistZP2 = 0.30 rotoffsetZP1 = 215 rotoffsetZP2 = -90 zoffsetZP = -0.09 --// Settings C_Disable_GTA_HUD = false C_Creator_ScreenWidth = 1440 C_Creator_ScreenHeight = 900 s = {guiGetScreenSize()} --AMMO offsetboneAmmo = 23 --// valid are "muzzle" and all bones offsetdistAmmo1 = 0.15 offsetdistAmmo2 = 0.1 rotoffsetAmmo1 = 0 rotoffsetAmmo2 = -90 zoffsetAmmo = 0.1 --HEALTH offsetboneHealth = 32 --// valid are all bones offsetdistHealth1 = 0.1 offsetdistHealth2 = 0.1 rotoffsetHealth1 = 150 rotoffsetHealth2 = -90 zoffsetHealth = 0.1 --MONEY offsetboneMoney = 41 --// valid are all bones offsetdistMoney1 = 0.50 offsetdistMoney2 = 0.25 rotoffsetMoney1 = 230 rotoffsetMoney2 = -90 zoffsetMoney = -0.2 debug = false drawboxes = false drawammo = true drawhp = true drawmoney = true drawzp = true --\\ local function dxDrawTextBordered(text,x,y,tx,ty, color, size, font,right,top, clip, wordBreak, postGUI,colorCoded, subPixelPositioning) dxDrawText(text,x-1,y,tx-1,ty, tocolor(0, 0, 0, 255), size, font,right,top, clip, wordBreak, postGUI,colorCoded, subPixelPositioning) dxDrawText(text,x,y-1,tx,ty-1, tocolor(0, 0, 0, 255), size, font,right,top, clip, wordBreak, postGUI,colorCoded, subPixelPositioning) dxDrawText(text,x+1,y,tx+1,ty, tocolor(0, 0, 0, 255), size, font,right,top, clip, wordBreak, postGUI,colorCoded, subPixelPositioning) dxDrawText(text,x,y+1,tx,ty+1, tocolor(0, 0, 0, 255), size, font,right,top, clip, wordBreak, postGUI,colorCoded, subPixelPositioningpo) dxDrawText(text,x,y,tx,ty, color, size, font,right,top) end showPlayerHudComponent ( "all",false ) showPlayerHudComponent ( "radar", true) showPlayerHudComponent ( "crosshair", true ) showPlayerHudComponent ( "vehicle_name", false ) function findrotation (x,y,rz,dist,rot) local x = x+dist*math.cos(math.rad(rz+rot)) local y = y+dist*math.sin(math.rad(rz+rot)) return x,y end --// Making the dxdraws fit on all Resolutions ! _dxDrawRectangle = dxDrawRectangle _dxDrawText = dxDrawText function dxDrawRectangle(x,y,w,h,...) local x = s[1]*(x)/C_Creator_ScreenWidth local y = s[2]*(y)/C_Creator_ScreenHeight local w = s[1]*(w)/C_Creator_ScreenWidth local h = s[2]*(h)/C_Creator_ScreenHeight return _dxDrawRectangle(x,y,w,h,...) end function dxDrawText(text,x,y,w,h,...) local x = s[1]*(x)/C_Creator_ScreenWidth local y = s[2]*(y)/C_Creator_ScreenHeight local w = s[1]*(w)/C_Creator_ScreenWidth local h = s[2]*(h)/C_Creator_ScreenHeight return _dxDrawText(text,x,y,w,h,...) end --\\ --// Syncing the Fucking money setTimer(function () setElementData(localPlayer,"money",getPlayerMoney()) end,1000,0) --\\ magazines = { [22]=17, [23]=17, [24]=7, [25]=1, [26]=2, [27]=7, [28]=50, [29]=30, [30]=30, [31]=50, [32]=50, [33]=1, [34]=1, [35]=1, [36]=1, [37]=50, [38]=500, [41]=500, [42]=500, [43]=36, } --// Createds rTargets local rTarget = {} rTarget[localPlayer] = {} rTarget[localPlayer]["ammo"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[localPlayer]["health"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[localPlayer]["Money"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[localPlayer]["ZP"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()),function() if not rTarget then showPlayerHudComponent ( "all",true ) end end) addEventHandler("onClientRender",getRootElement(), function () if isPlayerInVehicle(localPlayer) then return end for index,player in ipairs(getElementsByType("player")) do if not isElementStreamedIn (player) then return end if getElementDimension(player) ~= getElementDimension(localPlayer) then return end if getElementInterior(player) ~= getElementInterior(localPlayer) then return end if not rTarget[player] then rTarget[player] = {} rTarget[player]["ammo"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth,s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[player]["health"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[player]["Money"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) rTarget[player]["ZP"] = dxCreateRenderTarget(s[1]*(400)/C_Creator_ScreenWidth, s[2]*(400)/C_Creator_ScreenHeight,true) end -- // Total Ammo and Ammo for rTarget["ammo"] ammo = getPedAmmoInClip(player) atammo = getPedTotalAmmo(player) if magazines[getPedWeapon(player)] then tammo = math.floor((atammo-ammo)/magazines[getPedWeapon(player)]) -- // Updates the rTarget Ammo with the Informations from above dxSetRenderTarget ( rTarget[player]["ammo"],true ) if drawboxes then --// Draws the Borders around the Ammo local bbox = 0 for i=0,75,2 do bbox = bbox +1 if bbox == 1 then else bbox = 0 end end --\\ end dxDrawTextBordered ( ammo,200,170,200,170,tocolor(255,255,255,150),1.9,"pricedown","center", "center") dxDrawTextBordered ( atammo-ammo, 200,200,200,200,tocolor(255,255,255,150),1,"pricedown","center", "center") dxDrawTextBordered ( getWeaponNameFromID(getPedWeapon(localPlayer)), 200,240,200,200,tocolor(200,200,200,200),1,"pricedown","center", "center") dxSetRenderTarget () end dxSetRenderTarget (rTarget[player]["health"],true ) if drawboxes then --// Draws the Borders around the Ammo local bbox = 0 for i=0,75,2 do bbox = bbox +1 if bbox == 1 then dxDrawRectangle(150,(133+i),100,2,tocolor(0,0,0,150)) else bbox = 0 end end --\\ end dxDrawTextBordered (math.floor(getElementHealth(player)), 200,160,200,160,tocolor(200,0,0,255),2,"pricedown","center", "center") dxDrawTextBordered (math.floor(getPedArmor(player)), 200,190,200,190,tocolor(150,150,150,255),1.5,"pricedown","center", "center") dxSetRenderTarget () dxSetRenderTarget ( rTarget[player]["Money"],true ) dxDrawTextBordered ("$"..math.floor(getElementData(player,"money")), 115,160,200,160,tocolor(0,200,0,255),2,"pricedown","left", "center") dxDrawTextBordered ("EXP: "..getElementData(player,"Zombie kills"), 115,250,200,160,tocolor(255,255,255,255),2,"pricedown","left", "center") dxDrawTextBordered ("lVL"..getElementData(player,"levelnum"), 115,360,200,160,tocolor(255,255,255,255),3,"pricedown","left", "center") dxSetRenderTarget () dxSetRenderTarget ( rTarget[player]["ZP"],true ) dxDrawTextBordered ("ZP: "..math.floor(getElementData(player,"moneycoins")), 200,160,200,160,tocolor(0,252,254,255),2,"pricedown","left", "center") dxSetRenderTarget () --// Finds Positions for the rTarget Ammo if offsetboneAmmo ~= "muzzle" then sx,sy,z = getPedBonePosition(player,offsetboneAmmo) else sx,sy,z = getPedWeaponMuzzlePosition(player) end local rz = getPedRotation(player) x1,y1 = findrotation (sx,sy,rz,offsetdistAmmo1,rotoffsetAmmo1) x,y = findrotation (x1,y1,rz,offsetdistAmmo2,rotoffsetAmmo2) --// Draws Ammo rTarget if drawammo then if magazines[getPedWeapon(player)] then dxDrawMaterialLine3D ( x1,y1,z+zoffsetAmmo+0.5,x1,y1,z+zoffsetAmmo-0.5,rTarget[player]["ammo"], 1, tocolor(255,255,255,255),x,y,z) end end --// for Testing if debug then dxDrawLine3D(sx,sy,z,x1,y1,z+zoffsetAmmo) dxDrawLine3D(x1,y1,z+zoffsetAmmo,x,y,z+zoffsetAmmo) end --// Finds Positions for the rTarget Health local sx,sy,z = getPedBonePosition(player,offsetboneHealth) local rz = getPedRotation(player) x1,y1 = findrotation (sx,sy,rz,offsetdistHealth1,rotoffsetHealth1) x,y = findrotation (x1,y1,rz,offsetdistHealth2,rotoffsetHealth2) --// Draws health rTarget if drawhp then dxDrawMaterialLine3D ( x1,y1,z+zoffsetHealth+0.5,x1,y1,z+zoffsetHealth-0.5,rTarget[player]["health"], 1, tocolor(255,255,255,255),x,y,z) end --// for Testing
  7. There ya go function refreshPage(theBrowser) local browser = guiGetBrowser(theBrowser) if isBrowserLoading(browser) then cancelEvent() else loadBrowserURL (browser,getBrowserURL(browser)) end end
  8. Are you using Windows 10? If so, then you'll have to wait for a new build to come or until the MTA team solves the problem when Win10 gets officially released.
  9. DRW

    dxDrawImage

    Dammit, sorry, I didn't read that part and didn't notice that, it makes so much sense, thank you both for helping me
  10. DRW

    dxDrawImage

    Well, I'll explain you: This one works pretty well, it prints the image to the 3D world and the lag is 0, so it's kinda good, but it's not facing me when i'm moving at left or right of the image, only if I'm moving up and down, so yeah, it faces me, but not on all directions. local white = tocolor(255,255,255,255) function dxDrawImage3D(x,y,z,w,h,m,c,r,...) local lx, ly, lz = x+w, y+h, (z+tonumber(r or 0)) or z return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, m, h, c or white, ...) end local pnet = dxCreateTexture("planet.png") addEventHandler("onClientRender", root, function() local x,y,z = getElementPosition(localPlayer) dxDrawImage3D(0,0, 20, 20, 800, pnet, tocolor(255,255,255,255),0,x,y,z) end ) Now, this is exactly the opposite of the other one, it lags a lot and it only follows me if I move at the right or at the left side of the image, so by far I'd select the first, but both of them are useless to me since they can't follow the player properly until I do something, and I'm not very familiarized with the dxDraw functions, so no idea about how to solve it. addEventHandler( 'onClientRender', root, function() local img1 = dxCreateTexture ("sonido/moon.png","png",2000,2000) dxDrawMaterialLine3D (-1410.13671875, 1362.8200683594, 109.26251983643,-1410.13671875, 1362.8203125, 119.46251678467,img1,80)
  11. DRW

    dxDrawImage

    Same as before
  12. DRW

    dxDrawImage

    local white = tocolor(255,255,255,255) function dxDrawImage3D(x,y,z,w,h,m,c,r,...) local lx, ly, lz = x+w, y+h, (z+tonumber(r or 0)) or z return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, m, h, c or white, ...) end local pnet = dxCreateTexture("planet.png") addEventHandler("onClientRender", root, function() dxDrawImage3D(0,0, 20, 20, 800, pnet, tocolor(255,255,255,255)) end ) I've used this, it consumes almost nothing, the only problem is that I want the image to look always at me, and this one only looks at me when I'm over or below the image, but hey, the dxDrawMaterialLine3D looks at me if I'm at the right or left side of the image, so it's almost the same problem. Look at this: viewtopic.php?f=91&t=89832,
  13. DRW

    dxDrawImage

    It works! Thanks, but I have too much lag, FPS drop from 40-50 to 4.8. Isn't there any alternative or something to make it work good? I mean, it's just an image, that FPS drop is not very normal.
  14. DRW

    dxDrawImage

    addEventHandler( 'onClientRender', root, function() local img1 = dxCreateTexture ("sonido/moon.png","png",2000,2000) dxDrawMaterialLine3D (-1410.13671875, 1362.8200683594, 109.26251983643,-1410.13671875, 1362.8203125, 119.46251678467,img1,80) end) Tried this, not working, nothing in debugscript.
  15. DRW

    dxDrawImage

    Hello, I've created a dxDrawImage on the 3D world but somehow nothing appears, what can I do? addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()),function() setElementDimension (minepedt1, 200) setPedFrozen (minepedt1,true) addEventHandler( 'onClientRender', root, function() local scX, scY = guiGetScreenSize(); local l_w = 64; local l_h = 64; local l_ratio = l_w / l_h; local lscale_w = 1920 / scX; l_w = l_w / lscale_w; l_h = l_w / l_ratio; local px, py = getScreenFromWorldPosition(238.48828125, 555.599609375, 86.254005432129, 0.06 ) dxDrawImage( px-l_w/2, py - scY/17, l_w, l_h, 'sonido/moon.png', 0, 0, 0, tocolor( 255,255,255, 255 ) ); end) end)
  16. Wow, really? How can I order downloads?
  17. Linux is an OS, not an FTP/SFTP file manager, you can know what kind of mta server you're using by entering the server and looking at the welcome message (something like "Connected! MTA SA Server 1.5 [GNU/Linux]", the red part says which OS you're using for running your server), if you're paying a server hoster, then you are probably using Windows, if you're using a VPS, then Linux, but check it out, also you can know it if you're running your MTA Server from an exe file (Windows) or a archive with no extension (Linux). I'm paying for host now how to update it? As Perfect said, you should make a topic at the respective section. The problem of hosters is that they don't usually give you access to the root MTA Server files, so updating it is relatively impossible, but there can be some exceptions, you should talk with your hoster's support or something. I personally recommend you getting a Linux-Based VPS (VPS is like a remote computer that lets you do whatever you want with it, all the ports are open and the VPS runs 24/7, you could increase your slots to 1024 and also you'll have bigger amounts of RAM, CPU, Hard drive space and protection [For bigger I mean BIGGER] for the same price, and you could create servers for other games), open your server there, I use OVH (ovh.com) they are a lot cheaper than a server hoster and the maintenance of the server is relatively easy and good.
  18. I've created some GUI labels attached to an image for a mining system, and it works well, it takes the elementData of a player and it changes the respective label with the number of the elementData I want to retrieve. The problem starts when joining, all the labels in the script appear and some of them bother a lot. The essential part of the clientside script (Enough to know what happens since local screenW, screenH = guiGetScreenSize() interfven = guiCreateStaticImage(screenW - 192 - 10, (screenH - 111) / 2, 192, 111, ":imageretriever/zm.png", false) lab = guiCreateLabel(10, 10, 64, 15, "Ununtrium:", false, interfven) guiSetFont(lab, "default-bold-small") lab1 = guiCreateLabel(10, 25, 83, 15, "Ununquadium:", false, interfven) guiSetFont(lab1, "default-bold-small") lab2 = guiCreateLabel(10, 40, 83, 15, "Ununpentium:", false, interfven) guiSetFont(lab2, "default-bold-small") lab3 = guiCreateLabel(10, 55, 73, 15, "Ununhexium:", false, interfven) guiSetFont(lab3, "default-bold-small") lab4 = guiCreateLabel(10, 70, 78, 15, "Ununseptium:", false, interfven) guiSetFont(lab4, "default-bold-small") lab5 = guiCreateLabel(10, 85, 73, 16, "Ununoctium:", false, interfven) guiSetFont(lab5, "default-bold-small") uut = guiCreateLabel(83, 10, 64, 15, "uut", false, interfven) guiSetFont(uut, "default-bold-small") guiLabelSetColor(uut, 28, 255, 4) uuq = guiCreateLabel(99, 25, 83, 15, "uuq", false, interfven) guiSetFont(uuq, "default-bold-small") guiLabelSetColor(uuq, 181, 254, 4) uup = guiCreateLabel(99, 40, 83, 15, "uup", false, interfven) guiSetFont(uup, "default-bold-small") guiLabelSetColor(uup, 255, 198, 2) uuh = guiCreateLabel(89, 55, 73, 15, "uuh", false, interfven) guiSetFont(uuh, "default-bold-small") guiLabelSetColor(uuh, 255, 127, 1) uus = guiCreateLabel(93, 70, 73, 15, "uus", false, interfven) guiSetFont(uus, "default-bold-small") guiLabelSetColor(uus, 255, 48, 0) uuo = guiCreateLabel(89, 85, 73, 15, "uuo", false, interfven) guiSetFont(uuo, "default-bold-small") guiLabelSetColor(uuo, 255, 0, 0) addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()),function() engineReplaceCOL ( col_floors, 3924 ) engineImportTXD ( txd_floors, 3924 ) engineReplaceModel ( dff_floors, 3924) local ununt= getElementData (localPlayer, "ununtrium") local ununq=getElementData (localPlayer, "ununquadium") local ununp=getElementData (localPlayer, "ununpentium") local ununh=getElementData (localPlayer, "ununhexium") local ununs=getElementData (localPlayer, "ununseptium") local ununo=getElementData (localPlayer, "ununoctium") guiSetText (uut, ""..ununt.."") guiSetText (uuq, ""..ununq.."") guiSetText (uup, ""..ununp.."") guiSetText (uuh, ""..ununh.."") guiSetText (uus, ""..ununs.."") guiSetText (uuo, ""..ununo.."") setDevelopmentMode (true) guiSetVisible (label,false) guiSetVisible (label2,false) guiSetVisible (label3,false) guiSetVisible (interfven,false) end) attempt to concatenate local 'ununt' (a boolean value) What's wrong?
  19. Linux is an OS, not an FTP/SFTP file manager, you can know what kind of mta server you're using by entering the server and looking at the welcome message (something like "Connected! MTA SA Server 1.5 [GNU/Linux]", the red part says which OS you're using for running your server), if you're paying a server hoster, then you are probably using Windows, if you're using a VPS, then Linux, but check it out, also you can know it if you're running your MTA Server from an exe file (Windows) or a archive with no extension (Linux).
  20. How to update my server i don't know please tell me? If your server is Linux-based then go here https://linux.multitheftauto.com/ and download the 32 or 64bit version depending of your current server, then just replace the files that are in the zip with the files of the server (each one in its respective path, the root archives go to the main server folder, and the ones in mods/deathmatch to the mods/deathmatch folder in the MTA server's folder).
  21. Error at line 147, unexpected symbol near [ Tried to solve it but it gives me other errors, so I don't know
  22. Gives error at the line 5 of the serverside part, also, it only changes the last name I put on the overrideName index overrideName = { {"Colt 45","Colt"}, {"Deagle","Desert Eagle"}, {"Uzi","Micro UZI"}, {"MP5","SMG"}, --It only changes this one, no matter what weapon is, if it's the last it will be the only on that changes its name, and it also makes the same effect as changing the names with guiGridListSetItemText } Serverside g_Root = getRootElement() resourceRoot = getResourceRootElement(getThisResource()) function giveClientWeapon(weapon, ammo, cost) giveWeapon(client, getWeaponIDFromName(weapon), ammo ) takePlayerMoney( client, cost ) end addEvent( "onClientGiveWeapon", true ) addEventHandler("onClientGiveWeapon", g_Root, giveClientWeapon) addEvent ("span", true) addEventHandler ("span", getRootElement(), function() if getAccountData (getPlayerAccount(source),"englishidioma","true") then triggerClientEvent (source, "guichanger", source) else triggerClientEvent (source, "guichanger2", source) end end )
  23. Hello, I've got a weapon shop script and it's pretty awesome, because it makes a gridlist where you can select the weapons you want. But I want to change a gridlist row name to another, but since this script uses guiGridListGetItemText to retrieve the weapon selected, changing the rows' names makes the script to not work properly because it can't retrieve a weapon from the name "Sub machine gun" for example. How can I make it work without breaking the script when changing the rows' names? Clientside guns = { {22, 7}, {24, 30}, {28, 14}, {29, 17}, {32, 11}, {25, 40}, {26, 50}, {27, 65}, {30, 22}, {31, 27}, {33, 73}, {34, 60}, {23, 80}, {44, 500}, {45, 500}, {46, 500}, {8, 200000}, } addEventHandler( "onClientResourceStart", getRootElement( ), function ( startedRes ) if startedRes == getThisResource() then createGunMenu() end end ); m = { } local rootNode = xmlLoadFile( "shops.xml" ) local markNodes = xmlNodeGetChildren(rootNode) for i,node in ipairs(markNodes) do local attr = xmlNodeGetAttributes( node ) local theMarker = createMarker(attr["posX"],attr["posY"],attr["posZ"],"corona",2,255,0,0,255) setElementInterior(theMarker,attr["interior"]) if attr["pedSkinID"] then thePed = createPed( attr["pedSkinID"], attr["pedX"],attr["pedY"],attr["pedZ"] ) setElementInterior(thePed,attr["interior"]) setElementRotation(thePed,0,0,attr["pedR"]) end m[i] = { theMarker, thePed } end function showGunMenu(hitPlayer) if hitPlayer == localPlayer then for i,v in ipairs(m) do if source == v[1] then g_px, g_py, g_pz = getElementPosition(v[2]) playSFX3D ( "spc_fa", 13, math.random(60,72), g_px, g_py, g_pz ) end end guiSetVisible(guiWdw, true) triggerServerEvent ("span",localPlayer) showCursor(true) end end for i,v in ipairs(m) do addEventHandler("onClientMarkerHit",v[1],showGunMenu) end function createGunMenu() guiWdw = guiCreateWindow ( 379, 208, 602, 370, "Buhonero", false ) gunList = guiCreateGridList ( 0.05, 0.05, 0.3, 0.9, true, guiWdw ) colGun = guiGridListAddColumn( gunList, "Gun", 0.5 ) colCost = guiGridListAddColumn( gunList, "Costbullet", 0.5 ) btnDiscard = guiCreateButton(0.4, 0.8, 0.15, 0.15, "Descartar", true, guiWdw) btnClose = guiCreateButton(0.6, 0.8, 0.15, 0.15, "Cerrar", true, guiWdw) btnBuy = guiCreateButton(0.8, 0.8, 0.15, 0.15, "Comprar/Buy.", true, guiWdw) btnAdd = guiCreateButton(0.8, 0.1, 0.15, 0.1, "Añadir/Add", true, guiWdw) editAmount = guiCreateEdit (0.4, 0.1, 0.35, 0.1, "Ammo", true, guiWdw) guiWindowSetSizable( guiWdw, false) guiSetVisible(guiWdw, false) addEventHandler("onClientGUIClick", btnClose, clientSubmitClose, false) addEventHandler("onClientGUIClick", btnDiscard, clientSubmitDiscard, false) addEventHandler("onClientGUIClick", btnBuy, clientSubmitBuy, false) addEventHandler("onClientGUIClick", btnAdd, clientSubmitCart, false) for p,v in ipairs(guns) do row = guiGridListAddRow ( gunList ) guiGridListSetItemText ( gunList, row, colGun, getWeaponNameFromID(v[1]), false, false ) guiGridListSetItemText ( gunList, row, colCost, v[2], false, false ) end cart = guiCreateGridList ( 0.4, 0.25, 0.55, 0.5, true, guiWdw ) colOrdGun = guiGridListAddColumn( cart, "Arma pedida", 0.33 ) colOrdAmmo = guiGridListAddColumn( cart, "Ammo", 0.33 ) colOrdCost = guiGridListAddColumn( cart, "Coste", 0.33 ) end addEvent ("guichanger",true) addEventHandler ("guichanger", getRootElement(), function() guiSetText (guiWdw,"Weapons Dealer") guiSetText (btnDiscard,"Discard") guiSetText (btnClose,"Close") guiSetText (btnAdd,"Add") guiSetText (btnBuy,"Buy") guiSetText (colOrdGun,"Weapon") guiSetText (colOrdAmmo,"Ammo") guiSetText (colOrdCost,"Cost") end) addEvent ("guichanger2",true) addEventHandler ("guichanger2", getRootElement(), function() guiSetText (guiWdw,"Vendedor de armas") guiSetText (btnDiscard,"Descartar") guiSetText (btnClose,"Cerrar") guiSetText (btnAdd,"Añadir") guiSetText (btnBuy,"Comprar") guiSetText (colOrdGun,"Arma") guiSetText (colOrdAmmo,"Munición") guiSetText (colOrdCost,"Coste") end) function clientSubmitBuy(button,state) if button == "left" and state == "up" then local rowCount = guiGridListGetRowCount ( cart ) local ordCost = 0 for i=0,rowCount-1,1 do ordCost = ordCost + guiGridListGetItemText ( cart, i, 3 ) end local playerMoney = getPlayerMoney() if playerMoney < ordCost then outputChatBox( "No te lo puedes permitir, necesitas $" .. ordCost .. "!" ) else guiSetText ( editAmount, "" ) guiSetInputEnabled(false) guiSetVisible(guiWdw, false) showCursor(false) for i=0,rowCount-1 do local ordGunName = guiGridListGetItemText ( cart, 0, 1 ) local ordGunAmmo = guiGridListGetItemText ( cart, 0, 2 ) local ordGunCost = guiGridListGetItemText ( cart, 0, 3 ) triggerServerEvent( "onClientGiveWeapon", getLocalPlayer(), ordGunName, ordGunAmmo, ordGunCost ) guiGridListRemoveRow(cart,0) end if rowCount > 0 then playSFX3D ( "spc_fa", 13, math.random(8,17), g_px, g_py, g_pz ) end end end end function clientSubmitCart(button,state) if button == "left" and state == "up" then local gunName = guiGridListGetItemText ( gunList, guiGridListGetSelectedItem(gunList), 1 ) local ammo = guiGetText(editAmount) local cost = ammo * guiGridListGetItemText ( gunList, guiGridListGetSelectedItem(gunList), 2 ) guiSetText ( editAmount, "" ) local row = guiGridListAddRow ( cart ) guiGridListSetItemText ( cart, row, colOrdGun, gunName, false, false ) guiGridListSetItemText ( cart, row, colOrdAmmo, ammo, false, false ) guiGridListSetItemText ( cart, row, colOrdCost, cost, false, false ) end end function clientSubmitClose(button,state) if button == "left" and state == "up" then guiSetText ( editAmount, "" ) guiSetInputEnabled(false) guiSetVisible(guiWdw, false) showCursor(false) local rowCount = guiGridListGetRowCount(cart) if rowCount > 0 then for i=0,rowCount-1 do guiGridListRemoveRow(cart,0) end end end end function clientSubmitDiscard(button,state) if button == "left" and state == "up" then local ar,ac = guiGridListGetSelectedItem(cart) guiGridListRemoveRow ( cart, ar ) end end
×
×
  • Create New...