Jump to content

Z4Zy

Members
  • Posts

    215
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Z4Zy

  1. Hello dear ! Following function does not working with some reason that I can't investigate. It outputs "playing" but there's no sound generating ! addCommandHandler("play", function (command,number1,number2) if number1 and number2 and tonumber(number1) <= 44 then outputChatBox("playing") setWorldSoundEnabled(tonumber(number1),tonumber(number2),true) end end ) How to fix this ??
  2. I guess ; setPedControlState(thePlayer, "enter_exit", true) for local players.
  3. Sorry, but I didn't got your question ! For a example ?
  4. Z4Zy

    Effect name

    You want to create effects like shown on images ?
  5. Z4Zy

    [HelpP]

    No, that function isn't true since it doesn't fix errors. And you should define whom is 'player' variable. function test ( ) if getElementData(player, "Job") == "CIA" then if getElementData(player, "Clan") == "BBY" then outputChatBox("You can't get this job ",player) end end end
  6. What is between <voice_samplerate> tag of MTASERVER.conf file of your server ?
  7. --Vehicle Infos function vehicleStatus() local veh = getPedOccupiedVehicle (getLocalPlayer()) if veh then local maxfuel = getElementData(veh,"maxfuel") local fuel = getElementData(getElementData(veh,"parent"),"fuel") local needengine = (getElementData(veh,"needengines") or 1) local needtires = (getElementData(veh,"needtires") or 4) local needparts = (getElementData(veh,"needparts") or 1) local engine = getElementData(getElementData(veh,"parent"),"Engine_inVehicle") or 0 local tires = getElementData(getElementData(veh,"parent"),"Tire_inVehicle") or 0 local parts = getElementData(getElementData(veh,"parent"),"Parts_inVehicle") or 0 local offset = dxGetFontHeight(1.02,"default-bold") local w = dxGetTextWidth(engine.."/"..needengine.." Engine",1.02,"default-bold") if engine == needengine then r,g,b = 0,255,0 else r,g,b = 255,0,0 end dxDrawText (engine.."/"..needengine.." Engine" ,screenWidth*0.5-w/2 , screenHeight*0,screenWidth*0.5-w/2 , screenHeight*0,tocolor ( r,g,b, 220 ), 1.02, "default-bold" ) local w = dxGetTextWidth(tires.."/"..needtires.." Tires",1.02,"default-bold") if tires == needtires then r,g,b = 0,255,0 else r,g,b = 255,0,0 end dxDrawText (tires.."/"..needtires.." Tires",screenWidth*0.5-w/2 , screenHeight*0+offset,screenWidth*0.5-w/2 , screenHeight*0+offset,tocolor ( r,g,b, 220 ), 1.02, "default-bold" ) local w = dxGetTextWidth(parts.."/"..needparts.." Tank Parts",1.02,"default-bold") if parts == needparts then r,g,b = 0,255,0 else r,g,b = 255,0,0 end dxDrawText (parts.."/"..needparts.." Tank Parts" ,screenWidth*0.5-w/2 , screenHeight*0+offset*2,screenWidth*0.5-w/2 , screenHeight*0+offset*2,tocolor ( r,g,b, 220 ), 1.02, "default-bold" ) local w = dxGetTextWidth("Fuel:"..math.floor(fuel).."/90"..maxfuel,1.02,"default-bold") if fuel == maxfuel then r,g,b = 0,255,0 elseif fuel < maxfuel/10 then r,g,b = 255,0,0 elseif fuel < maxfuel/4 then r,g,b = 255,50,0 elseif fuel < maxfuel/3 then r,g,b = 200,100,0 elseif fuel < maxfuel/2 then r,g,b = 125,200,0 elseif fuel < maxfuel/1.5 then r,g,b = 50,200,0 end dxDrawText ("Fuel:"..math.floor(fuel).."/"..maxfuel,screenWidth*0.5-w/2 , screenHeight*0+offset*2,screenWidth*0.5-w/2 , screenHeight*0+offset*2,tocolor ( r,g,b, 220 ), 1.02, "default-bold" ) end end addEventHandler("onClientRender",root,vehicleStatus)
  8. Z4Zy

    Fix XML

    Hello Everybody ! Please help me to fix below script with XML file. There's a XML file called 'codes.xml'. Inside of that XML file looks like below. <pass characters="1234" allowed="true" /> <pass characters="5678" allowed="true" /> <pass characters="9012" allowed="true" /> Characters shown in above XML is used as a security key for open a certain door. Each character set can be used only once. There's a LUA script which is not completed yet can be seen below. function open(player, command, code) if code then --- addCommandHandler("pass",open) Well. If any player command as /pass 5678 , then the door will be open as security code is inserted in the previous XML file. But I need your help to make this work. * When a player command, how to check that the security code is inserted in XML file ? * When the security code is right, how to change corresponding allowed node to false ?
  9. Hello ! I have a problem on form that is related to 'Insert Existing Attachment' option. As you may know there is a button called 'Insert Existing Attachment' on every replying spaces and under that button, there are 02 options as 'insert image from URL' as well as 'Insert Existing Attachment'. When click on 'Insert Existing Attachment' a windows will display with 'You do not have any existing attachments' with 02 unusable buttons. So, how to add attachments to display in 'Insert Existing Attachment' window ?
  10. I would like to add a question to @gujuk2's reply. If we made a resource that @gujuk2 said, How can we test this resource on local server ?
  11. Remove the bind and it's functions. Then F4 will unable to open GUI.
  12. Thank you @IIYAMA ! According to that event try below code. Client Side :- addEventHandler("onClientExplosion",root, function (x,y,z,type) if type == 2 or type == 3 then triggerServerEvent("hydra.onExplosion",resourceRoot,x,y,z) end end ) Server Side :- addEvent("hydra.onExplosion",true) addEventHandler("hydra.onExplosion",root, function (x,y,z) createExplosion(x,y,z,10) createExplosion(x,y,z,10) createExplosion(x,y,z,10) end ) I do not know weather hydra explosion is '2' or '3'. Find it by yourself @Krex.
  13. Hi @Quenix ! You are using 'absolute' method to take the positions of drawing DX texts. Use 'relative' method instead. It'll fix your problem. Don't know what is known as 'Relative' and 'Absolute' ? Visit here :- Relative and Absolute
  14. I made a fixed resource zip for you. Check that out. And note that there are no .png images of shop items. Also, in server side code, you have not added all shop stuff's amount to "0" when player login. Thing like 'tent' are missing. add them, else they can't buy. Click Here to redirect to the resource zip download page.
  15. Hi @mucuk6547 ! In line 4 of your client side code, you should supply a string to the argument 2 of 'engineLoadIFP'. Replace 'selam' in there with 'customBlockName'. And your command function should look like below. function setanimation( command, askeriselamani ) -- check if IFP file has loaded if IFP then -- now play our custom animation setPedAnimation( localPlayer, customBlockName, askeriselamani ) end end addCommandHandler( "selam", setanimation )
  16. Well, it's like this. Requirements :- good electricity. Time. Hot coffee cup. Method :- Click on the objects button on map editor. Then select all objects from the dropdown list on top of the window. Then put your one finger on down arrow. And eyes on monitor. Click on the uppermost object of the objects list. Then press downarrow since you find your object. If you got any unhappy, drink some coffee. Now do it again and again until you reach the target. GOOD LUCK !!
  17. You are finding an ID of an object that is in default GTA world. So, first remove the world object with world object remover button. Then click on current elements button. There you can see removed object. double click on it. Then you can find the ID of the object in showing window under model memo.
  18. Hi @Krex ! I don't know 100% working method. But I give you a little support regarding this. Server Side :- addEventHandler("onPlayerDamage",root, function (_,type) if type == 19 then local x,y,z = getElementPosition(source) createExplosion(x,y,z,10) createExplosion(x,y,z,10) createExplosion(x,y,z,10) end end ) This is my little effort results. When a player hit a missile, x3 explosion create. But if missile explode near the player. Our custom explosions done on the player . examine the code and build your own. Good Luck !
  19. Great to hear that their's an update ! Good job + keep it up dude ! ------------------------------------------------------------------ Then why we can't see any built-in lua files in MTA directory
  20. Hello @Tony Brand ! I'm not well known on databases of MTA server. I'm here to answer your last question. According to my knowledge, I thought it can be happen. I can give you a suggestion regarding this. That is; you should use 'setTimer' function on some of player's data changed. Meanwhile, as you say, if player change his money continuously, server had a many load to do. So, you should use a timer. When player change his money, timer run and about 6/7 seconds after, server executes the database function to save player's money. Since database save function run on 6/7 seconds interval, player can continuously change his data on that time period. Then server will save current money one time on database. So I think this way is efficient.
  21. Z4Zy

    Immortal Peds 0_0

    I stopped my modified resources and then started the local server with built-in resources. If I create 10 peds, I can't even kill a single ped with a gun. [ knife will do stealth kill I think ] -------------------------------------------------------------------------------------------------------------------------------------------------------------- I saw that bug. But I don't try to set health of any ped. Their health doesn't change after spawn. I tried this with built-in resources of MTA local server.
  22. You are almost correct. Try some modifications if you want. Client Side :- addEvent("openWindow1",true) function Windows() if guiGetVisible(SHOP.panel[1]) ~= true then setElementData(localPlayer,"shop.viewing",1) guiSetVisible(SHOP.window[1],true) showCursor(true) end end addEventHandler("openWindow1", getRootElement(), Windows) Server Side :- local marker1 = createMarker ( 177.13320922852, 2818.298828125, 68.174095153809, "cylinder", 1.5, 30, 212, 5 ) function HitMark(hitPlayer) triggerClientEvent (hitPlayer,"openWindow1",resourceRoot) end addEventHandler("onMarkerHit", marker1, HitMark) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Try below. Client Side :- local items = { --items,cena(K.B.K Points) porsion1List = { {"M1911",50}, {"PDW",150}, {"Winchester 1866",150}, {"AK-107",300}, {"Lee Enfield",400}, {"M4A1 Holo",300}, {"MK 48 Mod 0",450}, {"CZ550",300}, {"DMR",400} }, porsion2List = { {"M1911 Mag",50}, {"PDW Mag",100}, {"1866 Slug",125}, {"AK-107 Mag",100}, {"M4A1 Holo Mag",50}, {"MK 48 Mod 0 Mag",200}, {"Lee Enfield Mag",70}, {"CZ550 Mag",50}, {"DMR Mag",25}, {"Water Bottle",15}, {"Burger",15} }, porsion3List = { {"Tire",75}, {"Engine",125}, {"Tank Parts",50} }, porsion4List = { {"Medic Kit",50}, {"Painkiller",10}, {"Morphine",10}, {"Bandage",5} }, porsion5List = { {"Camouflage Clothing",100}, {"Army Clothing",150}, {"Ghost Clothing",200}, {"K.B.K Backpack",150}, {"Ghillie Suit",200}, {"Civilian Clothing",30}, {"GPS",15}, {"Tent",60}, {"Map",15}, {"Toolbox",25} } } SHOP = { button = {}, window = {}, label = {}, tabpanel = {}, tab = {}, panel = {} } addEventHandler("onClientResourceStart", resourceRoot, function () SHOP.window[1] = guiCreateWindow(0.16, 0.26, 0.65, 0.55, "Kill Or Be Killed Shop", true) guiWindowSetMovable(SHOP.window[1], false) guiWindowSetSizable(SHOP.window[1], false) guiSetProperty(SHOP.window[1], "CaptionColour", "FFFF0000") SHOP.label[1] = guiCreateLabel(0.02, 0.69, 0.97, 0.08, "Select item which you want to buy! \nThe shop value is K.B.K Points", true, SHOP.window[1]) guiSetFont(SHOP.label[1], "default-bold-small") guiLabelSetHorizontalAlign(SHOP.label[1], "center", true) guiLabelSetVerticalAlign(SHOP.label[1], "center") SHOP.button[1] = guiCreateButton(0.35, 0.79, 0.30, 0.12, "BUY", true, SHOP.window[1]) SHOP.button[2] = guiCreateButton(0.98, 0.07, 0.02, 0.03, "X", true, SHOP.window[1]) guiSetFont(SHOP.button[1], "default-bold-small") SHOP.tabpanel[1] = guiCreateTabPanel(40, 33, 587, 240, false, SHOP.window[1]) SHOP.tab[1] = guiCreateTab("Weapons", SHOP.tabpanel[1]) SHOP.panel[1] = guiCreateGridList(0.01, 0.03, 0.98, 0.92, true, SHOP.tab[1]) guiGridListAddColumn(SHOP.panel[1], "Item", 0.5) guiGridListAddColumn(SHOP.panel[1], "Price", 0.5) for i,v in pairs ( items.porsion1List ) do local row = guiGridListAddRow ( SHOP.panel[1] ) guiGridListSetItemText ( SHOP.panel[1], row, 1, v[1], false, false ) guiGridListSetItemText ( SHOP.panel[1], row, 2, v[2].."", false, false ) end SHOP.tab[2] = guiCreateTab("Mags", SHOP.tabpanel[1]) SHOP.panel[2] = guiCreateGridList(0.01, 0.03, 0.97, 0.92, true, SHOP.tab[2]) guiGridListAddColumn(SHOP.panel[2], "Item", 0.5) guiGridListAddColumn(SHOP.panel[2], "Price", 0.5) for i,v in pairs ( items.porsion2List ) do local row = guiGridListAddRow ( SHOP.panel[2] ) guiGridListSetItemText ( SHOP.panel[2], row, 1, v[1], false, false ) guiGridListSetItemText ( SHOP.panel[2], row, 2, v[2].."", false, false ) end SHOP.tab[3] = guiCreateTab("Car Parts", SHOP.tabpanel[1]) SHOP.panel[3] = guiCreateGridList(0.01, 0.03, 0.97, 0.92, true, SHOP.tab[3]) guiGridListAddColumn(SHOP.panel[3], "Item", 0.5) guiGridListAddColumn(SHOP.panel[3], "Price", 0.5) for i,v in pairs ( items.porsion3List ) do local row = guiGridListAddRow ( SHOP.panel[3] ) guiGridListSetItemText ( SHOP.panel[3], row, 1, v[1], false, false ) guiGridListSetItemText ( SHOP.panel[3], row, 2, v[2].."", false, false ) end SHOP.tab[4] = guiCreateTab("Medics", SHOP.tabpanel[1]) SHOP.panel[4] = guiCreateGridList(0.01, 0.03, 0.97, 0.92, true, SHOP.tab[4]) guiGridListAddColumn(SHOP.panel[4], "Item", 0.5) guiGridListAddColumn(SHOP.panel[4], "Price", 0.5) for i,v in pairs ( items.porsion4List ) do local row = guiGridListAddRow ( SHOP.panel[4] ) guiGridListSetItemText ( SHOP.panel[4], row, 1, v[1], false, false ) guiGridListSetItemText ( SHOP.panel[4], row, 2, v[2].."", false, false ) end SHOP.tab[5] = guiCreateTab("Items", SHOP.tabpanel[1]) SHOP.panel[5] = guiCreateGridList(0.01, 0.03, 0.97, 0.92, true, SHOP.tab[5]) guiGridListAddColumn(SHOP.panel[5], "Item", 0.5) guiGridListAddColumn(SHOP.panel[5], "Price", 0.5) for i,v in pairs ( items.porsion5List ) do local row = guiGridListAddRow ( SHOP.panel[5] ) guiGridListSetItemText ( SHOP.panel[5], row, 1, v[1], false, false ) guiGridListSetItemText ( SHOP.panel[5], row, 2, v[2].."", false, false ) end guiSetVisible(SHOP.window[1],false) addEventHandler ( "onClientGUIClick", root, click ) addEventHandler ( "onClientGUIClick", root, buttonClick ) end ) bindKey ( "f4", "down", function() if getElementData(localPlayer, "logedin") then local state = ( not guiGetVisible (SHOP.window[1]) ) if not getElementData(localPlayer,"shop.viewing") then setElementData(localPlayer,"shop.viewing",1) end guiSetVisible ( SHOP.window[1], state ) showCursor ( state ) if guiGetVisible(SHOP.window[1]) == false then removeEventHandler ( "onClientGUIClick", root, onSwitch ) if isElement(itemImage) then destroyElement(itemImage) end end end end ) function buttonClick(button,state) if getElementData(localPlayer, "logedin") then if source == SHOP.button[1] and button == "left" and state == "up" then if getElementData(localPlayer,"shop.viewing") then o = getElementData(localPlayer,"shop.viewing") local nRow, nColumn = guiGridListGetSelectedItem( SHOP.panel[o] ) if nRow ~= -1 and nColumn ~= - 1 then local selectedItem = guiGridListGetItemText ( SHOP.panel[o], guiGridListGetSelectedItem ( SHOP.panel[o] ), 1 ) local price = guiGridListGetItemText ( SHOP.panel[o], guiGridListGetSelectedItem ( SHOP.panel[o] ), 2 ) local money = getPlayerMoney(thePlayer) if (money) >= tonumber(price) then guiLabelSetColor( SHOP.label[1],255,255,255) -- guiSetText( SHOP.label[1],"pietiek nauda") setPlayerMoney(money -tonumber(price)) if selectedItem == "MK 48 Mod 0 Mag" then setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+100) elseif selectedItem == "M4A1 Holo Mag" then setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+20) elseif selectedItem == "AK-107 Mag" then setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+30) elseif selectedItem == "DMR Mag" then setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+5) elseif selectedItem == "CZ550 Mag" then setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+10) elseif selectedItem == "PDW Mag" then setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+30) elseif selectedItem == "M1911 Mag" then setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+10) elseif selectedItem == "1866 slug" then setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+7) elseif selectedItem == "Lee Enfield Mag" then setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+10) else setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+1) end guiLabelSetColor( SHOP.label[1],10,255,10) guiSetText( SHOP.label[1],"You succesfully bought "..selectedItem.." and you still have "..(money -tonumber(price)).." K.B.K Points") else outputChatBox("no enough money !",255,0,0) end end else guiLabelSetColor( SHOP.label[1],255,10,10) guiSetText( SHOP.label[1],"You are missing "..(price -tonumber(money)).." K.B.K Points") end elseif source == SHOP.button[2] then guiSetVisible ( SHOP.window[1], false ) showCursor ( false ) removeEventHandler ( "onClientGUIClick", root, onSwitch ) if isElement(itemImage) then destroyElement(itemImage) end end end end function onSwitch() if source == SHOP.panel[1] then setElementData(localPlayer,"shop.viewing",1) elseif source == SHOP.panel[2] then setElementData(localPlayer,"shop.viewing",2) elseif source == SHOP.panel[3] then setElementData(localPlayer,"shop.viewing",3) elseif source == SHOP.panel[4] then setElementData(localPlayer,"shop.viewing",4) elseif source == SHOP.panel[5] then setElementData(localPlayer,"shop.viewing",5) end end function click () if source == SHOP.panel[1] or source == SHOP.panel[2] or source == SHOP.panel[3] or source == SHOP.panel[4] or source == SHOP.panel[5] then local selectedItem = guiGridListGetItemText ( source, guiGridListGetSelectedItem ( source ), 1 ) local price = guiGridListGetItemText ( source, guiGridListGetSelectedItem ( source ), 2 ) guiSetText( SHOP.label[1],"To buy "..selectedItem.." for "..price.." K.B.K Points press button below") guiLabelSetColor( SHOP.label[1],255,255,255) if isElement(itemImage) then destroyElement(itemImage) itemImage = guiCreateStaticImage( 1050, 350, 450, 250, selectedItem..".png", false ) else itemImage = guiCreateStaticImage( 1050, 350, 450, 250, selectedItem..".png", false ) end end end addEvent("openWindow1",true) function Windows() if guiGetVisible(SHOP.panel[1]) ~= true then if not getElementData(localPlayer,"shop.viewing") then setElementData(localPlayer,"shop.viewing",1) end guiSetVisible(SHOP.window[1],true) showCursor(true) end end addEventHandler("openWindow1", getRootElement(), Windows) Server Side :- addEventHandler("onPlayerLogin",root, function () setElementData(source,"PDW",0) setElementData(source,"Winchester 1866",0) setElementData(source,"M1911",0) setElementData(source,"AK-107",0) setElementData(source,"M4A1 Holo",0) setElementData(source,"DMR",0) setElementData(source,"CZ550",0) setElementData(source,"MK 48 Mod 0",0) setElementData(source,"M4A1 Holo Mag",0) setElementData(source,"DMR Mag",0) setElementData(source,"CZ550 Mag",0) setElementData(source,"M1911 Mag",0) setElementData(source,"PDW Mag",0) setElementData(source,"1866 Slug",0) setElementData(source,"MK 48 Mod 0 Mag",0) setElementData(source,"Medic Kit",0) setElementData(source,"Painkiller",0) setElementData(source,"Morphine",0) setElementData(source,"Bandage",0) setElementData(source,"Water Bottle",0) setElementData(source,"Burger",0) setElementData(source,"Tire",0) setElementData(source,"Engine",0) setElementData(source,"Tank Parts",0) setElementData(source,"Camouflage Clothing",0) setElementData(source,"Army Clothing",0) setElementData(source,"Ghost Clothing",0) setElementData(source,"K.B.K Backpack",0) setElementData(source,"Ghillie Suit",0) setElementData(source,"Civilian Clothing",0) setElementData(source,"GPS",0) setElementData(source,"Map",0) setElementData(source,"Toolbox",0) end ) local marker1 = createMarker ( 177.13320922852, 2818.298828125, 68.174095153809, "cylinder", 1.5, 30, 212, 5 ) function HitMark(hitPlayer) triggerClientEvent (hitPlayer,"openWindow1",resourceRoot) end addEventHandler("onMarkerHit", marker1, HitMark) WOOH ...!! Editing is not that easy ! A little like would be very appreciate.
  23. Hello ! I have a probblem. Everytime when I creating a ped in the server using 'createPed' function, the ped that creating can't be killed [ immortal ]. I don't like that way. The ped should be able to killed. Did you know to fix this ? createPed(0, 0, 0, 5)
×
×
  • Create New...