Ximboliex 85 Report post Posted June 19, 2017 (edited) print( "Loading GMSecurity By _ximboliex" ) function CheckIsvalidGM(role) local GMName = GetChaDefaultName(role) if(GetChaGMLv(role) == 99) and GMName == "[GM]Ximboliex" then return 1 else return 0 end end function SecureGMAccount(role,freq,time) if (CheckIsvalidGM(role) == false) then local ChaName = GetChaDefaultName(role) local ChaID = GetChaID2(role) GMNotice("Unauthorized access by "..ChaName.." has been denied. will Banned!!") LG("Hacker", "Kicked Out "..ChaID.."", "\n") Ban(role,1) end end Hook:AddPostHook("cha_timer",SecureGMAccount) function GetChaGMLv(Player) local Name = GetChaDefaultName(Player) local String = "SELECT gm FROM GameDB.dbo.account WHERE act_id IN (SELECT act_id FROM GameDB.dbo.character WHERE cha_name = '"..Name.."')" local Connect, ConnectID = LuaSQL("connect", SQL.GameDB.Host, SQL.GameDB.User, SQL.GameDB.Password) if Connect == SQL_SUCCESS_WITH_INFO then local Success, Query = LuaSQL("query", ConnectID, String) if Success == SQL_SUCCESS_WITH_INFO then local Data = LuaSQL("fetch", ConnectID, Query) LuaSQL("freehandle", ConnectID, Query) LuaSQL("close", ConnectID) return Data["gm"] end end end function Ban(Player,banned)--1 - banned / 0 - unbanned local AccountName = GetActName(Player) local String = "UPDATE AccountServer.dbo.account_login SET ban = "..banned.." WHERE name = '"..AccountName.."'" local Connect, ConnectID = LuaSQL("connect", SQL.GameDB.Host, SQL.GameDB.User, SQL.GameDB.Password) if Connect == SQL_SUCCESS_WITH_INFO then local Success, Query = LuaSQL("query", ConnectID, String) if Success == SQL_SUCCESS_WITH_INFO then local Data = LuaSQL("fetch", ConnectID, Query) LuaSQL("freehandle", ConnectID, Query) LuaSQL("close", ConnectID) KickUser(cha) end end end function KickUser(cha) local pkt = GetPacket() WriteCmd(pkt,1505) SendPacket(cha,pkt) end 1- Need run hook and Gameserver.exe whit LuaSql 2- Make a new file whit extension .lua you can call like you want 3- add this "dofile(GetResPath("script\\extension\name of your file.lua"))" inside skilleffect.lua Enjoy ! Note: I use 2.4 DB can change in 1.x in line gm in 1.x iguess is gm_lv Edited June 20, 2017 by Ximboliex Satan scolded me :( 1 Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted June 19, 2017 You should explain what it does, how to use and requirements if it's you who made. How do a newbie will understand it? Quote Share this post Link to post Share on other sites
AlGhoul 66 Report post Posted June 20, 2017 @Ximboliex and credits goes to whom? ---------------------------------------------------------- @Satan u put some gm names in varaibles, if other gm enter with different name will disconnect Quote Kind regards, AG. Share this post Link to post Share on other sites
Ximboliex 85 Report post Posted June 20, 2017 @J0k3r To @Wrexorfor luasql and me for make sql function 0.o? Quote Share this post Link to post Share on other sites