ViRuZGamiing Posted February 1, 2013 Share Posted February 1, 2013 Hi, I have a problem with connecting Client with Server script; Client-sided function CreateShopWindow() ShopWindow = guiCreateWindow(350,250,450,320,"Ammunation",false) guiCreateLabel(35,35,250,60,"To buy weapons u need a license:$55.000",false,ShopWindow) btn_buy_license = guiCreateButton(270,33,135,20,"License for Weapons",false,ShopWindow) local price_porrete = "2.500" local price_m4 = "2.500" local price_ak = "2.500" local price_tec9 = "2.500" local price_mp5 = "2.500" local price_knife = "2.500" local price_uzi = "2.500" local price_sniper = "2.500" local price_shotgun = "2.500" local price_spaz12 = "2.500" local price_pistol = "2.500" local price_teargas = "2.500" local price_rifle = "2.500" local price_satchel = "2.500" local price_grenade = "2.500" btn_buy_porrete = guiCreateButton(29,140,60,15,price_porrete,false,ShopWindow) btn_buy_m4 = guiCreateButton(109,140,60,15,price_m4,false,ShopWindow) btn_buy_ak = guiCreateButton(189,140,60,15,price_ak,false,ShopWindow) btn_buy_tec9 = guiCreateButton(269,140,60,15,price_tec9,false,ShopWindow) btn_buy_mp5 = guiCreateButton(349,140,60,15,price_mp5,false,ShopWindow) btn_buy_knife = guiCreateButton(29,220,60,15,price_knife,false,ShopWindow) btn_buy_uzi = guiCreateButton(109,220,60,15,price_uzi,false,ShopWindow) btn_buy_sniper = guiCreateButton(189,220,60,15,price_sniper,false,ShopWindow) btn_buy_shotgun = guiCreateButton(269,220,60,15,price_shotgun,false,ShopWindow) btn_buy_spaz12 = guiCreateButton(349,220,60,15,price_spaz12,false,ShopWindow) btn_buy_pistol = guiCreateButton(29,295,60,15,price_pistol,false,ShopWindow) btn_buy_teargas = guiCreateButton(109,295,60,15,price_teargas,false,ShopWindow) btn_buy_rifle = guiCreateButton(189,295,60,15,price_rifle,false,ShopWindow) btn_buy_satchel = guiCreateButton(269,295,60,15,price_satchel,false,ShopWindow) btn_buy_grenade = guiCreateButton(349,295,60,15,price_grenade,false,ShopWindow) addEventHandler("onClientGUIClick", btn_buy_porrete, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_m4, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_ak, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_tec9, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_mp5, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_knife, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_uzi, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_sniper, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_shotgun, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_spaz12, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_pistol, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_teargas, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_rifle, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_satchel, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_grenade, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_license, BuyLicense) guiCreateMemo(25,60,405,15," ",false,ShopWindow) guiCreateStaticImage(30,80,60,60,"imagens/3.png", false,ShopWindow ) guiCreateStaticImage(110,80,60,60,"imagens/31.png", false,ShopWindow ) guiCreateStaticImage(190,80,60,60,"imagens/30.png", false,ShopWindow ) guiCreateStaticImage(270,80,60,60,"imagens/32.png", false,ShopWindow ) guiCreateStaticImage(350,80,60,60,"imagens/33.png", false,ShopWindow ) guiCreateStaticImage(30,160,60,60,"imagens/1.png", false,ShopWindow ) guiCreateStaticImage(110,160,60,60,"imagens/20.png", false,ShopWindow ) guiCreateStaticImage(270,160,60,60,"imagens/27.png", false,ShopWindow ) guiCreateStaticImage(350,160,60,60,"imagens/28.png", false,ShopWindow ) guiCreateStaticImage(190,160,60,60,"imagens/29.png", false,ShopWindow ) guiCreateStaticImage(30,240,60,60,"imagens/2.png", false,ShopWindow ) guiCreateStaticImage(110,240,60,60,"imagens/26.png", false,ShopWindow ) guiCreateStaticImage(190,240,60,60,"imagens/25.png", false,ShopWindow ) guiCreateStaticImage(270,240,60,60,"imagens/4.png", false,ShopWindow ) guiCreateStaticImage(350,240,60,60,"imagens/5.png", false,ShopWindow ) guiWindowSetSizable(ShopWindow,false) guiSetVisible(ShopWindow,false) end addEventHandler("onClientResourceStart", getRootElement(), CreateShopWindow) function BuyWeapon(button, state) if (button == "left") then if(source == btn_buy_porrete) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_porrete") elseif(source == btn_buy_m4) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_m4") elseif(source == btn_buy_ak) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_ak") elseif(source == btn_buy_tec9) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_tec9") elseif(source == btn_buy_mp5) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_mp5") elseif(source == btn_buy_knife) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_knife") elseif(source == btn_buy_uzi) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_uzi") elseif(source == btn_buy_sniper) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_sniper") elseif(source == btn_buy_shotgun) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_shotgun") elseif(source == btn_buy_spaz12) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_spaz12") elseif(source == btn_buy_pistol) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_pistol") elseif(source == btn_buy_teargas) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_teargas") elseif(source == btn_buy_rifle) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_rifle") elseif(source == btn_buy_satchel) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_satchel") elseif(source == btn_buy_grenade) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_grenade") end end end function BuyLicense(button) if(button == "left" and source == btn_buy_license) then triggerServerEvent("onClientBuyLicense", localPlayer) end end function ShowGUI ( ) guiSetVisible ( ShopWindow, not guiGetVisible ( ShopWindow ) ) showCursor ( not isCursorShowing( ) ) end Server-sided function BuyWeaponOnServer(weapon_name) player_money = getPlayerMoney(source) player_account = getPlayerAccount(source) local price_porrete = "2500" local price_m4 = "2500" local price_ak = "2500" local price_tec9 = "2500" local price_mp5 = "2500" local price_knife = "2500" local price_uzi = "2500" local price_sniper = "2500" local price_shotgun = "2500" local price_spaz12 = "2500" local price_pistol = "2500" local price_teargas = "2500" local price_rifle = "2500" local price_satchel = "2500" local price_grenade = "2500" if(getAccountData(player_account, "GunLicense") == true) then if(weapon_name == "weapon_porrete") then if(player_money >= tonumber(price_porrete)) then giveWeapon(source, 3) takePlayerMoney(source, tonumber(price_porrete)) outputChatBox("You bought a Nightstick.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a Nightstick.", source, 255, 0, 0) end elseif(weapon_name == "weapon_m4") then if(player_money >= tonumber(price_m4)) then giveWeapon(source, 31, 100) takePlayerMoney(source, tonumber(price_m4)) outputChatBox("You bought an M4.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy an M4.", source, 255, 0, 0) end elseif(weapon_name == "weapon_ak") then if(player_money >= tonumber(price_ak)) then giveWeapon(source, 30, 100) takePlayerMoney(source, tonumber(price_ak)) outputChatBox("You bought an AK-47.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy an AK-47.", source, 255, 0, 0) end elseif(weapon_name == "weapon_tec9") then if(player_money >= tonumber(price_tec9)) then giveWeapon(source, 32, 100) takePlayerMoney(source, tonumber(price_tec9)) outputChatBox("You bought a TEC-9.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a TEC-9.", source, 255, 0, 0) end elseif(weapon_name == "weapon_mp5") then if(player_money >= tonumber(price_mp5)) then giveWeapon(source, 29, 100) takePlayerMoney(source, tonumber(price_mp5)) outputChatBox("You bought an MP5.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy an MP5.", source, 255, 0, 0) end elseif(weapon_name == "weapon_knife") then if(player_money >= tonumber(price_knife)) then giveWeapon(source, 4) takePlayerMoney(source, tonumber(price_knife)) outputChatBox("You bought a knife.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a knife.", source, 255, 0, 0) end elseif(weapon_name == "weapon_uzi") then if(player_money >= tonumber(price_uzi)) then giveWeapon(source, 28, 100) takePlayerMoney(source, tonumber(price_uzi)) outputChatBox("You bought an UZI.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy an UZI.", source, 255, 0, 0) end elseif(weapon_name == "weapon_sniper") then if(player_money >= tonumber(price_sniper)) then giveWeapon(source, 34, 100) takePlayerMoney(source, tonumber(price_sniper)) outputChatBox("You bought a Sniper.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a Sniper.", source, 255, 0, 0) end elseif(weapon_name == "weapon_shotgun") then if(player_money >= tonumber(price_shotgun)) then giveWeapon(source, 25, 100) takePlayerMoney(source, tonumber(price_shotgun)) outputChatBox("You bought a Shotgun.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a Shotgun.", source, 255, 0, 0) end elseif(weapon_name == "weapon_spaz12") then if(player_money >= tonumber(price_spaz12)) then giveWeapon(source, 27, 100) takePlayerMoney(source, tonumber(price_spaz12)) outputChatBox("You bought a SPAZ-12.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a SPAZ-12.", source, 255, 0, 0) end elseif(weapon_name == "weapon_pistol") then if(player_money >= tonumber(price_pistol)) then giveWeapon(source, 22, 100) takePlayerMoney(source, tonumber(price_pistol)) outputChatBox("You bought a Pistol.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a Pistol.", source, 255, 0, 0) end elseif(weapon_name == "weapon_teargas") then if(player_money >= tonumber(price_teargas)) then giveWeapon(source, 17, 1) takePlayerMoney(source, tonumber(price_teargas)) outputChatBox("You bought a teargas", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a teargas.", source, 255, 0, 0) end elseif(weapon_name == "weapon_rifle") then if(player_money >= tonumber(price_rifle)) then giveWeapon(source, 33, 100) takePlayerMoney(source, tonumber(price_rifle)) outputChatBox("You bought a Rifle.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a Rifle.", source, 255, 0, 0) end elseif(weapon_name == "weapon_satchel") then if(player_money >= tonumber(price_satchel)) then giveWeapon(source, 39, 1) takePlayerMoney(source, tonumber(price_satchel)) outputChatBox("You bought a Satchel Charges.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a Satchel Charges.", source, 255, 0, 0) end elseif(weapon_name == "weapon_grenade") then if(player_money >= tonumber(price_grenade)) then giveWeapon(source, 16, 1) takePlayerMoney(source, tonumber(price_grenade)) outputChatBox("You bought a grenade.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a grenade.", source, 255, 0, 0) end end else outputChatBox("You dont have a license to bear arms.", source, 255, 0, 0) end end addEvent("onClientBuyWeapon", true) addEventHandler("onClientBuyWeapon", getRootElement(), BuyWeaponOnServer) function BuyWeaponLicense() player_money = getPlayerMoney(source) player_account = getPlayerAccount(source) local license_price = "55000" if(getAccountData(player_account, "GunLicense") == false) then if(player_money >= tonumber(license_price)) then setAccountData(player_account, "GunLicense", true) takePlayerMoney(source, tonumber(license_price)) outputChatBox("You now have a license to bear arms.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a license to bear arms.", source, 255, 0, 0) end else outputChatBox("You already have a license to bear arms.", source, 255, 0, 0) end end addEvent("onClientBuyLicense", true) addEventHandler("onClientBuyLicense", getRootElement(), BuyWeaponLicense) What I want - I want to add a marker in Interior "7" with this Coordinates; posX="314.20001220703" posY="-133.69999694824" posZ="998.59997558594" rotX="0" rotY="0" rotZ="0" Can some player help me by adding this? I only know how to open it with a bind or command, Already thanks for helping Greetings Billy Link to comment
Castillo Posted February 1, 2013 Share Posted February 1, 2013 Functions: createMarker setElementInterior Event: onClientMarkerHit Link to comment
ViRuZGamiing Posted February 1, 2013 Author Share Posted February 1, 2013 Can this work? function MarkerHit --Function start + name createMarker(314.20001220703, -133.69999694824, 998.59997558594, "arrow", 1, 0, 100, 125, 255) -- Create's the marker (but I don't know if it is in Interior 7 now?!) setElementInterior(Player,7, 314.20001220703, -133.69999694824, 998.59997558594) -- sets the Player to Interior 7 on Marker hit (doesn't need to go to other location only open the GUI) addEventHandler ( "onClientMarkerHit", openGUI, getRootElement(), MarkerHit ) -- on Marker hit opens the GUI Link to comment
ViRuZGamiing Posted February 1, 2013 Author Share Posted February 1, 2013 Can you please fix it? I don't have anymore options and I followed the Wiki's Parameters order Link to comment
Castillo Posted February 1, 2013 Share Posted February 1, 2013 No, you did a mess, try to do it again from scratch. Link to comment
ViRuZGamiing Posted February 1, 2013 Author Share Posted February 1, 2013 Okay maybe someone else will be as kind to help (Example: TA-PL, manve...) Link to comment
Castillo Posted February 1, 2013 Share Posted February 1, 2013 Well, if you don't want to see that I'm helping you, I won't even bother replying. You obviously want others to do things for you, like many people around here, something as simple as this shouldn't be hard at all, you obviously don't pay attention at all. Link to comment
Blaawee Posted February 1, 2013 Share Posted February 1, 2013 don't wait for another one to help u , try to fix it by yourself try to depend on yourself search and look for oldest post Link to comment
iPrestege Posted February 1, 2013 Share Posted February 1, 2013 (edited) -- Try This Should To Work As What I Know : Marker = createMarker ( x,y,z, "cylinder", 1.5, 255, 255, 0, 170 ) setElementInterior ( Marker,id ) addEventHandler ( "onClientMarkerHit", Marker, Int ) function Int(player) -- You,re Code . end @ Solidsnake14 : Just this time will give him full code . Edited February 1, 2013 by Guest Link to comment
Baseplate Posted February 1, 2013 Share Posted February 1, 2013 marker = createMarker(314.20001220703, -133.69999694824, 998.59997558594, "cylinder", 1, 0, 100, 125, 255) setElementInterior(marker, 7) addEventHandler ( "onClientMarkerHit", marker, function(hitElement) -- Do the shit you need here end ) Link to comment
Castillo Posted February 1, 2013 Share Posted February 1, 2013 @Mr.Pres[T]ege: That isn't even what he was looking for, or maybe he didn't explain it right. - I want to add a marker in Interior "7" with this Coordinates; That means that he wants a marker to open the ammunation GUI, not to teleport a player to the interior. Link to comment
iPrestege Posted February 1, 2013 Share Posted February 1, 2013 @Mr.Pres[T]ege:That isn't even what he was looking for, or maybe he didn't explain it right. - I want to add a marker in Interior "7" with this Coordinates; That means that he wants a marker to open the ammunation GUI, not to teleport a player to the interior. Sorry did not read it well, edited anyway, thank you. Link to comment
ViRuZGamiing Posted February 1, 2013 Author Share Posted February 1, 2013 You edited the Post? Link to comment
ViRuZGamiing Posted February 1, 2013 Author Share Posted February 1, 2013 -- Do the :~ you need here What you mean? I need to paste the script here or what? Link to comment
Baseplate Posted February 1, 2013 Share Posted February 1, 2013 marker = createMarker(314.20001220703, -133.69999694824, 998.59997558594, "cylinder", 1, 0, 100, 125, 255) setElementInterior(marker, 7) addEventHandler ( "onClientMarkerHit", marker, function(hitElement) -- Do the :~ you need here end ) This should work. 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