Jump to content

Admin jetpack


Behnam

Recommended Posts

Posted
    function jetpack( thePlayer )
        if doesPedHaveJetPack ( thePlayer ) then -- If the player have a jetpack already, remove it
            removePedJetPack ( thePlayer ) -- Remove the jetpack
            return -- And stop the function here
        end
		
     -- Otherwise, give him one if he has access

     local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then -- Does he have access to Admin functions?
          if not doesPedHaveJetPack ( thePlayer ) then -- If the player doesn't have a jetpack give it.
               givePedJetPack ( thePlayer )  -- Give the jetpack
          end
     end
end

 bindKey ( thePlayer, "j", "down", jetpack)

@Behnam

Posted
2 hours ago, DiGiTal said:

    function jetpack( thePlayer )
        if doesPedHaveJetPack ( thePlayer ) then -- If the player have a jetpack already, remove it
            removePedJetPack ( thePlayer ) -- Remove the jetpack
            return -- And stop the function here
        end
		
     -- Otherwise, give him one if he has access

     local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then -- Does he have access to Admin functions?
          if not doesPedHaveJetPack ( thePlayer ) then -- If the player doesn't have a jetpack give it.
               givePedJetPack ( thePlayer )  -- Give the jetpack
          end
     end
end

 bindKey ( thePlayer, "j", "down", jetpack)

@Behnam

Not Work !

Posted (edited)
function setJetpack (source)
	local acc = getAccountName(getPlayerAccount(source))
	if ( isObjectInACLGroup("user."..acc,aclGetGroup("Admin")) ) then
		if ( doesPedHaveJetPack(source) ) then
			removePedJetPack(source)
			return
		end
		givePedJetPack(source)
	end
end

addEventHandler("onPlayerJoin",getRootElement(),function()
	bindKey(source,"J","down",setJetpack)
end)

try this one

Edited by Erknneto
Posted
2 minutes ago, Erknneto said:

function setJetpack (source)
	local acc = getAccountName(getPlayerAccount(source))
	if ( isObjectInACLGroup("user."..acc,aclGetGroup("Admin")) ) then
		if ( doesPedHaveJetPack(source) ) then
			removePedJetPack(source)
			return
		end
		givePedJetPack(source)
	end
end

addEventHandler("onPlayerJoin",getRootElement(),function()
	bindKey(source,"J","down",setJetpack)
end)

try this one

Server side ?

Posted

You know the bind will only be set if the player joins the server, right? Try to reconnect and check if the bind works.
Or check the debugscript to see if any errors appears.

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