Jump to content

redditing

Members
  • Posts

    111
  • Joined

  • Last visited

Everything posted by redditing

  1. Okay, I know where this problem comes from, because I gave the eventhandler when when I click the "i" button on the keyboard, he checked when this Event was firing up and then he didn't, but thank you for helping me
  2. i upload how to look like and upload my code again here is there link to see how it look like https://imgur.com/a/ZzGGRcX there is a code function tablecontains(tabl, element) for index, value in pairs(tabl) do if value == element then return index end end return false end function tablecheck(tabl, element) for index, value in pairs(tabl) do if value == element then return true end end return false end button1 = createButton(etc) button2 = createButton(etc) money = 100 EQ = {} function buttonpress1() if money>=2 then outputChatBox("Here, there is ITEM1", 255, 255, 0) money = money-2 if not tablecontains(EQ, "P1") then table.insert(EQ, "P1") end if tablecheck(EQ, "P1") then local variable = tablecontains(EQ, "P1") if variable==1 then AdxItem1 = 255 SLOT1 = SLOT1 + 1 elseif variable==2 then BdxItem1 = 255 SLOT2 = SLOT2 + 1 elseif variable==3 then CdxItem1 = 255 SLOT3 = SLOT3 + 1 elseif variable==4 then DdxItem1 = 255 SLOT4 = SLOT4 + 1 elseif variable==5 then EdxItem1 = 255 SLOT5 = SLOT5 + 1 elseif variable==6 then FdxItem1 = 255 SLOT6 = SLOT6 + 1 elseif variable==7 then GdxItem1 = 255 SLOT7 = SLOT7 + 1 elseif variable==8 then HdxItem1 = 255 SLOT8 = SLOT8 + 1 end end else outputChatBox("u dont have money", 255, 0, 0) end end addEventHandler("onClientGUIClick", button1, buttonpress1) function buttonpress2() if money>=4 then outputChatBox("Here, there is ITEM2", 255, 255, 0) money = money-4 if not tablecontains(EQ, "P2") then table.insert(EQ, "P2") end if tablecheck(EQ, "P2") then local variable = tablecontains(EQ, "P2") if variable==1 then AdxItem1 = 255 SLOT1 = SLOT1 + 1 elseif variable==2 then BdxItem1 = 255 SLOT2 = SLOT2 + 1 elseif variable==3 then CdxItem1 = 255 SLOT3 = SLOT3 + 1 elseif variable==4 then DdxItem1 = 255 SLOT4 = SLOT4 + 1 elseif variable==5 then EdxItem1 = 255 SLOT5 = SLOT5 + 1 elseif variable==6 then FdxItem1 = 255 SLOT6 = SLOT6 + 1 elseif variable==7 then GdxItem1 = 255 SLOT7 = SLOT7 + 1 elseif variable==8 then HdxItem1 = 255 SLOT8 = SLOT8 + 1 end end else outputChatBox("u dont have money", 255, 0, 0) end end addEventHandler("onClientGUIClick", button2, buttonpress2)
  3. table = {} function table.contains(table, element) for _, value in pairs(table) do if value == element then return true end end return false end function tablefind(tab,el) for index, value in pairs(tab) do if value == el then return index end end end function OnClientGuiButton() if not table.contains(BedwarsEQ, "P1") then table.insert(table, "P1") -- Insert to a table string "P1" (Player1) end if tablefind(table, "P1")==1 then -- check index, if is Item in index(1) then == true AdxItem1 = 255 -- dxDrawImage, drawing image to effect SLOT1 = SLOT1 + 1 -- type how many items is in P1 end if tablefind(table, "P1")==2 then -- if is Item in index(1) then check "if is Item in Index(2)" == true BdxItem1 = 255 --second dxDrawImage, drawing image to effect SLOT2 = SLOT2 + 1 --type how many items is in P1 end end addEvenetHandler("onClientGUIClick", button, OnClientGuiButton I will explain the problem. The problem is that when I press the button that gives me to the table "P1", it checks in which index it is. There is a problem that if I click on another button that gives me "P2", it doesn't prove that "P2" is in the table. Debugscript writes to me that the wrong first argument is given in the tableFind function, and that's strange because I checked twice and gave the right one. What's wrong with that?
  4. redditing

    Table

    I wanted to ask if there is a way to check what index the value in the table is for example, t = {} table.insert(t,"Hello") table.insert(t,"HELLO") table.insert(t,"HI") if index==1 and value=="HI" then -- false --do something elseif index==0 and value=="HELLO" then --false --do something elseif index==2 and value=="HI" then --true --do something else --etc. --do something end --If someone does not distinguish the index from the value then the index is for example [0,1,2,3 ...] and the value is an element for example print(t[1]) -------------> 'HELLO'
  5. I would like to ask where I can find a guide on: createElement, ElementData, Shaders etc. I need it because soon I will be making radar and inventory system. It would be nice if you would share your knowledge on the things I gave
  6. Ok i didnt see comunication about peds in client side, thank u
  7. setPedStat(getLocalPlayer(), 24, 650) setPedMaxHealth(getLocalPlayer()) These commands do not want to work, do not show any errors. But unfortunately it doesn't set my health at around 125 points, it just sets me to 100 HP Maybe bug? pls help
  8. Hello, could someone tell me what commands I will need to make my crosshair (I mean this crosshair while holding AK-47, M4, SMG etc.)
  9. Not working Okay, I know why, I kill him right away because Ped has 50 HP and he was dying right away, but thanks for the help
  10. function playerDamage_text ( attacker, weapon, bodypart, loss) if ( bodypart == 9 and attacker and attacker ~= source ) then loss = 50 setElementHealth(chuj, getElementHealth(chuj)-50) if getPlayerArmor(chuj)>0 then setPedArmor(chuj, getPlayerArmor(chuj)-50) end end end addEventHandler ( "onClientPedDamage", root, playerDamage_text ) So the matter is simple, when I shoot in the head of the NPC then he dies immediately, but I want that if I shoot him in the head it takes 50% of his hp, I don't know what's wrong here anyone will help?
  11. redditing

    Inventory

    Hi, I would like to make an inventory system, could anyone give me commands to create this work? and I don't mean ready scripts or anything because I want to do it myself, I just don't know where to start here. I would like to ask for all the commands that I will definitely need.
  12. Hello, I would like to know how to set npc rotation towards the player (To NPC just look at the player) preferably using the command "getElementPosition" (client resource)
  13. setPlayerHudComponentVisible("radar", false) local screenW, screenH = guiGetScreenSize() local w = 300 local s = 400 local screenX, screenY = guiGetScreenSize() local minimap = dxCreateRenderTarget(s, s,true) addEventHandler("onClientRender", root, function() local x, y = getElementPosition(getLocalPlayer()) local rot = getElementRotation(getCamera()) dxDrawRectangle(screenW * 0.0078, screenH * 0.7398, screenW * 0.1521, screenH * 0.2472, tocolor(255, 0, 0, 255), false) masked = dxDrawRectangle(screenW * 0.0099, screenH * 0.7435, screenW * 0.1479, screenH * 0.2398, tocolor(0, 0, 0, 255), false) dxDrawImageSection(screenW * 0.0099, screenH * 0.7435, screenW * 0.1479, screenH * 0.2398, x, y, 256.0, 256.0, "HUD/RADAR/mapa.png", rot) local mapa = dxCreateRenderTarget(s, s, true) dxDrawImage(0, screenY - w, s, w, minimap) dxSetRenderTarget(minimap, false) end ) Okay I made this code but I have no idea what's next, will you help?
  14. I would like to know what commands I should use to create a custom radar
  15. function healthCar() HEALTHcaringXD = tonumber(getElementHealth(getPedOccupiedVehicle(getLocalPlayer()))) IknowU = tostring(getVehicleName(getPedOccupiedVehicle(getLocalPlayer()))) dxDrawText(IknowU.." : "..math.floor(HEALTHcaringXD/10) , 416, 267, 684, 329, tocolor(255, 0, 0, 255), 2.00, "default", "center", "center", false, false, false, false, false) end function entering() addEventHandler("onClientRender", root, healthCar) end function exiting() removeEventHandler("onClientRender", root, healthCar) end addEventHandler("onClientVehicleEnter", root, entering) addEventHandler("onClientVehicleExit", root, exiting) I do not know why but I have errors that the variables are true / false (boolean) despite this script works for me but it annoys me that I debugscript these spam errors. Is there anything to fix these errors? ERROR line 2,3,4 has boolean
  16. redditing

    Building

    function building(key, state) local x, y, z = getElementPosition(getLocalPlayer()) local build = createObject(3374, x, y, z, 0, 0, 0) setElementAlpha(build, 150) attachElements(build, localPlayer , 0, 3, -1, 0, 0, 0) if key=="b" and state=="up" then if isElementAttached(build) then setElementAlpha(build, 255) detachElements(build, getLocalPlayer()) end end end bindKey("b", "both", building) When I release B, he puts a block of hay for me, but I don't lose the stick which stuck to me, PLS HELP
  17. function building(source, command, detached) xP, yP, zP = getElementPosition(source) local build = createObject(3374, xP, yP, zP) attachElements(build, source, 0, 3, 1) setElementAlpha(build, 150) if detached=="detach" then setElementAlpha(build, 255) if isElement(build) then detachElement(build) end end end addCommandHandler("setBuild", building) When I type the command, a block of hay appears in front of me, but when I type the command with "detach" then I get an error. Can anything be done about it?
  18. I created a "cylinder" marker that allows me to open a window after entering it (dxDrawWindow) and what to do on it if this window closes for me, after re-entering Marker I get an error that such an event exists
  19. How to remove dxDrawWindow with, removeEventHandler?, I would like to turn on the window several times.
  20. I can turn on dxDrawWindow without EventHandler "onClientRender"?
×
×
  • Create New...