Jump to content

[HELP]Question


Recommended Posts

Hello! I have a faction system for a Roleplay Server, made by me. I know i can use Owl Faction System, but i don't want. Bellow is my script. This is the problem: When i set a guy in a faction with [/setfactionleader <Name> <FactionID>] and he leaves, i doesn't save. And when he reconnects on server i must set him again the leader. How can i make it save? Here is my script.

function makeleader (thePlayer, cmd, targetplayer, fraki)
 local Spielerdersoll = getPlayerFromName(targetplayer)
  local admin = getPlayerAccount(thePlayer)
   if (admin) then
    if getAccountData(admin, "rp.admin") == 3 then
     local Spieleracc = getPlayerAccount(Spielerdersoll)
	  if (Spieleracc) then
	   if fraki == "1" then
	    outputChatBox("#ffffff"..targetplayer.." #ffffffis now the lider of LSPD!", thePlayer,255, 255, 0, true)
		outputChatBox("#990000Admin "..getPlayerName(thePlayer).." #ffffffhas promoted you to the function of LSPD leader!", Spielerdersoll, 255, 255, 0, true)
		setAccountData(Spieleracc, "rp.fraktion", 1)
		setAccountData(Spieleracc, "rp.rank", 7)
        setPlayerTeam(Spielerdersoll, team1)
	   elseif fraki == "2" then
	    outputChatBox("#ffffff"..targetplayer.." #ffffffis now the lider of Grove Street!", thePlayer,255, 255, 0, true)
		outputChatBox("#990000Admin "..getPlayerName(thePlayer).." #ffffffhas promoted you to the function of Grove Street leader!", Spielerdersoll, 255, 255, 0, true)
        setPlayerTeam(Spielerdersoll, team2)
		setAccountData(Spieleracc, "rp.fraktion", 2)
		setAccountData(Spieleracc, "rp.rank", 7)
	   elseif fraki == "0" then
	   	outputChatBox("#ffffffYou set "..targetplayer.." #ffffffto Civilian!", thePlayer,255, 255, 0, true)
		outputChatBox("#990000Admin "..getPlayerName(thePlayer).." #ffffff has demoted you to Civillian.", Spielerdersoll, 255, 255, 255, true)
		setAccountData(Spieleracc, "rp.fraktion", 0)
		setAccountData(Spieleracc, "rp.rank", 0)
	   end
	  else
	   outputChatBox("Player not found!", thePlayer, 255, 0, 0)
	  end
	else
	 outputChatBox("You are not an admin!", thePlayer, 255, 0, 0)
	end
   end
end
addCommandHandler("setfactionleader", makeleader)

 

Link to post

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...