ayman1998 Posted April 28, 2014 Posted April 28, 2014 هاد كود توب تاع حسن بس ما شتغل اتمنا حد بصلحة addEvent("returnUp",true) addEventHandler("returnUp", root,function(Value) guiGridListClear(GUIEditor.gridlist[1]) local Rank = 0 for _,v in ipairs (Value) do Rank = Rank + 1 local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1,tonumber(Rank), false, false) guiGridListSetItemText(GUIEditor.gridlist[1], row, 2,tostring(v.Name_), false, false) guiGridListSetItemText(GUIEditor.gridlist[1], row, 3,tonumber(v.Money_), false, false) if ( Rank == 30 ) then break; end end end) local ReGet = true setTimer(function() if ( ReGet == true ) then if ( guiGetVisible(wndName) == true ) then triggerServerEvent("Up",getLocalPlayer()) ReGet = false setTimer(function() ReGet = true end,5000,1) end end end,1000,0) addEventHandler ("onResourceStart", getResourceRootElement(getThisResource()),function() executeSQLQuery("CREATE TABLE IF NOT EXISTS SQL_xTop_Money (Name,Account,Money)") end) addEventHandler("onPlayerQuit",getRootElement(),function() local Name = getPlayerName(source) local Account = getAccountName(getPlayerAccount(source)) local Money = getPlayerMoney(source) if not ( Account ) then return end local RowAccount = executeSQLQuery("SELECT * FROM SQL_xTop_Money WHERE Account = '"..tostring(Account).."'") if ( type(RowAccount) == "table" and #RowAccount == 0 or not RowAccount) then executeSQLQuery("INSERT INTO SQL_xTop_Money(Name,Account,Money) VALUES(?,?,?)",tostring(Name),tostring(Account),tonumber(Money)) else executeSQLQuery("UPDATE SQL_xTop_Money SET Name=?,Money=? WHERE Account=?",tostring(Name),tonumber(Money),tostring(Account)) end end) function getAllMoneyUsers() local Row = executeSQLQuery("SELECT * FROM SQL_xTop_Money") if ( type (Row) == "table" and #Row == 0 or not Row ) then return { } else return Row end end addEvent("Up",true) addEventHandler("Up",root,function() local TableUsersTop = {} for _,v in ipairs(getAllMoneyUsers()) do table.insert(TableUsersTop,{Name_ = v.Name,Money_ = v.Money,}) table.sort(TableUsersTop,function (a,b) return (tonumber (a.Money_) or 0 ) > ( tonumber (b.Money_) or 0) end) end triggerClientEvent(source,"returnUp",source,TableUsersTop) end)
ayman1998 Posted April 28, 2014 Author Posted April 28, 2014 هاد كود توب تاع حسن بس ما شتغل اتمنا حد بصلحة مين قال انو الي
#DRAGON!FIRE Posted April 28, 2014 Posted April 28, 2014 انا القصد من كلامي انه ناسخ ولاصق الكود ومو عارف شي والكود صحيح اعتقد .. وش مشكلتكـ ؟
ayman1998 Posted April 29, 2014 Author Posted April 29, 2014 هيك كامل الوحة بتجي لاكن ما يجي فيها اشي GUIEditor = { gridlist = {}, staticimage = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.staticimage[1] = guiCreateStaticImage(393, 38, 464, 451, ":test444/13.png", false) GUIEditor.gridlist[1] = guiCreateGridList(8, 45, 446, 396, false, GUIEditor.staticimage[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Rank", 0.08) guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.5) guiGridListAddColumn(GUIEditor.gridlist[1], "Money", 0.3) end ) addEvent("returnUp",true) addEventHandler("returnUp", root,function(Value) guiGridListClear(GUIEditor.gridlist[1]) local Rank = 0 for _,v in ipairs (Value) do Rank = Rank + 1 local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1,tonumber(Rank), false, false) guiGridListSetItemText(GUIEditor.gridlist[1], row, 2,tostring(v.Name_), false, false) guiGridListSetItemText(GUIEditor.gridlist[1], row, 3,tonumber(v.Money_), false, false) if ( Rank == 30 ) then break; end end end) local ReGet = true setTimer(function() if ( ReGet == true ) then if ( guiGetVisible(wndName) == true ) then triggerServerEvent("Up",getLocalPlayer()) ReGet = false setTimer(function() ReGet = true end,5000,1) end end end,1000,0) addEventHandler ("onResourceStart", getResourceRootElement(getThisResource()),function() executeSQLQuery("CREATE TABLE IF NOT EXISTS SQL_xTop_Money (Name,Account,Money)") end) addEventHandler("onPlayerQuit",getRootElement(),function() local Name = getPlayerName(source) local Account = getAccountName(getPlayerAccount(source)) local Money = getPlayerMoney(source) if not ( Account ) then return end local RowAccount = executeSQLQuery("SELECT * FROM SQL_xTop_Money WHERE Account = '"..tostring(Account).."'") if ( type(RowAccount) == "table" and #RowAccount == 0 or not RowAccount) then executeSQLQuery("INSERT INTO SQL_xTop_Money(Name,Account,Money) VALUES(?,?,?)",tostring(Name),tostring(Account),tonumber(Money)) else executeSQLQuery("UPDATE SQL_xTop_Money SET Name=?,Money=? WHERE Account=?",tostring(Name),tonumber(Money),tostring(Account)) end end) function getAllMoneyUsers() local Row = executeSQLQuery("SELECT * FROM SQL_xTop_Money") if ( type (Row) == "table" and #Row == 0 or not Row ) then return { } else return Row end end addEvent("Up",true) addEventHandler("Up",root,function() local TableUsersTop = {} for _,v in ipairs(getAllMoneyUsers()) do table.insert(TableUsersTop,{Name_ = v.Name,Money_ = v.Money,}) table.sort(TableUsersTop,function (a,b) return (tonumber (a.Money_) or 0 ) > ( tonumber (b.Money_) or 0) end) end triggerClientEvent(source,"returnUp",source,TableUsersTop) end)
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