Jump to content

Z4Zy

Members
  • Posts

    215
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Z4Zy

  1. One way is using 'setAccountData' function to save.
  2. @Quenix It's my practice. Always think about your script. Every time try yourself to solve your LUA problem. Then you'll also become a god automatically !
  3. I test a png image file with spaces in it's name. That png file is finding by the resource and work perfectly. And if you want to remove the image when player close the window, simply use; 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 else addEventHandler ( "onClientGUIClick", root, onSwitch ) end end end )
  4. Test this; 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( 500, 500, 400, 400, selectedItem..".png", false ) else itemImage = guiCreateStaticImage( 500, 500, 400, 400, selectedItem..".png", false ) end end end
  5. Quick Hint :- If you want to draw a DX image with the item click, you can use this trick. Rename the images how it appears in the gridlist's first column. Then, when customer click on one of our 3 gridlists, take the selected text of gridlist as a variable and draw image according to it.
  6. First of all sorry for late ! I just edit some of code in client side. The item table also divided into 3 parts. I just divided them to show you the method. They are not divided correctly. You should fix them. You can understand below code. Examine it well. Server code remains same. 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}, {"Medic Kit",50}, {"Painkiller",10}, {"Morphine",10}, {"Bandage",5}, {"Water Bottle",15}, {"Burger",15} }, porsion3List = { {"Tire",75}, {"Engine",125}, {"Tank Parts",50}, {"Camouflage Clothing",100}, {"Army Clothing",150}, {"Ghost Clothing",200}, {"K.B.K Backpack",150}, {"Ghillie Suit",200}, {"Civilian Clothing",30}, {"GPS",15}, {"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]) guiSetFont(SHOP.button[1], "default-bold-small") SHOP.tabpanel[1] = guiCreateTabPanel(40, 33, 587, 240, false, SHOP.window[1]) SHOP.tab[1] = guiCreateTab("Porsion 1", 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("Porsion 2", 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("Porsion 3", 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 guiSetVisible(SHOP.window[1],false) addEventHandler ( "onClientGUIClick", SHOP.panel[1], click ) addEventHandler ( "onClientGUIClick", SHOP.panel[2], click ) addEventHandler ( "onClientGUIClick", SHOP.panel[3], click ) addEventHandler ( "onClientGUIClick", SHOP.button[1], buttonClick ) end ) bindKey ( "f4", "down", function ( ) if getElementData(localPlayer, "logedin") then -- if getElementData (getLocalPlayer(),"playerlevel") >= 3 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 ) else addEventHandler ( "onClientGUIClick", root, onSwitch ) end -- else -- outputChatBox (" 3!") -- end end end ) function buttonClick(button,state) if getElementData(localPlayer, "logedin") then if 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 else guiSetText( SHOP.label[1],"Select something first") guiLabelSetColor( SHOP.label[1],255,255,255) 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) end end function click () if source == SHOP.panel[1] or source == SHOP.panel[2] or source == SHOP.panel[3] 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) end end
  7. OMG I done it !! I done it !! It's working pretty much cool !! Thanx for your suppor @IIYAMA Client Side :- addEventHandler("onClientPlayerWeaponFire",root, function (_,_,_,_,_,_,h) if h and getElementType(h) == "vehicle" then local targetStart = Vector3(getPedTargetStart(localPlayer)) local targetEnd = Vector3(getPedTargetEnd(localPlayer)) local dir = (targetStart-targetEnd):getNormalized() triggerServerEvent("onFired",resourceRoot,h,dir.x,dir.y,dir.z) end end ) Server Side :- addEvent("onFired",true) addEventHandler("onFired",root, function (h,dirx,diry,dirz) setElementVelocity(h,-dirx,-diry,-dirz) end )
  8. Hey @IIYAMA !! I know you'll be here soon ! BTW, as I understand, I got the vehicle position as it is on remote location and ped-target-end position. Then subtract each other and normalize. Then passed to the server side as below. Client Side :- addEventHandler("onClientPlayerWeaponFire",root, function (_,_,_,_,_,_,h) if h and getElementType(h) == "vehicle" then local vehLocation = Vector3(getElementPosition(h)) local targetEnd = Vector3(getPedTargetEnd(localPlayer)) local dir = (vehLocation-targetEnd):getNormalized() triggerServerEvent("onFired",resourceRoot,h,dir.x,dir.y,dir.z) end end ) Server Side :- addEvent("onFired",true) addEventHandler("onFired",root, function (h,dirx,diry,dirz) setElementVelocity(h,0.1,0.1,0.1) end ) But I don't know how to use them to change vehicle's force direction. How to use them
  9. Hello my friends ! I just trying to move an object away when someone fire on it. I created below client and server side codes. Client Side :- addEventHandler("onClientPlayerWeaponFire",root, function (_,_,_,_,_,_,h) if h and getElementType(h) == "vehicle" then triggerServerEvent("onFired",resourceRoot,h) end end ) Server Side :- addEvent("onFired",true) addEventHandler("onFired",root, function (h) setElementVelocity(h,0.1,0.1,0.1) end ) But the problem in here is, when fire in different directions, the velocity / force acted on the vehicle in same direction. Can you please help me to change the force direction of the vehicle according to the fire direction ? I thing maths should be applied in here [ may not :p ]. However, I'm really newbie in some of lua maths. [ math.sine, math.cos, math.tan, math.#%$...BLA.. BLA..]. So, at least little help will very useful !!
  10. or you can do the code like following; this only the 'buttonClick' function. function buttonClick(button,state) if getElementData(localPlayer, "logedin") then if button == "left" and state == "up" then local nRow, nColumn = guiGridListGetSelectedItem( SHOP.gridlist[1] ) if nRow ~= -1 and nColumn ~= - 1 then local selectedItem = guiGridListGetItemText ( SHOP.gridlist[1], guiGridListGetSelectedItem ( SHOP.gridlist[1] ), 1 ) local price = guiGridListGetItemText ( SHOP.gridlist[1], guiGridListGetSelectedItem ( SHOP.gridlist[1] ), 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 else guiLabelSetColor( SHOP.label[1],255,10,10) guiSetText( SHOP.label[1],"You are missing "..(price -tonumber(money)).." K.B.K Points") end else guiSetText( SHOP.label[1],"Select something first") guiLabelSetColor( SHOP.label[1],255,255,255) end end end
  11. Did you talking about a panel like below images ??
  12. In line 99 of Client Side, you can see; setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+1) You can change '+1' in the argument to any number you wish. And if you want to up the value of 'MK 48 Mod 0 Mag' only, you had to check it like below; if selectedItem == "MK 48 Mod 0 Mag" then setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+100) else setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+1) end
  13. Hi @Quenix !! I examined the code that you have provided. And I should tell you that, when you use 'setElementData' to store a numeric value, you should first set it '0' or some numeric value because it's value is a boolean [ true / false ( may be nil ) ] in initial. So, I prepared a server Side code for this. 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 )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 ) Also done simple changes to client side code; Client Side :- local items = { --items,cena(K.B.K Points) {"M1911",50}, {"PDW",150}, {"Winchester 1866",150}, {"AK-107",300}, {"M4A1 Holo",300}, {"MK 48 Mod 0",450}, {"CZ550",300}, {"DMR",400}, {"M1911 Mag",50}, {"PDW Mag",100}, {"1866 Slug",125}, {"AK-107 Mag",100}, {"M4A1 Holo Mag",50}, {"MK 48 Mod 0 Mag",200}, {"CZ550 Mag",50}, {"DMR Mag",25}, {"Medic Kit",50}, {"Painkiller",10}, {"Morphine",10}, {"Bandage",5}, {"Water Bottle",15}, {"Burger",15}, {"Tire",75}, {"Engine",125}, {"Tank Parts",50}, {"Camouflage Clothing",100}, {"Army Clothing",150}, {"Ghost Clothing",200}, {"K.B.K Backpack",150}, {"Ghillie Suit",200}, {"Civilian Clothing",30}, {"GPS",15}, {"Map",15}, {"Toolbox",25}, } SHOP = { button = {}, window = {}, gridlist = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() SHOP.window[1] = guiCreateWindow(0.17, 0.23, 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", "FF075205") SHOP.gridlist[1] = guiCreateGridList(0.01, 0.06, 0.97, 0.63, true, SHOP.window[1]) column = guiGridListAddColumn(SHOP.gridlist[1], "Item", 0.5) column2 =guiGridListAddColumn(SHOP.gridlist[1], "K.B.K Points", 0.5) for _, v in ipairs(items) do local row = guiGridListAddRow ( SHOP.gridlist[1] ) guiGridListSetItemText ( SHOP.gridlist[1], row, column, v[1], false, false ) guiGridListSetItemText ( SHOP.gridlist[1], row, column2, v[2].."", false, false ) end guiSetProperty(SHOP.gridlist[1], "SortSettingEnabled", "False") 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]) guiLabelSetColor( SHOP.label[1],255,255,255) 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]) guiSetFont(SHOP.button[1], "default-bold-small") guiSetVisible ( SHOP.window[1], false ) addEventHandler ( "onClientGUIClick", SHOP.gridlist[1], click ) addEventHandler ( "onClientGUIClick", SHOP.button[1], buttonClick ) end ) bindKey ( "f4", "down", function ( ) if getElementData(localPlayer, "logedin") then -- if getElementData (getLocalPlayer(),"playerlevel") >= 3 then local state = ( not guiGetVisible (SHOP.window[1]) ) guiSetVisible ( SHOP.window[1], state ) showCursor ( state ) -- else -- outputChatBox (" 3!") -- end end end ) function buttonClick(button) if getElementData(localPlayer, "logedin") then if button == "left" then local nRow, nColumn = guiGridListGetSelectedItem( SHOP.gridlist[1] ) if nRow ~= -1 and nColumn ~= - 1 then local selectedItem = guiGridListGetItemText ( SHOP.gridlist[1], guiGridListGetSelectedItem ( SHOP.gridlist[1] ), 1 ) local price = guiGridListGetItemText ( SHOP.gridlist[1], guiGridListGetSelectedItem ( SHOP.gridlist[1] ), 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)) setElementData(getLocalPlayer(),selectedItem,getElementData(getLocalPlayer(),selectedItem)+1) 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 else guiLabelSetColor( SHOP.label[1],255,10,10) guiSetText( SHOP.label[1],"You are missing "..(price -tonumber(money)).." K.B.K Points") end else guiSetText( SHOP.label[1],"Select something first") guiLabelSetColor( SHOP.label[1],255,255,255) end end end function click () local selectedItem = guiGridListGetItemText ( SHOP.gridlist[1], guiGridListGetSelectedItem ( SHOP.gridlist[1] ), 1 ) local price = guiGridListGetItemText ( SHOP.gridlist[1], guiGridListGetSelectedItem ( SHOP.gridlist[1] ), 2 ) guiSetText( SHOP.label[1],"To buy "..selectedItem.." for "..price.." K.B.K Points press button below") guiLabelSetColor( SHOP.label[1],255,255,255) end Just check it out !
  14. okay ! It's debug time alanlar = { { 1082.17944, -2117.68848, 45.22021, 275.57470703125, 143.94189453125, 47.723364257812}, { 96.42160, 1799.00146, 8.64063, 207.82876586914, 164.90344238281, 49.681719207764}, { 1159.22192, -1861.63623, 2207.91968, 458.67749023438, 135.39514160156, 347.82529296875}, { -3028.51025, 412.85077, -4.36548, 165.30834960938, 101.53894042969, 71.609956288338} } for i,v in pairs(alanlar) do local x, y, z, width, height, depth = unpack(alanlar[i]) --rad = createRadarArea ( x, y, width, height, 255, 0, 0, 170, root ) col = createColCuboid ( x, y, z, width, height, depth) setElementData(col, "zombieProof", true) end addEventHandler("onColShapeHit", root, function(giren) if getElementData(source,"zombieProof") == true and getElementType(giren) == "ped" then if getElementData(giren, "zombie") then destroyElement(giren) outputChatBox("element destroyed !",root) else outputChatBox("player / ped that entered the col hasn't data called 'zombie' !",root) end elseif getElementType(giren) ~= "ped" then outputChatBox("You are not a ped ! ( "..getElementType(giren).." )",root) elseif getElementData(source,"zombieProof") ~= true outputChatBox("this col hasn't data called 'zombieProof'",root) else outputChatBox("error !",root,255,0,0) end end ) this is a simple debug code created at the moment :3 tell me what outputs when a zombie hit a col created by above script.
  15. check weather your zombie script set the element data of zombie ped as, setElementData(--[[element]],"zombie",true)
  16. are there any error show in debug console related to script ?
  17. What about this ? alanlar = { { 1082.17944, -2117.68848, 45.22021, 275.57470703125, 143.94189453125, 47.723364257812}, { 96.42160, 1799.00146, 8.64063, 207.82876586914, 164.90344238281, 49.681719207764}, { 1159.22192, -1861.63623, 2207.91968, 458.67749023438, 135.39514160156, 347.82529296875}, { -3028.51025, 412.85077, -4.36548, 165.30834960938, 101.53894042969, 71.609956288338} } for i,v in pairs(alanlar) do local x, y, z, width, height, depth = unpack(alanlar[i]) --rad = createRadarArea ( x, y, width, height, 255, 0, 0, 170, root ) col = createColCuboid ( x, y, z, width, height, depth) setElementData(col, "zombieProof", true) end addEventHandler("onColShapeHit", root, function(giren) if getElementData(source,"zombieProof") == true and getElementType(giren) == "ped" then if getElementData(giren, "zombie") then destroyElement(giren) end end end )
  18. Replace this code with that waste code... will work !
  19. sorry, but there was a little mistake in above supplied code for bind 'z' to the ground animation. Also, I suggest to use different customBlockName local customBlockName = "rifleAnims" -- load the IFP file local IFP = engineLoadIFP( "rifle.ifp", customBlockName ) -- let us know if IFP failed to load if not IFP then outputChatBox( "Failed to load 'rifle.ifp'" ) end -- bind z to the ground animation bindKey("z","down", function () local block,anim = getPedAnimation(localPlayer) if block == customBlockName and anim == "RIFLE_crouchfire" then setPedAnimation(localPlayer) else setPedAnimation(localPlayer,customBlockName,"RIFLE_crouchfire") end end )
  20. so it may be the animation on the IFP file.
  21. Bind 'z' to the ground animation, Client Side :- local customBlockName = "Rifle" -- load the IFP file local IFP = engineLoadIFP( "rifle.ifp", customBlockName ) -- let us know if IFP failed to load if not IFP then outputChatBox( "Failed to load 'rifle.ifp'" ) end -- bind z to the ground animation bindKey("z","down", function () local anim,block = getPedAnimation(localPlayer) if block == customBlockName and anim == "RIFLE_crouchfire" then setPedAnimation(localPlayer) else setPedAnimation(localPlayer,customBlockName,"RIFLE_crouchfire") end end ) Replace 'crouch' animation [ so, when player press 'c', ground animation will set. ] Client Side :- local customBlockName = "Rifle" -- load the IFP file local IFP = engineLoadIFP( "rifle.ifp", customBlockName ) -- let us know if IFP failed to load if not IFP then outputChatBox( "Failed to load 'rifle.ifp'" ) end -- replace the crouch animation engineReplaceAnimation( localPlayer, "ped", "weapon_crouch", customBlockName, "RIFLE_crouchfire" )
  22. This may work setPedControlState(thePlayer,"enter_exit",true) But wiki says,
  23. Hi Friends ! Do you know any way to replace the default sky in the game instead of changing the sky gradient
  24. what animation does not work ?
  25. what do you mean by that ? commands for set player walking animations ? replace current animations with custom ones ?
×
×
  • Create New...