-
Posts
1,491 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Walid
-
You can't use executeCommandHandler in client side because the command is in server side so you need to use triggerServerEvent()
-
i already gave you one
-
You need this ;Click Me! About the warning this is how you can fix it function cigarette(thePlayer) if ( not isElement ( cigarettes [ thePlayer ] ) ) then local x, y, z = getElementPosition ( thePlayer ) cigarettes [ thePlayer ] = createObject ( 1485, 0, 0, 0 ) exports [ "bone_attach" ]:attachElementToBone ( cigarettes [ thePlayer ], thePlayer,1, 0.07, 0.02, 0.07, 0, 50, 118 ) else outputChatBox ( "Вы еще не докурили!", thePlayer,255,0,0 ) end setTimer(function(player) if isElement(cigarettes [player]) then destroyElement(cigarettes [player]) end end,timer,1,thePlayer) end
-
use guiGetScreenSize() -- Example local sxW,syW = guiGetScreenSize() dxDrawText("text", sxW*(posX/1366),syW*(posY/768),sxW*(1244.0/1366),syW*(750.0/768), tocolor(255,0,0,255),2, "default-bold")
-
Try this untested function findPictureAngle(picX,picY) local cursor = isCursorShowing () if cursor then local screenx, screeny, worldx, worldy, worldz = getCursorPosition() local imageRot = math.atan2 (( worldx - screenx ), (worldy - screeny)) local X = picX - screenx local Y = picY - screeny local Z = math.atan2(X,Y) local angle = Z - imageRot return math.deg(angle) end return false end
-
-- First question addEventHandler ( "onPlayerSpawn", root, function() local playerTeam = getPlayerTeam(source) if (playerTeam) then if getTeamName(playerTeam) == "Army" then setElementHealth (source,15) end end end) -- Seconds question local weapons = {[30] = true,[34] = true} function whenPlayerHitPickUp ( thePlayer ) local pickupType = getPickupType ( source ) if (pickupType == 2) then local weapon = getPickupWeapon ( source ) if weapons[weapon] then cancelEvent() end end end addEventHandler ( "onPickupHit", getRootElement(), whenPlayerHitPickUp ) Note: next time try to do it by yourself before you start looking for help
-
All what you need is isElementOnScreen() getElementPosition() getPedBonePosition() getDistanceBetweenPoints3D() getScreenFromWorldPosition() isLineOfSightClear() dxGetTextWidth() dxDrawText()
-
You don't need to use setElementData Example addEventHandler ( "onPlayerSpawn",root, function() setPedStat ( source, 24, 1000 ) setElementHealth ( source, 200 ) end )
-
Try this one function TacticsDamage ( attacker, weapon, bodypart ) local playerTeam = getPlayerTeam(source) if (playerTeam) then if getTeamName(playerTeam) == "tactics" then if (bodypart == 5) then local health = getElementHealth (source) - 60 setElementHealth (source,tonumber(health)) else cancelEvent() end end end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), TacticsDamage )
-
try this one function cpremoveCmd(plr, cmd) xml = xmlLoadFile ("clans.xml") for index, childNode in pairs ( xmlNodeGetChildren (xml) ) do xmlNodeSetAttribute(childNode, "Points", 0) outputChatBox("Done",plr,0,255,0) break; end xmlUnloadFile(xml) end addCommandHandler("cpremove", cpremoveCmd)
-
try this onClientPlayerSpawn function removeNoDm ( ) if getElementData(localPlayer, "invincible") then setElementData(localPlayer,"invincible",false) end end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), removeNoDm )
-
Simply because "myMarker2" it's a local variable. try this addEventHandler("onClientResourceStart",resourceRoot, function() Goods_Job_Window = guiCreateWindow(344, 196, 362, 385, "Goods Job", false) guiWindowSetSizable(Goods_Job_Window, false) guiSetVisible(Goods_Job_Window, false) guiSetAlpha(Goods_Job_Window, 0.86) Goods_Job_Botton1 = guiCreateButton(44, 52, 100, 98, "", false, Goods_Job_Window) Goods_Job_Image1 = guiCreateStaticImage(44, 52, 100, 98, ":guieditor/images/image1.png", false, Goods_Job_Window) Goods_Job_Close_Window = guiCreateButton(9, 333, 344, 42, "X", false, Goods_Job_Window) ProgressBar1 = guiCreateProgressBar(271, 301, 480, 65, false) guiSetVisible(ProgressBar1, false) ProgressBar2 = guiCreateProgressBar(271, 301, 480, 65, false) guiSetVisible(ProgressBar2, false) addEventHandler("onClientGUIClick",Goods_Job_Close_Window,on_MyGoodsJob_Click,false) addEventHandler("onClientGUIClick",Goods_Job_Botton1, on_MyGoodsJob_Porgess) end ) local myMarker = createMarker(2492.75830, -1667.61365, 12.34375, 'cylinder', 2.0, 255, 0, 0, 150) function MarkerHit() if source == myMarker then guiSetVisible(Goods_Job_Window, true) showCursor(true) end end addEventHandler ( "onClientMarkerHit",myMarker, MarkerHit ) function on_MyGoodsJob_Click() if source == Goods_Job_Close_Window then guiSetVisible(Goods_Job_Window, false) showCursor(false) end end function on_MyGoodsJob_Porgess() if source == Goods_Job_Botton1 then guiSetVisible(ProgressBar1, true) guiSetVisible(Goods_Job_Window, false) showCursor(true) setTimer(function () guiProgressBarSetProgress(ProgressBar1, 20) outputChatBox("Please Wait 5 Second",255,255,0) end,1000,1, true) setTimer(function () guiProgressBarSetProgress(ProgressBar1, 40) outputChatBox("Please Wait 4 Second",255,255,0) end,2000,1, true) setTimer(function () guiProgressBarSetProgress(ProgressBar1, 60) outputChatBox("Please Wait 3 Second",255,255,0) end,3000,1, true) setTimer(function () guiProgressBarSetProgress(ProgressBar1, 80) outputChatBox("Please Wait 2 Second",255,255,0) end,4000,1, true) setTimer(function () guiProgressBarSetProgress(ProgressBar1, 100) outputChatBox("Please Wait 1 Second",255,255,0) end,5000,1, true) setTimer(function () myMarker2 = createMarker(2482.75830, -1667.61365, 12.34375, 'cylinder', 2.0, 255, 0, 0, 150) guiSetVisible(ProgressBar1, false) showCursor(false) createBlip ( 2482.75830, -1667.61365, 12.34375, 41) outputChatBox("Go to Red Blip",255,255,0) addEventHandler ( "onClientMarkerHit",myMarker2, MarkerHit2) end,6000,1, true) end end function MarkerHit2() if source == myMarker2 then guiSetVisible(ProgressBar2, true) showCursor(true) setTimer(function () guiProgressBarSetProgress(ProgressBar2, 20) outputChatBox("Please Wait 10 Second",255,255,0) end,2000,1, true) setTimer(function () guiProgressBarSetProgress(ProgressBar2, 40) outputChatBox("Please Wait 8 Second",255,255,0) end,4000,1, true) setTimer(function () guiProgressBarSetProgress(ProgressBar2, 60) outputChatBox("Please Wait 6 Second",255,255,0) end,6000,1, true) setTimer(function () guiProgressBarSetProgress(ProgressBar2, 80) outputChatBox("Please Wait 4 Second",255,255,0) end,8000,1, true) setTimer(function () guiProgressBarSetProgress(ProgressBar2, 100) outputChatBox("Please Wait 2 Second",255,255,0) end,10000,1, true) setTimer(function () local Player = getLocalPlayer() guiSetVisible(ProgressBar2, false) showCursor(false) setElementData(Player, "Money", (getElementData(Player, "Money") or 0) + 2000) outputChatBox("You Get 2000$",255,255,0) end,12000,1, true) destroyElement(myMarker2) end end Fixed full code.
-
You want to disable the radio, if yes try this addEventHandler("onClientPlayerRadioSwitch", root, function() local vehicle = getPedOccupiedVehicle(localPlayer) if (vehicle) then if getRadioChannel() ~= 0 then setRadioChannel(0) cancelEvent() end end end)
-
lol you need to add the marker coordination x , y , z local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 255, 0, 170 )
-
check this he have the same problem as you , and i already helped him. Click Me!
-
Try this one local theMarker = createMarker(1176.19, -1339.09, 13.985, "cylinder", 3, 0, 255, 0) local Timer = {} addEventHandler("onMarkerHit", theMarker, function(player) if getElementType(player) == "player" then outputChatBox("Type /med to buy 25% of Health", player, 255, 255, 255) end end) addCommandHandler("med", function(player) if getPlayerMoney(player) >= 1500 then if (isTimer(Timer[player])) then outputChatBox("You can only use med kit once every 4 seconds",player, 255, 0, 0) return end local newHealth = getElementHealth(player) + 25 setElementHealth(player, newHealth) takePlayerMoney(player, 1500) outputChatBox("You have bought 25% health for $1,500", player, 0, 255, 0) Timer[player] = setTimer(function() end, 2000, 1 ) -- 2 seconds end end)
-
Simply because marker it's not defined in your code. this how you can fix it . local screenX, screenY = guiGetScreenSize () local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 255, 0, 170 ) function leaderText() local xm,ym,zm = getElementPosition(marker) local x,y = getScreenFromWorldPosition(xm,ym,zm+0.2) local camX,camY,camZ = getCameraMatrix() if (x and y and getDistanceBetweenPoints3D(camX, camY, camZ, xm,ym,zm) <= 20) then dxDrawText ("Hello", x,y,x,y, tocolor (255,0, 0, 255) , ( screenX / 1440 ) * 2 , "default-bold" , "center" , "center" , false , true , false ) end end addEventHandler ("onClientPreRender", root,leaderText)
-
lol na7ki be chenwa chouf l'example tawa tefhem just 7ot les resources mte3ek lkol fel mtaserver.conf