Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Client .....
- gMe = getLocalPlayer()
- shopWindow = guiCreateWindow(367,105,334,435,"Waffenladen",false)
- guiSetVisible (shopWindow, false)
- guiSetAlpha(shopWindow,1)
- guiWindowSetSizable(shopWindow,false)
- tabPanel = guiCreateTabPanel(11,23,314,372,false,shopWindow)
- tab2 = guiCreateTab("Waffen",tabPanel)
- weapGrid = guiCreateGridList(4,6,305,291,false,tab2)
- guiGridListSetSelectionMode(weapGrid,0)
- weapColumn = guiGridListAddColumn(weapGrid,"Waffe",0.4)
- costColumn = guiGridListAddColumn(weapGrid,"Preis",0.2)
- ammoColumn = guiGridListAddColumn(weapGrid,"Mun",0.2)
- weapButton = guiCreateButton(107,308,100,29,"Kaufen",false,tab2)
- tab3 = guiCreateTab("Skills",tabPanel)
- skillsGrid = guiCreateGridList(4,6,305,291,false,tab3)
- guiGridListSetSelectionMode(skillsGrid,0)
- idColumn = guiGridListAddColumn(skillsGrid,"ID",0.3)
- skillsColumn = guiGridListAddColumn(skillsGrid,"Skill",0.5)
- costColumn = guiGridListAddColumn(skillsGrid,"Preis",0.3)
- -------------------------------------------------------------
- tab4 = guiCreateTab("Extras",tabPanel)
- extraGrid = guiCreateGridList(4,6,305,291,false,tab4)
- guiGridListSetSelectionMode(extraGrid,0)
- IdColumn = guiGridListAddColumn(extraGrid,"ID",0.2)
- extraColumn = guiGridListAddColumn(extraGrid,"Extra",0.5)
- costColumn = guiGridListAddColumn(extraGrid,"Preis",0.2)
- extraButton = guiCreateButton(107,308,100,29,"Kaufen",false,tab4)
- --------------------------------------
- weapButton = guiCreateButton(107,308,100,29,"Kaufen",false,tab2)
- skillsButton = guiCreateButton(107,308,100,29,"Kaufen",false,tab3)
- local weapons = {{5,100,1},{6,100,1},{8,1000,1},{9,10000,1},{16,18000,15},{22,1800,100},{23,1000,100},{24,2000,100},{25,8000,100},{26,2500,100},{27,2500,100},{28,1500,100},{29,2000,100},{30,2900,100},{31,3200,100},{32,10000,500},{33,5300,100},{34,5500,100},{46,500,1}}
- for i,v in ipairs (weapons) do
- local itemName = getWeaponNameFromID (v[1])
- local row = guiGridListAddRow (weapGrid)
- local ammo = v[3] or 200
- guiGridListSetItemText (weapGrid, row, 1, itemName, false, true)
- guiGridListSetItemText (weapGrid, row, 2, tostring(v[2]), false, true)
- guiGridListSetItemText (weapGrid, row, 3, tostring(ammo), false, true)
- end
- guiSetAlpha(weapGrid,1)
- closeButton = guiCreateButton(112,401,113,24,"Schließen",false,shopWindow)
- skillsTable = {{"0","Colt-45 Skill","250"},{"1","Silenced-Pistol Skill","2000"},{"2","Desert-Eagle Skill","5000"},{"3","Shotgun Skill","16000"},{"4","Sawed-off Skill","22000"},{"5","Spaz-12 Skill","15000"},{"6","Uzi Skill","11000"},{"7","MP5 Skill","14000"},{"8","AK-47 Skill","16000"},{"9","M4 Skill","20000"},{"10","Sniper","20000"}}
- for i,v in ipairs (skillsTable) do
- local row = guiGridListAddRow (skillsGrid)
- guiGridListSetItemText (skillsGrid, row, 1, v[1], false, true)
- guiGridListSetItemText (skillsGrid, row, 2, v[2], false, true)
- guiGridListSetItemText (skillsGrid, row, 3, v[3], false, true)
- end
- extraTable = {{"0","Doppelt Soviel Leben","5000"},{"1","Permanentes Jetpack","50000"},{"2","2x Money Reward","90000"},{"3","4x Money Reward","120000"},{"4","10x Money Reward","420000"},{"5","Double Ammo","35000"}}
- for i,v in ipairs (extraTable) do
- local row = guiGridListAddRow (extraGrid)
- guiGridListSetItemText (extraGrid, row, 1, v[1], false, true)
- guiGridListSetItemText (extraGrid, row, 2, v[2], false, true)
- guiGridListSetItemText (extraGrid, row, 3, v[3], false, true)
- end
- function closeShop()
- if guiGetVisible(shopWindow) then
- guiSetVisible(shopWindow,false)
- showCursor(false)
- end
- end
- addEventHandler ("onClientGUIClick", closeButton, closeShop)
- addEvent ("viewGUI", true)
- function viewGUI ()
- if (getLocalPlayer() == source) then
- guiSetVisible (shopWindow, true)
- showCursor (true)
- end
- end
- addEventHandler ("viewGUI", getRootElement(), viewGUI)
- function onClientWeapBuy (button, state, absoluteX, absoluteYe)
- if (source == weapButton) then guiSetVisible (shopWindow, true) showCursor (true)
- if (guiGridListGetSelectedItem (weapGrid)) then
- local itemName = guiGridListGetItemText (weapGrid, guiGridListGetSelectedItem (weapGrid), 1)
- local itemID = getWeaponIDFromName (itemName)
- local itemCost = guiGridListGetItemText (weapGrid, guiGridListGetSelectedItem (weapGrid), 2)
- local itemAmmo = guiGridListGetItemText (weapGrid, guiGridListGetSelectedItem (weapGrid), 3)
- triggerServerEvent ("weapBuy", getLocalPlayer(), itemID, itemCost, itemName, itemAmmo)
- end
- end
- end
- addEventHandler ("onClientGUIClick", weapButton, onClientWeapBuy)
- function cursor()
- local currentState = isCursorShowing ()
- local oppositeState = not currentState
- showCursor ( oppositeState )
- end
- addCommandHandler("mouse", cursor)
- function onClientSkillBuy (button, state, absoluteX, absoluteYe)
- if (source == skillsButton) then guiSetVisible (shopWindow, true) showCursor (true)
- if (guiGridListGetSelectedItem (skillsGrid)) then
- local id = guiGridListGetItemText (skillsGrid, guiGridListGetSelectedItem (skillsGrid), 1)
- local cost = guiGridListGetItemText (skillsGrid, guiGridListGetSelectedItem (skillsGrid), 2)
- triggerServerEvent ("skillBuy", getLocalPlayer(), id, cost)
- end
- end
- end
- addEventHandler ("onClientGUIClick", skillsButton, onClientSkillBuy)
- function onClientExtraBuy (button, state, absoluteX, absoluteYe)
- if (source == extraButton) then guiSetVisible (shopWindow, true) showCursor (true)
- if (guiGridListGetSelectedItem (extraGrid)) then
- local idextra = guiGridListGetItemText (extraGrid, guiGridListGetSelectedItem (extraGrid), 1)
- local costextra = guiGridListGetItemText (extraGrid, guiGridListGetSelectedItem (extraGrid), 2)
- triggerServerEvent ("extraBuy", getLocalPlayer(), idextra, costextra)
- end
- end
- end
- addEventHandler ("onClientGUIClick", extraButton, onClientSkillBuy)
- function create3DDrawText(text, x, y, z, r, g, b, thick, view, line, dr, dg, db)
- z = z+0.2
- --createPickup(x, y, z, 3, 1239, 500)
- addEventHandler("onClientRender", getRootElement(),
- function()
- local xp, yp, zp = getElementPosition( gMe )
- local x1, y1 = getScreenFromWorldPosition( x, y, z+0.5)
- if(getDistanceBetweenPoints3D( x, y, z, xp, yp, zp ) < view) and (x1) then
- x1 = x1-40
- if(line == true) then
- if(isLineOfSightClear(x, y, z, xp, yp, zp, true, true, false, false, false, false, false)) then
- dxDrawText (text, x1, y1, x1, y1, tocolor ( r, g, b, 255 ), thick, "default-bold")
- end
- else
- dxDrawText (text, x1, y1, x1, y1, tocolor ( r, g, b, 255 ), thick, "default-bold")
- end
- end
- end)
- end
- -- Texte --
- create3DDrawText("Waffenladen", 2306.7231445313, -5.3885803222656, 26.120220184326, 0, 255, 0, 2, 50, true, 0, 0, 0)
- Server ...
- automat = createObject(956, 2305.7231445313, -5.3885803222656, 26.120220184326, 0, 0, 88)
- addEvent ("viewGUI", true)
- function showGui(but, stat, hitPlayer)
- if(but == "left") and (stat == "down") then
- triggerClientEvent ("viewGUI", hitPlayer)
- end
- end
- addEventHandler("onElementClicked", automat,showGui)
- addEvent ("weapBuy", true)
- addEventHandler ("weapBuy", getRootElement(),
- function(id, cost, name, ammo)
- if (getPlayerMoney (source) >= tonumber(cost)) then
- outputChatBox ("Du hast: ein/eine" .. name.." für $"..cost.." Gekauft!", source, 0, 255, 0, false)
- takePlayerMoney (source, tonumber (cost))
- giveWeapon(source, tonumber(id),tonumber(ammo),true)
- else
- outputChatBox ("Du hast nicht Genug Geld", source, 255, 0, 0, false)
- end
- end)
- function skillButton (id, cost)
- if (id == "0") then
- skillBuyPlayer (250,source,69)
- elseif (id == "1") then
- skillBuyPlayer (2000,source,70)
- elseif (id == "2") then
- skillBuyPlayer (5000,source,71)
- elseif (id == "3") then
- skillBuyPlayer (16000,source,72)
- elseif (id == "4") then
- skillBuyPlayer (22000,source,73)
- elseif (id == "5") then
- skillBuyPlayer (15000,source,74)
- elseif (id == "6") then
- skillBuyPlayer (11000,source,75)
- elseif (id == "7") then
- skillBuyPlayer (14000,source,76)
- elseif (id == "8") then
- skillBuyPlayer (16000,source,77)
- elseif (id == "9") then
- skillBuyPlayer (20000,source,78)
- elseif (id == "10") then
- skillBuyPlayer (20000,source,79)
- end
- end
- addEvent ("skillBuy", true)
- addEventHandler ("skillBuy", getRootElement(),skillButton)
- function skillBuyPlayer (cash,player,id)
- if (getPlayerMoney (player) >= cash) then
- takePlayerMoney (player,cash)
- setPedStat(player, id, 999)
- else outputChatBox ("Du hast nicht Genug Geld!", player, 255,0,0)
- end
- end
- function extraButton (id, cost)
- if (id == "0") then
- if (getPlayerMoney (source) >= cost) then
- takePlayerMoney (source,cost)
- setPedStat(source, 24, 999)
- outputChatBox ("Du hast Extra "..id.." für "..cost.." Gekauft !", source, 255,0,0)
- else
- outputChatBox ("Du hast nicht Genug Geld!", source, 255,0,0)
- end
- elseif (id == "1") then
- ------------------Jetpack
- if (getPlayerMoney (source) >= cost) then
- takePlayerMoney (source,cost)
- givesourceJetPack ( source )
- outputChatBox ("Du hast Extra "..id.." für "..cost.." Gekauft !", source, 255,0,0)
- else
- outputChatBox ("Du hast nicht Genug Geld!", source, 255,0,0)
- end
- elseif (id == "2") then
- --------------2x Money
- if (getPlayerMoney (source) >= cost) then
- takePlayerMoney (source,cost)
- setElementData(source, "2x", true)
- outputChatBox ("Du hast Extra "..id.." für "..cost.." Gekauft !", source, 255,0,0)
- else
- outputChatBox ("Du hast nicht Genug Geld!", source, 255,0,0)
- end
- elseif (id == "3") then
- ----------------4x Money
- if (getPlayerMoney (source) >= cost) then
- takePlayerMoney (source,cost)
- setElementData(source, "4x", true)
- outputChatBox ("Du hast Extra "..id.." für "..cost.." Gekauft !", source, 255,0,0)
- else
- outputChatBox ("Du hast nicht Genug Geld!", source, 255,0,0)
- end
- elseif (id == "4") then
- -------------10x Money
- if (getPlayerMoney (source) >= cost) then
- takePlayerMoney (source,cost)
- setElementData(source, "10x", true)
- outputChatBox ("Du hast Extra "..id.." für "..cost.." Gekauft !", source, 255,0,0)
- else
- outputChatBox ("Du hast nicht Genug Geld!", source, 255,0,0)
- end
- elseif (id == "5") then
- --------Double Ammo
- if (getPlayerMoney (source) >= cost) then
- takePlayerMoney (source,cost)
- local munition = getPedTotalAmmo ( source )
- local wpn = getPedWeapon ( source, current )
- giveWeaponAmmo ( source, wpn, munition*2 )
- outputChatBox ("Du hast Extra "..id.." für "..cost.." Gekauft !", source, 255,0,0)
- else
- outputChatBox ("Du hast nicht Genug Geld!", source, 255,0,0)
- end
- end
- end
- addEvent ("extraBuy", true)
- addEventHandler ("extraBuy", getRootElement(),extraButton)
Advertisement
Add Comment
Please, Sign In to add comment