Search the Community
Showing results for tags 'اصحاب الرد السريع'.
-
السلام عليكم ورحمة الله وبركاتة function RGBToHex(red, green, blue) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) ) then return nil end return string.format("#%.2X%.2X%.2X", red,green,blue) end function outputChat(text,who,r,g,b) local color = RGBToHex(r,g,b) --exports["vMZ-TopBar"]:sendClientMessage ("#98AFC7[Market System] "..color..""..text.."",who,r,g,b,true) outputChatBox ("#98AFC7[Market System] "..color..""..text.."",who,r,g,b,true) end addEventHandler( "onResourceStart", resourceRoot, function () ModerMarketDB = dbConnect("sqlite","Market.db") dbExec(ModerMarketDB, "CREATE TABLE IF NOT EXISTS Market_Trading ( ware, amount, price, player, PlayerAccName )" ) end ); function getAllWareInShop( Player ) local Ware = dbPoll( dbQuery(ModerMarketDB, "SELECT * FROM Market_Trading" ), -1) local WeaponsPlayer = dbPoll( dbQuery(ModerMarketDB, "SELECT * FROM Market_Trading WHERE PlayerAccName=? ", getAccountName(getPlayerAccount(source)) ), -1) for i,v in ipairs(Ware) do if tonumber(v.amount) <= 0 then dbExec(ModerMarketDB, "DELETE FROM Market_Trading WHERE ware = ? AND amount = ?",v.ware, v.amount ) end end triggerClientEvent( root, "SetWareInlist", root, Ware ) triggerClientEvent( source, "SetWeaponsPlayerForSale", source, WeaponsPlayer ) end addEvent( "getAllWareInShop", true ) addEventHandler( "getAllWareInShop", root,getAllWareInShop) addEvent( "AddWareToShop", true ) addEventHandler( "AddWareToShop", root, function ( ID, Ammo, price, statr ) local Weapons = dbPoll( dbQuery(ModerMarketDB, "SELECT * FROM Market_Trading WHERE ware=? AND PlayerAccName=? ",ID, getAccountName(getPlayerAccount(source)) ), -1) if ( type (Weapons) == "table" and #Weapons == 0 or not Weapons ) then dbExec(ModerMarketDB, "INSERT INTO Market_Trading (ware,amount,price,player,PlayerAccName) VALUES(?,?,?,?,?) ", ID, Ammo, price , getPlayerName ( source ),getAccountName(getPlayerAccount(source)) ) else local NewAmmo = tonumber ( Weapons[1]["amount"] ) + tonumber ( Ammo ) dbExec(ModerMarketDB, "UPDATE Market_Trading SET amount=? WHERE ware = ? AND PlayerAccName = ?",NewAmmo, ID, getAccountName(getPlayerAccount(source))) end getAllWareInShop( source ) if statr == "Weapon" then takeWeapon(source,ID,Ammo) else setElementData(source,ID,(getElementData(source,ID) or 0 ) - tonumber ( Ammo )) end outputChat("You Have Putted "..ID.." Amount : "..Ammo.." on market By $"..price.."",source,0,255,0) end ); addEvent( "RemoveWareToShop", true ) addEventHandler( "RemoveWareToShop", root, function ( ID, Ammo, statr ) dbExec(ModerMarketDB, "DELETE FROM Market_Trading WHERE ware = ? AND PlayerAccName = ?",ID , getAccountName(getPlayerAccount(source))) if statr == "Weapon" then giveWeapon(source,ID,Ammo) else setElementData(source,ID,(getElementData(source,ID) or 0 ) + tonumber ( Ammo )) end getAllWareInShop( source ) end ); addEvent( "BuyWareInmarket", true ) addEventHandler( "BuyWareInmarket", root, function ( name, ID, Ammo, Money, TotalAmmo, statr ) if getPlayerMoney ( source ) >= tonumber ( Money ) then local Player = getPlayerFromName ( name ) local accName = getAccountName(getPlayerAccount(Player)) givePlayerMoney ( Player, tonumber ( Money ) ) getElementData(localPlayer, "Money")( source, tonumber ( Money ) ) if localPlayer == getPlayerFromName ( name ) then outputChatBox("You can not buy from yourself !",255,0,0) return end if statr == "Weapon" then giveWeapon(source,ID,Ammo) outputChat("You Have Bought a weapon "..getWeaponNameFromID ( ID ).." and "..Ammo.." Ammo By $"..Money.." From "..name,source,0,255,0) outputChat(getPlayerName(source).." Has bought a "..getWeaponNameFromID ( ID ).." and "..Ammo.." Ammo By $"..Money,Player,0,255,0) else setElementData(source,ID,(getElementData(source,ID) or 0 ) + tonumber ( Ammo )) outputChat("You Have Bought ( "..Ammo.." "..ID.." ) By $"..Money.." From"..name,source,0,255,0) outputChat(getPlayerName(source).." Has bought From you a ( "..Ammo.." "..ID.." ) By $"..Money.."",Player,0,255,0) end getAllWareInShop( source ) getAllWareInShop( Player ) local NewAmmo = tonumber ( TotalAmmo ) - tonumber ( Ammo ) dbExec( ModerMarketDB, "UPDATE Market_Trading SET amount=? WHERE ware = ? AND PlayerAccName = ?",NewAmmo, ID, accName ) else outputChat("You Don't Have Enough Money .",source,255,0,0) end end ); addEventHandler("onPlayerLogin", root, function () local accName = getAccountName(getPlayerAccount(source)) local Market = dbPoll( dbQuery(ModerMarketDB, "SELECT * FROM Market_Trading "), -1) givePlayerMoney(source,150) if (type(Market) == "table" and #Market == 0) or not Market then return end for i,v in ipairs(Market) do if v.PlayerAccName == accName then dbExec( ModerMarketDB, "UPDATE Market_Trading SET player=? WHERE PlayerAccName=?", getPlayerName(source), accName ) getAllWareInShop( source ) end end end ); addEventHandler("onPlayerChangeNick", root, function (oldNick, newNick) if not isGuestAccount( getPlayerAccount( source ) ) then local accName = getAccountName(getPlayerAccount(source)) local Market = dbPoll( dbQuery(ModerMarketDB, "SELECT * FROM Market_Trading "), -1) if (type(Market) == "table" and #Market == 0) or not Market then return end for i,v in ipairs(Market) do if v.PlayerAccName == accName then dbExec( ModerMarketDB,"UPDATE Market_Trading SET player=? WHERE PlayerAccName=?", newNick, accName) getAllWareInShop( source ) end end end end ); مساعده في تحويل الكود دا من سيرفر الي سيلنت عشان مشكله الفلوس الوهميه كل اما اشغله مو يحسب انه فيه فلوس ودا لينك المود اذا حد يبي يعدلي او يعدلي في الكومنتات شكرا جدا للي هيردكل دا عشان الفلوس في الجيم مود عندي سلينت مو سيرفر لذلك لازم كل المودات كلينت
