Jump to content

Swagy

Members
  • Posts

    90
  • Joined

  • Last visited

Everything posted by Swagy

  1. Well, this is an inventory system, so If you drop the item, it will create a pickup and when you take the pickup it gives +1 that item, the error is: Expected element at argument 2, got boolean for addEventHandler ("onClientPickupHit", pickUp, function)
  2. Well title says it all, check this GUIEditor = { gridlist = {}, window = {}, button = {} } GUIEditor.window[1] = guiCreateWindow(0.04, 0.22, 0.40, 0.71, "My Inventory", true) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(0.03, 0.07, 0.93, 0.82, true, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Item", 0.5) guiGridListAddColumn(GUIEditor.gridlist[1], "Amount", 0.5) GUIEditor.button[1] = guiCreateButton(0.03, 0.89, 0.31, 0.08, "Use", true, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(0.66, 0.89, 0.31, 0.08, "Drop", true, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") guiSetVisible (GUIEditor.window[1], false) PR = { label = {}, progressbar = {} } PR.progressbar[1] = guiCreateProgressBar(0.18, 0.47, 0.64, 0.06, true) PR.label[1] = guiCreateLabel((516 - 101) / 2, (34 - 16) / 2, 101, 16, "Using Repair Kit...", false, PR.progressbar[1]) guiSetFont(PR.label[1], "default-bold-small") guiLabelSetColor(PR.label[1], 1, 126, 253) guiProgressBarSetProgress(PR.progressbar[1], 0) guiSetVisible (PR.progressbar[1], false) function openGUI (result) if guiGetVisible (GUIEditor.window[1]) == true then guiSetVisible (GUIEditor.window[1], false) showCursor (false) guiGridListClear (GUIEditor.gridlist[1], true) outputChatBox ("Bag closed successfully !", 255,0,0) else guiSetVisible (GUIEditor.window[1], true) showCursor (true) guiGridListClear (GUIEditor.gridlist[1], true) outputChatBox ("Bag opened successfully !", 255,255,0) for k,v in ipairs (result) do local row1 = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row1, 1, v["itemname"] , false, false) guiGridListSetItemText(GUIEditor.gridlist[1], row1, 2, v["amoun"] , false, false) end end end addEvent ("onOpenGUI", true) addEventHandler ("onOpenGUI", root, openGUI) function useObject () local item = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) local amount = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 2) if (source == GUIEditor.button[1]) then if item == "Medic Kits" then if tonumber(amount) > 0 then local pHp = getElementHealth (localPlayer) if tonumber (pHp) < 100 then guiSetVisible (PR.progressbar[1], true) guiSetText (PR.label[1], "Using Medic Kit...") guiProgressBarSetProgress(PR.progressbar[1], 0) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 20)end,500,1) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 40)end,1000,1) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 60)end,1500,1) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 80)end,2000,1) setTimer (function ()setElementHealth (localPlayer, pHp+30) guiProgressBarSetProgress (PR.progressbar[1],100) guiSetVisible (PR.progressbar[1], false)end,2500,1) triggerServerEvent ("onUse", localPlayer, item) outputChatBox ("You have taken 1 Medic Kit It will take effect in 5 seconds.", 255,255,255) guiSetVisible (GUIEditor.window[1], false) showCursor (false) else outputChatBox ("Your HP is full!", 255,0,0) end end elseif item == "Food" then if tonumber(amount) > 0 then local pHp = getElementHealth (localPlayer) if tonumber (getElementHealth (localPlayer)) < 100 then guiSetVisible (PR.progressbar[1], true) guiSetText (PR.label[1], "Eating some food...") guiProgressBarSetProgress(PR.progressbar[1], 0) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 20)end,500,1) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 40)end,1000,1) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 60)end,1500,1) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 80)end,2000,1) setTimer (function ()setElementHealth (localPlayer, pHp+10) guiProgressBarSetProgress (PR.progressbar[1],100) guiSetVisible (PR.progressbar[1], false)end,2500,1) triggerServerEvent ("onUse", localPlayer, item) outputChatBox ("You have taken some Food It will take effect in 5 seconds.", 255,255,255) guiSetVisible (GUIEditor.window[1], false) showCursor (false) else outputChatBox ("Your HP is full!", 255,0,0) end end elseif item == "Repair Kits" then if tonumber(amount) > 0 then local vehicle = getPedOccupiedVehicle (localPlayer) local vehHP = getElementHealth (vehicle) if (vehicle) then if tonumber (vehHP) < 1000 then guiSetVisible (PR.progressbar[1], true) setElementFrozen (localPlayer, true) guiProgressBarSetProgress(PR.progressbar[1], 0) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 20)end,500,1) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 40)end,1000,1) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 60)end,1500,1) setTimer (function () guiProgressBarSetProgress(PR.progressbar[1], 80)end,2000,1) setTimer (function () setElementHealth (vehicle, vehHP+250) guiProgressBarSetProgress (PR.progressbar[1],100) guiSetVisible (PR.progressbar[1], false) setElementFrozen (localPlayer, false)end,2500,1) triggerServerEvent ("onUse", localPlayer, item) outputChatBox ("You have taken 1 Repair Kit It will take effect in 5 seconds.", 255,255,255) guiSetVisible (GUIEditor.window[1], false) showCursor (false) else outputChatBox ("Your Vehicle's HP is full!", 255,0,0) end else outputChatBox ("You're not in a vehicle!",255,0,0) end end else outputChatBox ("You either can't use this item or you have 0 units of this item !" ,255,0,0) end end end addEventHandler ("onClientGUIClick", root, useObject) function dropItem () local item = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) local x,y,z = getElementPosition (localPlayer) if (source == GUIEditor.button[2]) then if (item) then if item == "Medic Kits" then pickUp = createPickup ( x, y, z, 3, 1240 ) outputChatBox ("You have dropped a Medic Kit !",255,255,255) guiSetVisible(GUIEditor.window[1], false) showCursor(false) dropped = "Medic Kits" triggerServerEvent ("onUse", localPlayer, item) elseif item == "Repair Kits" then pickUp = createPickup ( x, y, z, 3, 1277 ) outputChatBox ("You have dropped a Repair Kit !",255,255,255) guiSetVisible(GUIEditor.window[1], false) showCursor(false) dropped = "Repair Kits" triggerServerEvent ("onUse", localPlayer, item) elseif item == "Food" then pickUp = createPickup ( x, y, z, 3, 2212 ) outputChatBox ("You have dropped some food !",255,255,255) guiSetVisible(GUIEditor.window[1], false) showCursor(false) dropped = "Food" triggerServerEvent ("onUse", localPlayer, item) elseif item == "Wood" then pickUp = createPickup ( x, y, z, 3, 1448 ) outputChatBox ("You have dropped wood !",255,255,255) guiSetVisible(GUIEditor.window[1], false) showCursor(false) dropped = "Wood" triggerServerEvent ("onUse", localPlayer, item) elseif item == "Oil" then pickUp = createPickup ( x, y, z, 3, 1217 ) outputChatBox ("You have dropped some Oil !",255,255,255) guiSetVisible(GUIEditor.window[1], false) showCursor(false) dropped = "Oil" triggerServerEvent ("onUse", localPlayer, item) else pickUp = createPickup ( x, y, z, 3, 1279 ) outputChatBox ("You have dropped a ".. item .." !",255,255,255) guiSetVisible(GUIEditor.window[1], false) showCursor(false) dropped = item triggerServerEvent ("onUse", localPlayer, item) end end end end addEventHandler ("onClientGUIClick", root, dropItem) function takeObject () triggerServerEvent ("onTakeObject", localPlayer, dropped) end addEventHandler ("onClientPickupHit", pickUp, takeObject)
  3. All of you know CSG server? It's open back ! join now to enjoy, we need feedback, we need scripters, staffs, web developers..etc join show us what you got !! Screenshots; SOON
  4. I want to create a new weapon like M4 for example or MG, or bomb thrower, or replace "flowers", "dildo"..ect into new weps, any help ? I want to make melee weps fire..
  5. Hello Community, I'm searching a cheap dedicated server (35$ or less) to make my own community (froum + mta server +mIRC) Well do you have any suggestions ?
  6. Username (In control panel): crgmta Full Name: Cyber Revolution Gaming Skype: blid.boy93 Email: [email protected] Server Slot: 100 (minimaum) Reason that you want a free MTASA Server: Well i was trying for 3 or 2 years to get a host for my server and we were doing our best to get it, but unfortunately we hadn't credit cards, so we searched for free hosts and we found you guys, Thank you.
  7. Hello community, we are trying to connect our MySQL server, but this message appears; ERROR: Could not load /home/mta/mta/rgcmta/mods/deathmatch/./dbconmy. so - libmysqlclient.so.16: cannot open shared object file: No such file or direc tory we do have that libmysqlclient.so.16 but we just dont know what is the path where it tries to find it any help please ?
  8. there are no cool scripts there, i would like some help here...
  9. Hello all, i'm creating a new server with some mates, i've got some scripts but i still need some; -Group Panel -Staff Panel (New One) -Turf System i need help, if anyone got free versions of there, contact me please. Thank you all
  10. I forgot to say that i haven't a router
  11. Hello Guys We Have A small problem in Tunisia we really need help we don't have any international payment method so that's why we can't even opena server only hackers can so pls some one to help me i wanted to open server but we haven't the solutions
  12. Hello Guys i wanted to say that i'm tunisian and i need a host provider to start my server with my friend that's why i decided to post here so Pls i need Solution as fast as possible. and as all know tunisians haven't paypal only rich peoples can have it
×
×
  • Create New...