-
Posts
1,491 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Walid
-
Post the part where you set the player animation
-
which x there is no x value in my code
-
Try this and post the error here: addEventHandler("onClientRender", getRootElement(), function() if newbieShow == false then return end local xp, yp, zp = getElementPosition(localPlayer) coords = {getScreenFromWorldPosition(xp, yp, zp)} if coords[1] and coords[2] then local length = dxGetTextWidth(newbieText, 1, "default-bold") dxDrawRectangle(coords[1] - length / 2 - screenWidth * 0.01, coords[2], screenWidth * 0.02 + length, screenHeight * 0.1, tocolor(33, 33, 33, 100)) dxDrawingColorText(newbieHead, coords[1] - length / 2 - screenWidth * 0.01, coords[2], coords[1] + length / 2 + screenWidth * 0.01, coords[2] + screenHeight * 0.03, tocolor(22, 255, 22, 120), 0.5, 1.1, "default-bold", "center", "center") dxDrawingColorText(newbieText, coords[1] - length / 2 - screenWidth * 0.01, coords[2] + screenHeight * 0.03, coords[1] + length / 2 + screenWidth * 0.01, coords[2] + screenHeight * 0.07, tocolor(255, 255, 255, 120), 0.5, 1, "default-bold", "center", "center") end end )
-
lol it's outputChatBox not ouputChatBox function gowmo() local team = getPlayerTeam(source) local r,g, b = getTeamColor(team) local hex = RGBToHex (r, g, b) outputChatBox("dead"..hex..""..getPlayerName(source), 255, 255, 255, true) end addEventHandler("onClientPlayerWasted",getLocalPlayer(), gowmo)
-
chnange newbiePosition to localPlayer because you can't getElementPosition of a number.
-
try it with onClientPlayerWasted -- Client Side function gowmo() local team = getPlayerTeam(source) local r,g, b = getTeamColor(team) local hex = RGBToHex (r, g, b) ouputChatBox('dead'..hex..""..getPlayerName(source), getRootElement(), 255, 255, 255, true) end addEventHandler("onClientPlayerWasted",getLocalPlayer(), gowmo)
-
no it's not try this now vehWeapons = {} function createM4Weapon() if getElementModel(source) == 432 then triggerServerEvent ( "MachineGun", localPlayer) local vX, vY, vZ = getElementPosition(source) vehWeapons[source] = createWeapon("m4", vX, vY, vZ + 1) setWeaponClipAmmo(vehWeapons[source], 500) setWeaponState(vehWeapons[source], "ready") attachElements(vehWeapons[source],source,0.7,2.4,0.7,0,0,90) setWeaponFiringRate ( vehWeapons[source], 63 ) end end addEventHandler( "onClientVehicleEnter",getRootElement(),createM4Weapon) addEventHandler("onClientKey", root, function(button,state) local veh = getPedOccupiedVehicle(localPlayer) if veh then if getElementModel(veh) == 432 then if vehWeapons[veh] then if button == "lctrl" and state == true then setWeaponState(vehWeapons[veh],"firing") else setWeaponState(vehWeapons[veh],"ready") end end end end end) function destroyCurrentVehicleWeapons() if isElement(vehWeapons[source]) then destroyElement(vehWeapons[source]) vehWeapons[source] = false end end addEventHandler("onClientVehicleExit",root, destroyCurrentVehicleWeapons) addEventHandler("onClientVehicleExplode",root, destroyCurrentVehicleWeapons)
-
debugscript
-
use lua highlight syntax please Edit try this function gowno(_,attacker) if attacker and isElement(attacker) and getElementType(attacker) == "player" and attcker ~= source then local r,g,b = getTeamColor(getPlayerTeam(source)) local hex = RGBToHex(r,g,b) outputChatBox('dead'..hex..""..getPlayerName(source), getRootElement(), 255,255,255,true) end end addEventHandler( "onPlayerWasted", getRootElement( ), gowno)
-
kill who stay under water for a long time addEventHandler("onClientPreRender", root, function() local oxygen = getPedOxygenLevel ( localPlayer ) if isElementInWater(localPlayer) then if ( tonumber(oxygen) == 0) then local health = getElementHealth(localPlayer) local new = health - 0.5 setElementHealth(localPlayer , new) end end end )
-
@Blaawee next time try to check the code before you start talking . @ SpoC^ you want a border and as i can see my code is working and you have one now .
-
Man put my code outside the client render event. Many things Wrong function renderRadar() if not radarRT1 and radarRT2 then return end dxDrawImage(70*sW, 697*sH, 236*sW, 9*sH, "sz/blips/radarbg.png", 0, 0, 0, tocolor(0, 0, 0, RBACK_ALPHA)) local px, py, pz = getElementPosition(localPlayer) local _, _, crot = getElementRotation(getCamera()) if getElementInterior(localPlayer) == 0 then local mpx, mpy = getImagePointFromWorld(px, py) local rtSX, rtSY = dxGetMaterialSize(radarRT1) local uvX, uvY = mpx-(rtSX/2), mpy-(rtSY/2) local uvSX, uvSY = rtSX, rtSY dxSetRenderTarget(radarRT2, true) dxSetBlendMode("modulate_add") ---------------------------------------------------------------------------- local vehicle = getPedOccupiedVehicle (localPlayer) if isPedInVehicle(localPlayer) then local vx,vy,vz = getElementVelocity(vehicle) velocidade = ( 1 + (vx^2 + vy^2 + vz^2)^(0.5) ) / 2 else local vx,vy,vz = getElementVelocity(localPlayer) velocidade = math.max(1 + (vx^2 + vy^2 + vz^2)^(0.5), 2)/5 end local alt = MAP_SIZE * math.min(velocidade,2) - 80 dxDrawImageSection(0, 0, rtSX, rtSY, uvX, uvY, uvSX, uvSY, MAP_PATH) ---------------------------------------------------------------------------- local aPercent = math.abs(getTickCount()%1000 - 500) / 500 for k, Rarea in ipairs( getElementsByType("radararea") ) do if isElementVisible(Rarea) then local r, g, b, a = getRadarAreaColor(Rarea) local x, y, _ = getElementPosition(Rarea) local sx, sy = getRadarAreaSize(Rarea) local rx, ry = getImagePointFromWorld(x, y) local rsx, rsy = sx * MAP_MPP, -sy * MAP_MPP if isRadarAreaFlashing(Rarea) then a = a * aPercent end dxDrawRectangle(rx-uvX, ry-uvY, rsx, rsy, tocolor(r, g, b, a)) end end dxSetRenderTarget(radarRT1, true) dxDrawImage(0, 0, rtSX, rtSY, radarRT2, crot) --Occupied Vehicle local veh = getPedOccupiedVehicle(localPlayer) if veh then local vehType = getVehicleType(veh) if vehType == "Plane" or vehType == "Helicopter" then local sx, sy = RADAR_SX + sOffset, RADAR_SY + sOffset local mx, my = sx/2, sy/2 local imgSX, imgSY = 150*sW, 80*sH dxDrawImage(mx - (imgSX/2), sOffset/2, imgSX, imgSY, "sz/blips/mask.png") local rx, ry, rz = getElementRotation(veh) imgSX, imgSY = 466*sW, 50*sH dxDrawImage(mx - (imgSX/2), my - (imgSY/2), imgSX, imgSY, "sz/blips/rotation.png", ry) end end dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) --hud health Armour --dxDrawRectangle(sW*67, sH*695, sW*241, sH*13, tocolor(0, 0, 0, 100), false) local sz1, sz2, sz3 = getHealthColor() local health = math.floor( getElementHealth( getLocalPlayer() )) if ( health <= 50) then HP_Colour = tocolor(sz1, sz2, sz3, textAlpha) HP_Alpha = tocolor(sz1, sz2, sz3, 100) else HP_Colour = tocolor(103, 188, 107, 255) HP_Alpha = tocolor(103, 188, 107, 100) end local stat = getPedStat ( getLocalPlayer(), 24 ) if stat < 1000 then dxDrawRectangle(sW*71, sH*698, sW*116, sH*7, HP_Alpha, false) --fundo dxDrawRectangle(sW*71, sH*698, sW*116/100*health, sH*7, HP_Colour, false) else dxDrawRectangle(sW*72, sH*698, sW*115, sH*7, HP_Alpha, false) --fundo dxDrawRectangle(sW*72, sH*698, sW*115/200*health, sH*7, HP_Colour, false) end if fadeIn == false then textAlpha = textAlpha - 7 elseif fadeIn == true then textAlpha = textAlpha + 7 end checkApha() local armour = getPedArmor ( getLocalPlayer() ) dxDrawRectangle(sW*190, sH*698, sW*55, sH*7, tocolor(95, 165, 206, 100), false) if armour>0 then dxDrawRectangle(sW*190, sH*698, sW*55/100*armour, sH*7, tocolor(95, 165, 206, 255), false) end local oxigenio= getPedOxygenLevel ( getLocalPlayer() ) dxDrawRectangle(sW*248, sH*698, sW*56, sH*7, tocolor(253, 219, 36, 140), false) if oxigenio < 1000 or isElementInWater (getLocalPlayer()) then dxDrawRectangle(sW*248, sH*698, sW*55, sH*7, tocolor(61, 94, 112, 255), false) dxDrawRectangle(sW*248, sH*698, sW*55/1000*oxigenio, sH*7, tocolor(169, 222, 246, 255), false) end --Players for k, player in ipairs( getElementsByType("player") ) do if player ~= localPlayer then local x, y, z = getElementPosition(player) local r, g, b = getPlayerNametagColor(player) local rx, ry = getRadarFromWorldPosition(x, y) local icon = "square" if z < pz-2 then icon = "down" elseif z > pz+2 then icon = "up" end dxDrawImage(floor(rx - PLAYERS_SIZE/2), floor(ry - PLAYERS_SIZE/2), floor(PLAYERS_SIZE), floor(PLAYERS_SIZE), "sz/blips/"..icon..".png", 0, 0, 0, tocolor(r, g, b, PLAYERS_ALPHA)) end end end weapon = getPedWeapon ( getLocalPlayer() ) local t1, t2, t3 = getElementPosition(getLocalPlayer()) local r1, r2, r3 = getElementRotation(getLocalPlayer()) local Test = math.floor((t3*001)) if not ( isPedInVehicle(localPlayer) ) then if ( weapon == 46 ) then dxDrawImage(sW*70, sH*610, 235, 30, "sz/blips/rotation.png", r2, tocolor(255, 255, 255 , 255)) dxDrawImage(sW*113, sH*560, 150, 80, "sz/blips/mask.png", 0,0,0, tocolor(255, 255, 255 , 255)) dxDrawBorderedText(Test.."Mts",sW*150, sH*680, sW*605/2, sH*30/2,tocolor(255,255,255,255),1.0,"default-bold","right","top",false,false,false) end end end addEventHandler("onClientRender", root, renderRadar) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end
-
many things wrong sorry i can't fix them all now anyways try this one function renderRadar() if not radarRT1 and radarRT2 then return end dxDrawImage(70*sW, 697*sH, 236*sW, 9*sH, "sz/blips/radarbg.png", 0, 0, 0, tocolor(0, 0, 0, RBACK_ALPHA)) dxDrawImageBorder (70*sW, 697*sH, 236*sW, 9*sH, tocolor(0,0,0,255) ,2,false) local px, py, pz = getElementPosition(localPlayer) local _, _, crot = getElementRotation(getCamera()) if getElementInterior(localPlayer) == 0 then local mpx, mpy = getImagePointFromWorld(px, py) local rtSX, rtSY = dxGetMaterialSize(radarRT1) local uvX, uvY = mpx-(rtSX/2), mpy-(rtSY/2) local uvSX, uvSY = rtSX, rtSY dxSetRenderTarget(radarRT2, true) dxSetBlendMode("modulate_add") local aPercent = math.abs(getTickCount()%1000 - 500) / 500 for k, Rarea in ipairs( getElementsByType("radararea") ) do if isElementVisible(Rarea) then local r, g, b, a = getRadarAreaColor(Rarea) local x, y, _ = getElementPosition(Rarea) local sx, sy = getRadarAreaSize(Rarea) local rx, ry = getImagePointFromWorld(x, y) local rsx, rsy = sx * MAP_MPP, -sy * MAP_MPP if isRadarAreaFlashing(Rarea) then a = a * aPercent end dxDrawRectangle(rx-uvX, ry-uvY, rsx, rsy, tocolor(r, g, b, a)) end end dxSetRenderTarget(radarRT1, true) dxDrawImage(0, 0, rtSX, rtSY, radarRT2, crot) dxSetBlendMode("blend") dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) end end addEventHandler ( "onClientRender", root, renderRadar ) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end
-
You need to download Bone_attch resource as xXMADEXx said then use this exports.bone_attach:attachElementToBone(object,player,bone,x,y,z,xr,xy,xz)
-
post full code here i'm pretty sure you did something wrong
-
it's dxDrawImageBorder() not DxDrawImageBorder() copy and past my code
-
try this : -- Your code dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end
-
As i can see you need to to create a border with lines right so try to use this and tell me the result: function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end
-
Sorry i don't undrestand your english, anyways try to use sth like this function close() if source == ""buttonName"" then -- Edit the button name guiSetVisible(GUIEditor.window[1], false) showCursor ( false ) end end addEventHandler(onClientGUIClik,guiRoot,close)
-
Try this one next time try to post debugscript. local xp, yp, zp = getElementPosition(newbiePosition) local coords = getScreenFromWorldPosition(xp, yp, zp) local length = dxGetTextWidth(newbieText, 1, "default-bold") if coords[1] and coords[2] then dxDrawRectangle(coords[1] - length / 2 - screenWidth * 0.01, coords[2], screenWidth * 0.02 + length, screenHeight * 0.1, tocolor(33, 33, 33, 100)) dxDrawingColorText(newbieHead, coords[1] - length / 2 - screenWidth * 0.01, coords[2], coords[1] + length / 2 + screenWidth * 0.01, coords[2] + screenHeight * 0.03, tocolor(22, 255, 22, 120), 0.5, 1.1, "default-bold", "center", "center") dxDrawingColorText(newbieText, coords[1] - length / 2 - screenWidth * 0.01, coords[2] + screenHeight * 0.03, coords[1] + length / 2 + screenWidth * 0.01, coords[2] + screenHeight * 0.07, tocolor(255, 255, 255, 120), 0.5, 1, "default-bold", "center", "center") end
-
In this code you are just freezing vehicles try this function freezeEm ( player ) if not( isAdmin ( player ) ) then return end for _, p in pairs (getAlivePlayers ()) do if frozen then setElementFrozen ( p, false ) frozen = false text = "unfreezed" r, g, b = 0, 255, 0 else setElementFrozen ( p, true ) frozen = true text = "freezed" r, g, b = 255, 0, 0 end end outputChatBox ( "* All players has been " .. text .. " by " .. getPlayerName ( player ) .. ".", root,r,g,b, true ); end
-
Try this : local aclTable = {"Admin", "SuperModerator", "Moderator"} local frozen = false function isAdmin(thePlayer) local pAcc = getPlayerAccount(thePlayer) if isGuestAccount(pAcc) then return false end for _, anACL in ipairs(aclTable) do if isObjectInACLGroup('user.'..getAccountName(pAcc), aclGetGroup(anACL)) then return true end end return false end function freezeEm ( player ) if not( isAdmin ( player ) ) then return end for _, p in pairs (getAlivePlayers ()) do if ( isPedInVehicle ( p ) ) then local veh = getPedOccupiedVehicle ( p ) if frozen then setElementFrozen ( veh, false ) frozen = false text = "unfreezed" color = { 0, 255, 0 } else setElementFrozen ( veh, true ) frozen = true text = "freezed" color = { 255, 0, 0 } end end end outputChatBox ( "* All players has been " .. text .. " by " .. getPlayerName ( player ) .. ".", root, unpack ( color ), true ); end function binFreezKey( thePlayer ) bindKey( thePlayer, "F5", "down", freezeEm) end function startBind () binFreezKey(source) end function BindForAll () for index, player in pairs(getElementsByType("player")) do binFreezKey(player) end end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), BindForAll ) addEventHandler("onPlayerJoin",getRootElement(), startBind)
-
As far as i know it's the same.
-
add guiSetVisible onClientResourceStart guiSetVisible(GUIEditor.window[1], false) here addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(380, 239, 884, 470, "Dj Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(14, 433, 103, 27, "Zamknij", false, GUIEditor.window[1]) GUIEditor.memo[1] = guiCreateMemo(20, 50, 678, 31, "", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(27, 30, 162, 15, "Wpisz link muzyki z YouTube:", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(704, 51, 67, 30, "Play", false, GUIEditor.window[1]) GUIEditor.button[5] = guiCreateButton(-76, 78, 55, 48, "", false, GUIEditor.button[4]) GUIEditor.button[6] = guiCreateButton(781, 50, 71, 31, "Stop", false, GUIEditor.window[1]) GUIEditor.memo[2] = guiCreateMemo(570, 127, 292, 317, "", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(573, 106, 194, 15, "Zapisz linki z YouTube", false, GUIEditor.window[1]) GUIEditor.memo[3] = guiCreateMemo(20, 131, 519, 34, "", false, GUIEditor.window[1]) GUIEditor.label[3] = guiCreateLabel(28, 112, 251, 15, "Wpisz tekst, który będzie pokazany na ścianie:", false, GUIEditor.window[1]) GUIEditor.button[7] = guiCreateButton(194, 179, 163, 29, "Pokaż", false, GUIEditor.window[1]) GUIEditor.button[8] = guiCreateButton(36, 257, 186, 37, "Włącz dym", false, GUIEditor.window[1]) GUIEditor.button[9] = guiCreateButton(232, 257, 186, 37, "Wyłącz dym", false, GUIEditor.window[1]) end )