Jump to content

Admin godmode bug


Linttamummo

Recommended Posts

hi, i have bug on my admingodmode bug. when i do "/gostaff", everything goes well. But here is one problem, that the everyone can use this command, not only admins. I want this to work, but here is everytime this bug.. So, help me please :)!

server.lua:

function togglestaffMode(thePlayer)

local account = getPlayerAccount(thePlayer)

if (not account or isGuestAccount(account)) then return end

local accountName = getAccountName(account)

if ( isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Admin" ) ) ) then

if getElementData(thePlayer,"invincible") then

setElementData(thePlayer,"invincible",false)

outputChatBox("god mode off",thePlayer,255,255,255)

else

setElementData(thePlayer,"invincible",true)

outputChatBox("god mode on",thePlayer,255,255,255)

end

end

end

addCommandHandler("gostaff",togglestaffMode)

server1.lua:

function createTeamsOnStart ()

teamstaff = createTeam ( "Admins", 255, 255, 255 )

end

addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart)

function lol ( player, command )

setPlayerTeam ( player, teamstaff )

setPlayerSkin(player, 217)

giveWeapon (player, 38, 9999)

giveWeapon (player, 8, 1)

end

addCommandHandler ( "gostaff", lol )

Link to comment
function createTeamsOnStart ( ) 
    teamstaff = createTeam ( "Admins", 255, 255, 255 ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, createTeamsOnStart ) 
  
function togglestaffMode ( thePlayer ) 
    local account = getPlayerAccount ( thePlayer ) 
    if ( not account or isGuestAccount ( account ) ) then 
        return 
    end 
  
    local accountName = getAccountName ( account ) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then 
        local state = ( not getElementData ( thePlayer, "invincible" ) ) 
        outputChatBox ( "God mode ".. ( state and "on" or "off" ), thePlayer, 255, 255, 255 ) 
        setElementData ( thePlayer, "invincible", state ) 
        if ( state ) then 
            setPlayerTeam ( thePlayer, teamstaff ) 
            setElementModel ( thePlayer, 217 ) 
            giveWeapon ( thePlayer, 38, 9999 ) 
            giveWeapon ( thePlayer, 8, 1 ) 
        end 
    end 
end 
addCommandHandler ( "gostaff", togglestaffMode ) 

Link to comment
  • 4 weeks later...

Hi, your script that you made for me was awesome. But here is one thing that i want to change. It is that godmode, I want this script without it, but I cant do it, it fails always. The point I mean on this, is that I want to create new team without godmode, like the team that can be used for a gangs. Here is my version, but I don't know where is the fail:

function createTeamsOnStart ( ) 
    teamstaff = createTeam ( "AMIS", 226,8,246 ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, createTeamsOnStart ) 
  
function togglestaffMode ( thePlayer ) 
    local account = getPlayerAccount ( thePlayer ) 
    if ( not account or isGuestAccount ( account ) ) then 
    outputChatBox ( "Pääsy estetty.", thePlayer, 226,8,246 ) 
        return 
    end 
  
    local accountName = getAccountName ( account ) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "amis" ) ) ) then     
        outputChatBox ( "SPAWNASIT JUURI AMIKSEKSI.", thePlayer, 226,8,246 )             
            setPlayerTeam ( thePlayer, teamstaff ) 
            setPlayerNametagColor ( thePlayer, 226,8,246 ) 
            spawnPlayer ( thePlayer, 1460, 2779, 11 ) 
            setElementModel ( thePlayer, 29 ) 
            giveWeapon ( thePlayer, 5, 1 ) 
            giveWeapon ( thePlayer, 22, 250 ) 
            giveWeapon ( thePlayer, 25, 100 ) 
            giveWeapon ( thePlayer, 32, 215 ) 
            giveWeapon ( thePlayer, 34, 15 ) 
        end 
addCommandHandler ( "amis", togglestaffMode ) 

and the other thing that I want to have, is to leave the team back to as a "freeroam" team, so then thePlayer is not in any team. addCommandhandler would be /leaveteam. Thanks for you guys from big help, big thanks for Castillo! :)

Link to comment
function createTeamsOnStart ( ) 
    teamstaff = createTeam ( "AMIS", 226,8,246 ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, createTeamsOnStart ) 
  
function togglestaffMode ( thePlayer ) 
    local account = getPlayerAccount ( thePlayer ) 
    if ( not account or isGuestAccount ( account ) ) then 
        outputChatBox ( "Pääsy estetty.", thePlayer, 226,8,246 ) 
        return 
    end 
  
    local accountName = getAccountName ( account ) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "amis" ) ) ) then    
        outputChatBox ( "SPAWNASIT JUURI AMIKSEKSI.", thePlayer, 226,8,246 )            
        setPlayerTeam ( thePlayer, teamstaff ) 
        setPlayerNametagColor ( thePlayer, 226,8,246 ) 
        spawnPlayer ( thePlayer, 1460, 2779, 11 ) 
        setElementModel ( thePlayer, 29 ) 
        giveWeapon ( thePlayer, 5, 1 ) 
        giveWeapon ( thePlayer, 22, 250 ) 
        giveWeapon ( thePlayer, 25, 100 ) 
        giveWeapon ( thePlayer, 32, 215 ) 
        giveWeapon ( thePlayer, 34, 15 ) 
    end 
end 
addCommandHandler ( "amis", togglestaffMode ) 

You had a missing 'end'

P.S: I didn't understand the freeroam team part.

Link to comment

The script that i want to is like that: When you type /leave, the command kicks you out of current team. You cant go out of team without anything like that. Its perfect for playing "offduty" without gang team :D. So it just kick you out of current team, then team is nil / no one. You are example on team "Admins" You want to play offduty, but you cant do that. You can only remove yourself out of team with adminpanel. So i want command that anyone can use to remove himself out of the current team. sorry bad english :)

Link to comment

Wiki example.

function unassignTeam ( source, commandName ) 
  local theTeam = getPlayerTeam ( source )  -- Check if the player is on a team 
  if theTeam then                          -- this player is on a team, so we can remove them from it 
    setPlayerTeam ( source, nil )    -- remove the player from the current team 
  end 
end 
addCommandHandler ( "takeawaymyteam", unassignTeam ) 

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