DeVo Posted January 26, 2014 Share Posted January 26, 2014 Hi, I need help plzz with scripting arms dealer resource ... the resource idea :- with /sell u can sell wepons and get money every time player buy from u the problem :- hmmm.., - i wanna make player when he type /sell and he is already selling , the marker disappear and he is unfrozen , - also i wanna make the seller gets money but he can't ... - the gui doesn't open when hitting the marker ... Client-side --Client GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Window[1] = guiCreateWindow(170,126,498,328,"Gun Menu",false) guiSetVisible(GUIEditor_Window[1], false) GUIEditor_Button[1] = guiCreateButton(16,30,219,44,"AK47 - 2000",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(15,84,222,42,"Colt - 500",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(15,135,223,42,"Molotov - 500",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(14,188,224,40,"Sawn Off Shotgun - 1000",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(14,240,225,40,"Shotgun - 500",false,GUIEditor_Window[1]) GUIEditor_Button[6] = guiCreateButton(258,28,219,44,"Uzi - 1000",false,GUIEditor_Window[1]) GUIEditor_Button[7] = guiCreateButton(258,82,219,42,"Tec9 - 1500",false,GUIEditor_Window[1]) GUIEditor_Button[8] = guiCreateButton(255,135,225,42,"Combat Shotgun - 3000",false,GUIEditor_Window[1]) GUIEditor_Button[9] = guiCreateButton(309,279,178,38,"Close",false,GUIEditor_Window[1]) function showGUI ( ) --markerhit guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end function closeGUI ( ) --cancle button guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[9] , closeGUI, false) function buyAK47 () triggerServerEvent("buyAK",localPlayer) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , buyAK47, false) function buyCOLT () triggerServerEvent("buyCOLT",localPlayer) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , buyCOLT, false) function buySHOTTY () triggerServerEvent("buySHOTTY",localPlayer) end addEventHandler("onClientGUIClick", GUIEditor_Button[5] , buySHOTTY, false) function buyMolotov () triggerServerEvent("buyMolotov",localPlayer) end addEventHandler("onClientGUIClick", GUIEditor_Button[3] , buyMolotov, false) function buySAWNOFF () triggerServerEvent("buySAWNOFF",localPlayer) end addEventHandler("onClientGUIClick", GUIEditor_Button[4] , buySAWNOFF, false) function buyUZI () triggerServerEvent("buyUZI",localPlayer) end addEventHandler("onClientGUIClick", GUIEditor_Button[6] , buyUZI, false) function buyTEC9 () triggerServerEvent("buyTEC9",localPlayer) end addEventHandler("onClientGUIClick", GUIEditor_Button[7] , buyTEC9, false) function buyCBSHOTTY () triggerServerEvent("buyCBSHOTTY",localPlayer) end addEventHandler("onClientGUIClick", GUIEditor_Button[8] , buyCBSHOTTY, false) Server-side --server function BuyAK47 ( ) givePlayerMoney ( source, 2000 ) giveWeapon ( source, 30, 200, false ) end addEvent("buyAK", true) addEventHandler("buyAK",root,BuyAK47) function BuyCOLT ( ) givePlayerMoney ( source, 500 ) giveWeapon ( source, 22, 200, false ) end addEvent("buyCOLT", true) addEventHandler("buyCOLT",root,BuyCOLT) function BuySHOTTY ( ) givePlayerMoney ( source, 500 ) giveWeapon ( source, 25, 200, false ) end addEvent("buySHOTTY", true) addEventHandler("buySHOTTY",root,BuySHOTTY) function BuyMOLOTOV ( ) givePlayerMoney ( source, 500 ) giveWeapon ( source, 18, 200, false ) end addEvent("buyMolotov", true) addEventHandler("buyMolotov",root,BuyMOLOTOV) function BuySAWNOFF ( ) givePlayerMoney ( source, 1000 ) giveWeapon ( source, 26, 200, false ) end addEvent("buySAWNOFF", true) addEventHandler("buySAWNOFF",root,BuySAWNOFF) function BuyUZI ( ) givePlayerMoney ( source, 1000 ) giveWeapon ( source, 28, 200, false ) end addEvent("buyUZI", true) addEventHandler("buyUZI",root,BuyUZI) function BuyTEC9 ( ) givePlayerMoney ( source, 1500 ) giveWeapon ( source, 32, 200, false ) end addEvent("buyTEC9", true) addEventHandler("buyTEC9",root,BuyTEC9) function BuyCBSHOTTY ( ) givePlayerMoney ( source, 3000 ) giveWeapon ( source, 27, 200, false ) end addEvent("buyCBSHOTTY", true) addEventHandler("buyCBSHOTTY",root,BuyCBSHOTTY) thearmsmark = {} function openshop(source,command) local x, y, z = getElementPosition ( source ) thearmsmark[source] = createMarker( x, y, z-3, "cylinder", 1.2, 255, 0, 0, 170 ) setElementData(source,"SellingArms", true) setElementData(thearmsmark[source], "ownedby", getPlayerName(source)) thearmsmark[seller] = getElementData ( thearmsmark[source], "ownedby" ) end --[[[function buy(source) local x,y,z = getElementPosition(source) local colshape1 = createColSphere(x-3,y+3,z-4,10) for i,seller in ipairs(getElementsWithinColShape ( colshape1, "player" )) do if getElementData(seller, "SellingArms") == true then if isElementWithinMarker(source, thearmsmark[seller]) then setElementData(source,"BuyingArmsFrom", getPlayerName(seller)) triggerClientEvent(source,"showarmspanelARMS",root) destroyElement(colshape1) else end end end end]]-- function spawnveh ( hitElement, matchingDimension ) if(getElementType( hitElement ) == 'player' ) then triggerClientEvent("showGUI",source) end end sellingPlayers = { } function getbuyer () sellingPlayers [ markerOwner ] = thePlayerWhoHitTheMarker end addCommandHandler("sell", openshop) Link to comment
Anubhav Posted January 26, 2014 Share Posted January 26, 2014 function showGUI ( ) --markerhit createMarker (x,y,z) guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end addEventHandler("onPlayerMarkerHit",source,showGUI) Just use markers. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now