кιηg-αвα∂у Posted October 12, 2012 Share Posted October 12, 2012 (edited) السلام عليكم ممكن تشوفون المشكلة وتحلونها الأكواد خذتها من هنا https://forum.multitheftauto.com/viewtopic.php?f=119&t=47731 هاذه مللف كلينت ---Client--- GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(119,119,815,504,"ShopWeapon By KING-ABADY {Saudi}~{Zombie}",false) -- Below, not original price. It's just strings to the buttons. If you must change the weapon price, go to server-side script. -- Abaixo, as variáveis não são o preço real das armas. É apenas as strings para serem escritas nos botões. Se quer mudar o preço, mude no arquivo server-side. local price_chainsaw = "400" local price_m4 = "250" local price_ak = "200" local price_tec9 = "450" local price_mp5 = "150" local price_knife = "500" local price_uzi = "400" local price_sniper = "250" local price_shotgun = "200" local price_spaz12 = "650" local price_deserteagle = "150" local price_molotovcocktails= "1.000" local price_rifle = "100" local price_satchel = "1.800" local price_grenade = "1.500" GUIEditor_Image[1] = guiCreateStaticImage(203,162,85,78,"images/1.png",false,GUIEditor_Window[1]) GUIEditor_Image[2] = guiCreateStaticImage(28,167,106,68,"images/2.png",false,GUIEditor_Window[1]) GUIEditor_Image[3] = guiCreateStaticImage(505,390,117,61,"images/3.png",false,GUIEditor_Window[1]) GUIEditor_Image[4] = guiCreateStaticImage(684,368,95,87,"images/4.png",false,GUIEditor_Window[1]) GUIEditor_Image[5] = guiCreateStaticImage(60,269,88,78,"images/5.png",false,GUIEditor_Window[1]) GUIEditor_Image[6] = guiCreateStaticImage(199,270,86,81,"images/20.png",false,GUIEditor_Window[1]) GUIEditor_Image[7] = guiCreateStaticImage(320,282,135,59,"images/25.png",false,GUIEditor_Window[1]) GUIEditor_Image[8] = guiCreateStaticImage(541,266,70,84,"images/26.png",false,GUIEditor_Window[1]) GUIEditor_Image[9] = guiCreateStaticImage(32,403,125,66,"images/28.png",false,GUIEditor_Window[1]) GUIEditor_Image[10] = guiCreateStaticImage(189,377,129,87,"images/29.png",false,GUIEditor_Window[1]) GUIEditor_Image[11] = guiCreateStaticImage(336,400,117,63,"images/27.png",false,GUIEditor_Window[1]) GUIEditor_Image[12] = guiCreateStaticImage(326,172,136,62,"images/30.png",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(9,149,803,15,"___________________________________________________________________________________________________________________",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,0,255) GUIEditor_Label[2] = guiCreateLabel(9,258,803,15,"___________________________________________________________________________________________________________________",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,255,0) GUIEditor_Image[13] = guiCreateStaticImage(493,171,153,56,"images/31.png",false,GUIEditor_Window[1]) GUIEditor_Image[14] = guiCreateStaticImage(652,273,127,70,"images/32.png",false,GUIEditor_Window[1]) GUIEditor_Image[15] = guiCreateStaticImage(683,166,113,70,"images/33.png",false,GUIEditor_Window[1]) btn_buy_deserteagle = guiCreateButton(61,240,83,23,"150$",false,GUIEditor_Window[1]) btn_buy_knife = guiCreateButton(200,239,83,23,"500$",false,GUIEditor_Window[1]) btn_buy_ak = guiCreateButton(359,239,83,23,"200$",false,GUIEditor_Window[1]) btn_buy_m4 = guiCreateButton(546,239,83,23,"250$",false,GUIEditor_Window[1]) btn_buy_mb5 = guiCreateButton(707,239,83,23,"150$",false,GUIEditor_Window[1]) btn_buy_grenade = guiCreateButton(58,352,83,23,"1500$",false,GUIEditor_Window[1]) btn_buy_uzi = guiCreateButton(200,352,83,23,"400$",false,GUIEditor_Window[1]) btn_buy_rifle = guiCreateButton(360,352,83,23,"100$",false,GUIEditor_Window[1]) btn_buy_molotovcocktails = guiCreateButton(546,351,83,23,"1000$",false,GUIEditor_Window[1]) btn_buy_tec9 = guiCreateButton(709,350,70,23,"450$",false,GUIEditor_Window[1]) btn_buy_spaz12 = guiCreateButton(61,467,83,23,"650$",false,GUIEditor_Window[1]) btn_buy_sniper = guiCreateButton(200,464,83,23,"250$",false,GUIEditor_Window[1]) btn_buy_shotgun = guiCreateButton(361,461,83,23,"200$",false,GUIEditor_Window[1]) btn_buy_chainsaw = guiCreateButton(547,460,83,23,"400$",false,GUIEditor_Window[1]) btn_buy_satchel = guiCreateButton(708,460,83,23,"1800$",false,GUIEditor_Window[1]) addEventHandler("onClientGUIClick", btn_buy_chainsaw, 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_deserteagle, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_molotovcocktails, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_rifle, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_satchel, BuyWeapon) addEventHandler("onClientGUIClick", btn_buy_grenade, BuyWeapon) guiWindowSetSizable(ShopWindow,false) guiSetVisible(ShopWindow,false) end addEventHandler("onClientResourceStart", getRootElement(), CreateShopWindow) function BuyWeapon(button, state) if (button == "left") then if(source == btn_buy_chainsaw) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_chainsaw") 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_deserteagle) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_deserteagle") elseif(source == btn_buy_molotovcocktails) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_molotovcocktails") 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 GUIEditor_Image[16] = guiCreateStaticImage(45,19,122,110,"images/H.png",false,GUIEditor_Window[1]) GUIEditor_Image[17] = guiCreateStaticImage(330,16,123,119,"images/A.png",false,GUIEditor_Window[1]) GUIEditor_Image[18] = guiCreateStaticImage(486,15,131,121,"images/J.png",false,GUIEditor_Window[1]) GUIEditor_Image[19] = guiCreateStaticImage(187,17,124,117,"images/M.png",false,GUIEditor_Window[1]) GUIEditor_Image[20] = guiCreateStaticImage(653,13,129,127,"images/S.png",false,GUIEditor_Window[1]) GUIEditor_Button[16] = guiCreateButton(63,125,82,27,"1000$",false,GUIEditor_Window[1]) GUIEditor_Button[17] = guiCreateButton(209,126,82,27,"2000$",false,GUIEditor_Window[1]) GUIEditor_Button[18] = guiCreateButton(355,125,82,27,"1500$",false,GUIEditor_Window[1]) GUIEditor_Button[19] = guiCreateButton(514,125,82,27,"2000$",false,GUIEditor_Window[1]) GUIEditor_Button[20] = guiCreateButton(677,125,82,27,"3000$",false,GUIEditor_Window[1]) GUIEditor_Label[3] = guiCreateLabel(10,371,804,22,"___________________________________________________________________________________________________________________",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[3],255,0,0) ---Server--- function BuyWeaponOnServer(weapon_name) player_money = getPlayerMoney(source) player_account = getPlayerAccount(source) local price_chainsaw = "400" local price_m4 = "250" local price_ak = "200" local price_tec9 = "450" local price_mp5 = "150" local price_knife = "500" local price_uzi = "400" local price_sniper = "250" local price_shotgun = "200" local price_spaz12 = "650" local price_deserteagle = "150" local price_molotovcocktails= "1.000" local price_rifle = "100" local price_satchel = "1.800" local price_grenade = "1.500" if(getAccountData(player_account, "GunLicense") == true) then if(weapon_name == "weapon_chainsaw") then if(player_money >= tonumber(price_chainsaw)) then giveWeapon(source, 9) takePlayerMoney(source, tonumber(price_chainsaw)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_m4") then if(player_money >= tonumber(price_m4)) then giveWeapon(source, 31, 450) takePlayerMoney(source, tonumber(price_m4)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_ak") then if(player_money >= tonumber(price_ak)) then giveWeapon(source, 30, 450) takePlayerMoney(source, tonumber(price_ak)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_tec9") then if(player_money >= tonumber(price_tec9)) then giveWeapon(source, 32, 450) takePlayerMoney(source, tonumber(price_tec9)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_mp5") then if(player_money >= tonumber(price_mp5)) then giveWeapon(source, 29, 450) takePlayerMoney(source, tonumber(price_mp5)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", 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("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_uzi") then if(player_money >= tonumber(price_uzi)) then giveWeapon(source, 28, 450) takePlayerMoney(source, tonumber(price_uzi)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_sniper") then if(player_money >= tonumber(price_sniper)) then giveWeapon(source, 34, 450) takePlayerMoney(source, tonumber(price_sniper)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_shotgun") then if(player_money >= tonumber(price_shotgun)) then giveWeapon(source, 25, 450) takePlayerMoney(source, tonumber(price_shotgun)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_spaz12") then if(player_money >= tonumber(price_spaz12)) then giveWeapon(source, 27, 450) takePlayerMoney(source, tonumber(price_spaz12)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_deserteagle") then if(player_money >= tonumber(price_deserteagle)) then giveWeapon(source, 24, 450) takePlayerMoney(source, tonumber(price_deserteagle)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_molotovcocktails") then if(player_money >= tonumber(price_molotovcocktails)) then giveWeapon(source, 18, 10) takePlayerMoney(source, tonumber(price_molotovcocktails)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_rifle") then if(player_money >= tonumber(price_rifle)) then giveWeapon(source, 33, 200) takePlayerMoney(source, tonumber(price_rifle)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_satchel") then if(player_money >= tonumber(price_satchel)) then giveWeapon(source, 39, 10) takePlayerMoney(source, tonumber(price_satchel)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_grenade") then if(player_money >= tonumber(price_grenade)) then giveWeapon(source, 16, 10) takePlayerMoney(source, tonumber(price_grenade)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end end end end addEvent("onClientBuyWeapon", true) addEventHandler("onClientBuyWeapon", getRootElement(), BuyWeaponOnServer) Edited October 12, 2012 by Guest Link to comment
Mr.T9 Posted October 12, 2012 Share Posted October 12, 2012 استخدم الطريقة البسيطه اسهل لك Link to comment
TAPL Posted October 12, 2012 Share Posted October 12, 2012 -- Client Side -- GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(119,119,815,504,"ShopWeapon By KING-ABADY {Saudi}~{Zombie}",false) guiWindowSetSizable(GUIEditor_Window[1],false) -- guiSetVisible(GUIEditor_Window[1],false) GUIEditor_Image[1] = guiCreateStaticImage(203,162,85,78,"images/1.png",false,GUIEditor_Window[1]) GUIEditor_Image[2] = guiCreateStaticImage(28,167,106,68,"images/2.png",false,GUIEditor_Window[1]) GUIEditor_Image[3] = guiCreateStaticImage(505,390,117,61,"images/3.png",false,GUIEditor_Window[1]) GUIEditor_Image[4] = guiCreateStaticImage(684,368,95,87,"images/4.png",false,GUIEditor_Window[1]) GUIEditor_Image[5] = guiCreateStaticImage(60,269,88,78,"images/5.png",false,GUIEditor_Window[1]) GUIEditor_Image[6] = guiCreateStaticImage(199,270,86,81,"images/20.png",false,GUIEditor_Window[1]) GUIEditor_Image[7] = guiCreateStaticImage(320,282,135,59,"images/25.png",false,GUIEditor_Window[1]) GUIEditor_Image[8] = guiCreateStaticImage(541,266,70,84,"images/26.png",false,GUIEditor_Window[1]) GUIEditor_Image[9] = guiCreateStaticImage(32,403,125,66,"images/28.png",false,GUIEditor_Window[1]) GUIEditor_Image[10] = guiCreateStaticImage(189,377,129,87,"images/29.png",false,GUIEditor_Window[1]) GUIEditor_Image[11] = guiCreateStaticImage(336,400,117,63,"images/27.png",false,GUIEditor_Window[1]) GUIEditor_Image[12] = guiCreateStaticImage(326,172,136,62,"images/30.png",false,GUIEditor_Window[1]) GUIEditor_Image[13] = guiCreateStaticImage(493,171,153,56,"images/31.png",false,GUIEditor_Window[1]) GUIEditor_Image[14] = guiCreateStaticImage(652,273,127,70,"images/32.png",false,GUIEditor_Window[1]) GUIEditor_Image[15] = guiCreateStaticImage(683,166,113,70,"images/33.png",false,GUIEditor_Window[1]) GUIEditor_Image[16] = guiCreateStaticImage(45,19,122,110,"images/H.png",false,GUIEditor_Window[1]) GUIEditor_Image[17] = guiCreateStaticImage(330,16,123,119,"images/A.png",false,GUIEditor_Window[1]) GUIEditor_Image[18] = guiCreateStaticImage(486,15,131,121,"images/J.png",false,GUIEditor_Window[1]) GUIEditor_Image[19] = guiCreateStaticImage(187,17,124,117,"images/M.png",false,GUIEditor_Window[1]) GUIEditor_Image[20] = guiCreateStaticImage(653,13,129,127,"images/S.png",false,GUIEditor_Window[1]) GUIEditor_Button[16] = guiCreateButton(63,125,82,27,"1000$",false,GUIEditor_Window[1]) GUIEditor_Button[17] = guiCreateButton(209,126,82,27,"2000$",false,GUIEditor_Window[1]) GUIEditor_Button[18] = guiCreateButton(355,125,82,27,"1500$",false,GUIEditor_Window[1]) GUIEditor_Button[19] = guiCreateButton(514,125,82,27,"2000$",false,GUIEditor_Window[1]) GUIEditor_Button[20] = guiCreateButton(677,125,82,27,"3000$",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(9,149,803,15,"___________________________________________________________________________________________________________________",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,0,255) GUIEditor_Label[2] = guiCreateLabel(9,258,803,15,"___________________________________________________________________________________________________________________",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,255,0) GUIEditor_Label[3] = guiCreateLabel(10,371,804,22,"___________________________________________________________________________________________________________________",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[3],255,0,0) btn_buy_deserteagle = guiCreateButton(61,240,83,23,"150$",false,GUIEditor_Window[1]) btn_buy_knife = guiCreateButton(200,239,83,23,"500$",false,GUIEditor_Window[1]) btn_buy_ak = guiCreateButton(359,239,83,23,"200$",false,GUIEditor_Window[1]) btn_buy_m4 = guiCreateButton(546,239,83,23,"250$",false,GUIEditor_Window[1]) btn_buy_mp5 = guiCreateButton(707,239,83,23,"150$",false,GUIEditor_Window[1]) btn_buy_grenade = guiCreateButton(58,352,83,23,"1500$",false,GUIEditor_Window[1]) btn_buy_uzi = guiCreateButton(200,352,83,23,"400$",false,GUIEditor_Window[1]) btn_buy_rifle = guiCreateButton(360,352,83,23,"100$",false,GUIEditor_Window[1]) btn_buy_molotovcocktails = guiCreateButton(546,351,83,23,"1000$",false,GUIEditor_Window[1]) btn_buy_tec9 = guiCreateButton(709,350,70,23,"450$",false,GUIEditor_Window[1]) btn_buy_spaz12 = guiCreateButton(61,467,83,23,"650$",false,GUIEditor_Window[1]) btn_buy_sniper = guiCreateButton(200,464,83,23,"250$",false,GUIEditor_Window[1]) btn_buy_shotgun = guiCreateButton(361,461,83,23,"200$",false,GUIEditor_Window[1]) btn_buy_chainsaw = guiCreateButton(547,460,83,23,"400$",false,GUIEditor_Window[1]) btn_buy_satchel = guiCreateButton(708,460,83,23,"1800$",false,GUIEditor_Window[1]) function BuyWeapon(button, state) if (button == "left") then if(source == btn_buy_chainsaw) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_chainsaw") 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_deserteagle) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_deserteagle") elseif(source == btn_buy_molotovcocktails) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_molotovcocktails") 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 addEventHandler("onClientGUIClick", root, BuyWeapon) -- Server Side -- local price_chainsaw = "400" local price_m4 = "250" local price_ak = "200" local price_tec9 = "450" local price_mp5 = "150" local price_knife = "500" local price_uzi = "400" local price_sniper = "250" local price_shotgun = "200" local price_spaz12 = "650" local price_deserteagle = "150" local price_molotovcocktails= "1000" local price_rifle = "100" local price_satchel = "1800" local price_grenade = "1500" function BuyWeaponOnServer(weapon_name) local player_money = getPlayerMoney(source) local player_account = getPlayerAccount(source) if(getAccountData(player_account, "GunLicense") == true) then if(weapon_name == "weapon_chainsaw") then if(player_money >= tonumber(price_chainsaw)) then giveWeapon(source, 9) takePlayerMoney(source, tonumber(price_chainsaw)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_m4") then if(player_money >= tonumber(price_m4)) then giveWeapon(source, 31, 450) takePlayerMoney(source, tonumber(price_m4)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_ak") then if(player_money >= tonumber(price_ak)) then giveWeapon(source, 30, 450) takePlayerMoney(source, tonumber(price_ak)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_tec9") then if(player_money >= tonumber(price_tec9)) then giveWeapon(source, 32, 450) takePlayerMoney(source, tonumber(price_tec9)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_mp5") then if(player_money >= tonumber(price_mp5)) then giveWeapon(source, 29, 450) takePlayerMoney(source, tonumber(price_mp5)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", 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("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_uzi") then if(player_money >= tonumber(price_uzi)) then giveWeapon(source, 28, 450) takePlayerMoney(source, tonumber(price_uzi)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_sniper") then if(player_money >= tonumber(price_sniper)) then giveWeapon(source, 34, 450) takePlayerMoney(source, tonumber(price_sniper)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_shotgun") then if(player_money >= tonumber(price_shotgun)) then giveWeapon(source, 25, 450) takePlayerMoney(source, tonumber(price_shotgun)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_spaz12") then if(player_money >= tonumber(price_spaz12)) then giveWeapon(source, 27, 450) takePlayerMoney(source, tonumber(price_spaz12)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_deserteagle") then if(player_money >= tonumber(price_deserteagle)) then giveWeapon(source, 24, 450) takePlayerMoney(source, tonumber(price_deserteagle)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_molotovcocktails") then if(player_money >= tonumber(price_molotovcocktails)) then giveWeapon(source, 18, 10) takePlayerMoney(source, tonumber(price_molotovcocktails)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_rifle") then if(player_money >= tonumber(price_rifle)) then giveWeapon(source, 33, 200) takePlayerMoney(source, tonumber(price_rifle)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_satchel") then if(player_money >= tonumber(price_satchel)) then giveWeapon(source, 39, 10) takePlayerMoney(source, tonumber(price_satchel)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_grenade") then if(player_money >= tonumber(price_grenade)) then giveWeapon(source, 16, 10) takePlayerMoney(source, tonumber(price_grenade)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end end end end addEvent("onClientBuyWeapon", true) addEventHandler("onClientBuyWeapon", root, BuyWeaponOnServer) Link to comment
кιηg-αвα∂у Posted October 12, 2012 Author Share Posted October 12, 2012 تابل حطيت الأكواد حقتك ولما اضغط على شي ابي اشتريه مايصير شي ويطلع كذا [2012-10-12 23:07:09] ERROR: Client triggered serverside event onClientBuyWeapon, but event is not added serverside Link to comment
кιηg-αвα∂у Posted October 12, 2012 Author Share Posted October 12, 2012 حط الميتا <meta> <info name="Weapon Shop" author="Ninguem , Stanley Sathler" description="" version="2.0.1" type="script"></info> <script src="client.lua" type="client"></script> <file src="images/1.png" /> <file src="images/2.png" /> <file src="images/3.png" /> <file src="images/4.png" /> <file src="images/5.png" /> <file src="images/20.png" /> <file src="images/25.png" /> <file src="images/26.png" /> <file src="images/27.png" /> <file src="images/28.png" /> <file src="images/29.png" /> <file src="images/30.png" /> <file src="images/31.png" /> <file src="images/32.png" /> <file src="images/33.png" /> <file src="images/H.png" /> <file src="images/A.png" /> <file src="images/S.png" /> <file src="images/J.png" /> <file src="images/M.png" /> </meta> وش دخل الميتا اتوقع الخطأ في ربط سيرفر معه كلينت Link to comment
кιηg-αвα∂у Posted October 12, 2012 Author Share Posted October 12, 2012 تابل ممكن تضيفني عشان نتواصل اسرع [email protected] او كلمني هنا http://sync.in/YGRyMG2iKl Link to comment
TAPL Posted October 12, 2012 Share Posted October 12, 2012 حط الميتا <meta> <info name="Weapon Shop" author="Ninguem , Stanley Sathler" description="" version="2.0.1" type="script"></info> <script src="client.lua" type="client"></script> <file src="images/1.png" /> <file src="images/2.png" /> <file src="images/3.png" /> <file src="images/4.png" /> <file src="images/5.png" /> <file src="images/20.png" /> <file src="images/25.png" /> <file src="images/26.png" /> <file src="images/27.png" /> <file src="images/28.png" /> <file src="images/29.png" /> <file src="images/30.png" /> <file src="images/31.png" /> <file src="images/32.png" /> <file src="images/33.png" /> <file src="images/H.png" /> <file src="images/A.png" /> <file src="images/S.png" /> <file src="images/J.png" /> <file src="images/M.png" /> </meta> وش دخل الميتا اتوقع الخطأ في ربط سيرفر معه كلينت أنت مو حاط ملف السيرفر بالميتا "Weapon Shop" author="Ninguem , Stanley Sathler" description="" version="2.0.1" type="script"> Link to comment
кιηg-αвα∂у Posted October 12, 2012 Author Share Posted October 12, 2012 عدلت الميتا الخطأ بين ربط ملف سيرفر معه كلينت بس مو عارف وين Link to comment
TAPL Posted October 12, 2012 Share Posted October 12, 2012 -- Server Side -- local price_chainsaw = "400" local price_m4 = "250" local price_ak = "200" local price_tec9 = "450" local price_mp5 = "150" local price_knife = "500" local price_uzi = "400" local price_sniper = "250" local price_shotgun = "200" local price_spaz12 = "650" local price_deserteagle = "150" local price_molotovcocktails= "1000" local price_rifle = "100" local price_satchel = "1800" local price_grenade = "1500" function BuyWeaponOnServer(weapon_name) local player_money = getPlayerMoney(source) if(weapon_name == "weapon_chainsaw") then if(player_money >= tonumber(price_chainsaw)) then giveWeapon(source, 9) takePlayerMoney(source, tonumber(price_chainsaw)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_m4") then if(player_money >= tonumber(price_m4)) then giveWeapon(source, 31, 450) takePlayerMoney(source, tonumber(price_m4)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_ak") then if(player_money >= tonumber(price_ak)) then giveWeapon(source, 30, 450) takePlayerMoney(source, tonumber(price_ak)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_tec9") then if(player_money >= tonumber(price_tec9)) then giveWeapon(source, 32, 450) takePlayerMoney(source, tonumber(price_tec9)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_mp5") then if(player_money >= tonumber(price_mp5)) then giveWeapon(source, 29, 450) takePlayerMoney(source, tonumber(price_mp5)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", 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("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_uzi") then if(player_money >= tonumber(price_uzi)) then giveWeapon(source, 28, 450) takePlayerMoney(source, tonumber(price_uzi)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_sniper") then if(player_money >= tonumber(price_sniper)) then giveWeapon(source, 34, 450) takePlayerMoney(source, tonumber(price_sniper)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_shotgun") then if(player_money >= tonumber(price_shotgun)) then giveWeapon(source, 25, 450) takePlayerMoney(source, tonumber(price_shotgun)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_spaz12") then if(player_money >= tonumber(price_spaz12)) then giveWeapon(source, 27, 450) takePlayerMoney(source, tonumber(price_spaz12)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_deserteagle") then if(player_money >= tonumber(price_deserteagle)) then giveWeapon(source, 24, 450) takePlayerMoney(source, tonumber(price_deserteagle)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_molotovcocktails") then if(player_money >= tonumber(price_molotovcocktails)) then giveWeapon(source, 18, 10) takePlayerMoney(source, tonumber(price_molotovcocktails)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_rifle") then if(player_money >= tonumber(price_rifle)) then giveWeapon(source, 33, 200) takePlayerMoney(source, tonumber(price_rifle)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_satchel") then if(player_money >= tonumber(price_satchel)) then giveWeapon(source, 39, 10) takePlayerMoney(source, tonumber(price_satchel)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end elseif(weapon_name == "weapon_grenade") then if(player_money >= tonumber(price_grenade)) then giveWeapon(source, 16, 10) takePlayerMoney(source, tonumber(price_grenade)) outputChatBox("لقد اشتريت السلاح.", source, 0, 255, 0) else outputChatBox("لاتملك المال الكافي للشراء.", source, 255, 0, 0) end end end addEvent("onClientBuyWeapon", true) addEventHandler("onClientBuyWeapon", root, BuyWeaponOnServer) -- Client Side -- GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(119,119,815,504,"ShopWeapon By KING-ABADY {Saudi}~{Zombie}",false) guiWindowSetSizable(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[1],false) GUIEditor_Image[1] = guiCreateStaticImage(203,162,85,78,"images/1.png",false,GUIEditor_Window[1]) GUIEditor_Image[2] = guiCreateStaticImage(28,167,106,68,"images/2.png",false,GUIEditor_Window[1]) GUIEditor_Image[3] = guiCreateStaticImage(505,390,117,61,"images/3.png",false,GUIEditor_Window[1]) GUIEditor_Image[4] = guiCreateStaticImage(684,368,95,87,"images/4.png",false,GUIEditor_Window[1]) GUIEditor_Image[5] = guiCreateStaticImage(60,269,88,78,"images/5.png",false,GUIEditor_Window[1]) GUIEditor_Image[6] = guiCreateStaticImage(199,270,86,81,"images/20.png",false,GUIEditor_Window[1]) GUIEditor_Image[7] = guiCreateStaticImage(320,282,135,59,"images/25.png",false,GUIEditor_Window[1]) GUIEditor_Image[8] = guiCreateStaticImage(541,266,70,84,"images/26.png",false,GUIEditor_Window[1]) GUIEditor_Image[9] = guiCreateStaticImage(32,403,125,66,"images/28.png",false,GUIEditor_Window[1]) GUIEditor_Image[10] = guiCreateStaticImage(189,377,129,87,"images/29.png",false,GUIEditor_Window[1]) GUIEditor_Image[11] = guiCreateStaticImage(336,400,117,63,"images/27.png",false,GUIEditor_Window[1]) GUIEditor_Image[12] = guiCreateStaticImage(326,172,136,62,"images/30.png",false,GUIEditor_Window[1]) GUIEditor_Image[13] = guiCreateStaticImage(493,171,153,56,"images/31.png",false,GUIEditor_Window[1]) GUIEditor_Image[14] = guiCreateStaticImage(652,273,127,70,"images/32.png",false,GUIEditor_Window[1]) GUIEditor_Image[15] = guiCreateStaticImage(683,166,113,70,"images/33.png",false,GUIEditor_Window[1]) GUIEditor_Image[16] = guiCreateStaticImage(45,19,122,110,"images/H.png",false,GUIEditor_Window[1]) GUIEditor_Image[17] = guiCreateStaticImage(330,16,123,119,"images/A.png",false,GUIEditor_Window[1]) GUIEditor_Image[18] = guiCreateStaticImage(486,15,131,121,"images/J.png",false,GUIEditor_Window[1]) GUIEditor_Image[19] = guiCreateStaticImage(187,17,124,117,"images/M.png",false,GUIEditor_Window[1]) GUIEditor_Image[20] = guiCreateStaticImage(653,13,129,127,"images/S.png",false,GUIEditor_Window[1]) GUIEditor_Button[16] = guiCreateButton(63,125,82,27,"1000$",false,GUIEditor_Window[1]) GUIEditor_Button[17] = guiCreateButton(209,126,82,27,"2000$",false,GUIEditor_Window[1]) GUIEditor_Button[18] = guiCreateButton(355,125,82,27,"1500$",false,GUIEditor_Window[1]) GUIEditor_Button[19] = guiCreateButton(514,125,82,27,"2000$",false,GUIEditor_Window[1]) speed = guiCreateButton(677,125,82,27,"3000$",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(9,149,803,15,"___________________________________________________________________________________________________________________",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,0,255) GUIEditor_Label[2] = guiCreateLabel(9,258,803,15,"___________________________________________________________________________________________________________________",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,255,0) GUIEditor_Label[3] = guiCreateLabel(10,371,804,22,"___________________________________________________________________________________________________________________",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[3],255,0,0) btn_buy_deserteagle = guiCreateButton(61,240,83,23,"150$",false,GUIEditor_Window[1]) btn_buy_knife = guiCreateButton(200,239,83,23,"500$",false,GUIEditor_Window[1]) btn_buy_ak = guiCreateButton(359,239,83,23,"200$",false,GUIEditor_Window[1]) btn_buy_m4 = guiCreateButton(546,239,83,23,"250$",false,GUIEditor_Window[1]) btn_buy_mp5 = guiCreateButton(707,239,83,23,"150$",false,GUIEditor_Window[1]) btn_buy_grenade = guiCreateButton(58,352,83,23,"1500$",false,GUIEditor_Window[1]) btn_buy_uzi = guiCreateButton(200,352,83,23,"400$",false,GUIEditor_Window[1]) btn_buy_rifle = guiCreateButton(360,352,83,23,"100$",false,GUIEditor_Window[1]) btn_buy_molotovcocktails = guiCreateButton(546,351,83,23,"1000$",false,GUIEditor_Window[1]) btn_buy_tec9 = guiCreateButton(709,350,70,23,"450$",false,GUIEditor_Window[1]) btn_buy_spaz12 = guiCreateButton(61,467,83,23,"650$",false,GUIEditor_Window[1]) btn_buy_sniper = guiCreateButton(200,464,83,23,"250$",false,GUIEditor_Window[1]) btn_buy_shotgun = guiCreateButton(361,461,83,23,"200$",false,GUIEditor_Window[1]) btn_buy_chainsaw = guiCreateButton(547,460,83,23,"400$",false,GUIEditor_Window[1]) btn_buy_satchel = guiCreateButton(708,460,83,23,"1800$",false,GUIEditor_Window[1]) function BuyWeapon(button, state) if (button == "left") then if(source == btn_buy_chainsaw) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_chainsaw") 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_deserteagle) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_deserteagle") elseif(source == btn_buy_molotovcocktails) then triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_molotovcocktails") 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 addEventHandler("onClientGUIClick", root, BuyWeapon) bindKey("F2", "down", function() guiSetVisible(GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) showCursor(guiGetVisible(GUIEditor_Window[1])) guiSetInputEnabled(guiGetVisible(GUIEditor_Window[1])) end) Link to comment
кιηg-αвα∂у Posted October 12, 2012 Author Share Posted October 12, 2012 كفووووووووووووووووو والله تابل مشكور والله يعطيك الف عافيه 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