Jump to content

RPG SCRİPT GANG PANEL PROBLEM


orcun99

Recommended Posts

Hi all,

 

my gang panel have a little problem and I can't solve   there is problem:

 

PROBLEM: every time a player tries to be thrown from the gang panel, the player is not seen in the members list, but is not thrown from the gang.

sorry for bad english

 

client.lua

CLİENT


line 54 :   
kickButton = guiCreateButton(0.7989,0.45,0.1721,0.05,"Üyeyi At",true,tabs[2])



line 152 :
addEventHandler("onClientGUIClick", kickButton, kickTrigger, false)


line 471 : 
function kickTrigger(button, state)
	if button == "left" and state == "up" and source == kickButton then
		if localplayerlevel >= client_ganginfo['kickperm'] then
			if guiGridListGetSelectedCount ( memberGrid ) == 5 then
				local row = guiGridListGetSelectedItem(memberGrid)
				local accountname = guiGridListGetItemText(memberGrid, row, accountColumn )
				local chosenplayerlevel = guiGridListGetItemText(memberGrid, row, levelColumn)
				if localplayerlevel > tonumber(chosenplayerlevel) then
					triggerServerEvent("_kickPlayer", getLocalPlayer(), accountname)
				else
					displayError("Sadece senden daha düşük seviyedekileri atabilirsin.!")
				end
			else
				displayError("Lütfen üye seç!")
			end
		end
	end
  
  
  

SERVER.LUA

addEvent("_leaveGang", true)
addEventHandler("_leaveGang", getRootElement(), leaveGang)
function kickPlayer(accountname)
	if getPlayerGang(source) then
		local ganginfo = getGangInfo(getPlayerGang(source))
		local playerlevel = getPlayerLevel(source)
		local gangname = ganginfo['gangname']
		if playerlevel >= tonumber(ganginfo['kickperm']) then
			local dbName = "BDgang_" .. ganginfo['gangname'] .. "_members"
			local playerTo = executeSQLQuery("SELECT * FROM ? WHERE `accountname`=?", dbName, accountname)
			if playerTo[1] then
				if playerlevel > (tonumber(playerTo[1]['level'])) then
					local kickedAccount = getAccount(accountname)
					
					setAccountData(kickedAccount, "gang", false)
					if getAccountPlayer(kickedAccount) then
						setElementData(getAccountPlayer(kickedAccount), "gang", false)
					end
					executeSQLQuery("DELETE FROM ? WHERE `accountname` = ?", dbName, accountname)
					exports.BDcommands:sendMessage(playerTo[1]['lastname'] .. " çeteden çıktı " .. gangname .. ".", 255, 255, 0, root) 
					
					populateGangPanel(source)
				else
					triggerClientEvent(source, "errorDisplay", source, "Hata: Yetkin yok.")
				end
			else
				triggerClientEvent(source, "errorDisplay", source, "Hata: oyuncu bulunamadı.")
				populateGangPanel(source)
			end
		end
	end
end
addEvent("_kickPlayer", true)
addEventHandler("_kickPlayer", getRootElement(), kickPlayer)
function transferLeadership(accountname)
	if getPlayerGang(source) then
		local ganginfo = getGangInfo(getPlayerGang(source))
		local playerlevel = getPlayerLevel(source)
		local gangname = ganginfo['gangname']
		if playerlevel == 5 then
			local dbName = "BDgang_" .. ganginfo['gangname'] .. "_members"
			local playerTo = executeSQLQuery("SELECT * FROM ? WHERE `accountname`=?", dbName, accountname)
			if playerTo[1] then
				local tranferAccount = getAccount(playerTo[1]['accountname'])
				executeSQLQuery("UPDATE ? SET `level` = 4 WHERE `accountname` = ?", dbName, getAccountName(getPlayerAccount(source)))
				executeSQLQuery("UPDATE ? SET `level` = 5 WHERE `accountname` = ?", dbName, accountname)
				populateGangPanel(source)
			else
				triggerClientEvent(source, "errorDisplay", source, "Hata: oyuncu bulunamadı.")
				populateGangPanel(source)
			end
		end
	end
end
addEvent("_transferLeadership", true)
addEventHandler("_transferLeadership", getRootElement(), transferLeadership)
function deleteGang()
	if getPlayerGang(source) then
		local ganginfo = getGangInfo(getPlayerGang(source))
		local gangname = ganginfo['gangname']
		local playerlevel = getPlayerLevel(source)
		if playerlevel >= tonumber(ganginfo['deleteperm']) then
			local dbName = "BDgang_" .. gangname .. "_members"
			local accName = getAccountName(getPlayerAccount(source))
			local players = executeSQLQuery("SELECT * FROM ?", dbName)
			for i, v in ipairs(players) do
				local thisAccount = getAccount(v['accountname'])
				setAccountData(thisAccount, "gang", false)
				if getAccountPlayer(thisAccount) then
				setElementData(getAccountPlayer(thisAccount), "gang", false)
				exports.BDcommands:sendMessage(v['lastname'] .. " çeteden çıktı " .. gangname .. ".", 255, 255, 0, root) 
			end
			
			executeSQLQuery("DELETE FROM `BDgangdb` WHERE `gangname` =?", gangname)
			executeSQLQuery("DROP TABLE ?", dbName)
		end
	end
end
end
addEvent("_deleteGang", true)
addEventHandler("_deleteGang", getRootElement(), deleteGang)

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...