Jump to content

Jail Help


Wei

Recommended Posts

It says access denied!

CODE:

function jailBastard(localPlayer, commandName, jailTar) 
    local Bastard = getPlayerFromName(jailTarget) 
    if isStaff(localPlayer) then 
        local Bastardz = getPlayerName(jailTar) 
        setElementInterior ( Bastard, 6 ) 
        setElementPosition (Bastard, 265.21185302734, 77.63591003418, 1001.0390625) 
        setTimer ( setElementPosition, 300000, 1, Bastard, 268.03460693359, 77.43824005127, 1001.03906) 
        outputChatBox ( "You have been jailed !", theNoob, 193, 13, 13 ) 
        outputChatBox ( INFO: getPlayerName(theNoob).." has been jailed for 5 minutes by Admin.", getRootElement(), 255, 0, 0 ) 
        outputDebugString ( getPlayerName(theNoob).." has been jailed !" ) 
    else 
        outputChatBox ("Access denied", localPlayer, 193, 13, 13) 
    end 
end 
  
function unJail (localPlayer, commandName, jailTar) 
    local Bastard = getPlayerFromName(jailTarget) 
    if isStaff(localPlayer) then 
          setElementInterior ( Bastard, 6) 
           setElementPosition ( Bastard, 268.03460693359, 77.43824005127, 1001.03906) 
           outputChatBox ("You have been unjailed !", theNoob, 193, 13, 13) 
     else 
           outputChatBox ("Access denied !", localPlayer, 193, 13, 13) 
     end 
end 
   
addCommandHandler("aj", jailBastard ) 
addCommandHandler("auj", unJail ) 
  
function isStaff(player) 
team = getPlayerTeam(localPlayer) 
if team == getTeamFromName("Staff") then 
return true 
end 
end 

Thanks

Link to comment
function jailBastard(commandName, jailTar) 
    local Bastard = getPlayerFromName(jailTarget) 
    if isStaff(localPlayer) then 
        local Bastardz = getPlayerName(jailTar) 
        setElementInterior ( Bastard, 6 ) 
        setElementPosition (Bastard, 265.21185302734, 77.63591003418, 1001.0390625) 
        setTimer ( setElementPosition, 300000, 1, Bastard, 268.03460693359, 77.43824005127, 1001.03906) 
        outputChatBox ( "You have been jailed !", theNoob, 193, 13, 13 ) 
        outputChatBox ( INFO: getPlayerName(theNoob).." has been jailed for 5 minutes by Admin.", getRootElement(), 255, 0, 0 ) 
        outputDebugString ( getPlayerName(theNoob).." has been jailed !" ) 
    else 
        outputChatBox ("Access denied", localPlayer, 193, 13, 13) 
    end 
end 
  
function unJail (commandName, jailTar) 
    local Bastard = getPlayerFromName(jailTarget) 
    if isStaff(localPlayer) then 
          setElementInterior ( Bastard, 6) 
           setElementPosition ( Bastard, 268.03460693359, 77.43824005127, 1001.03906) 
           outputChatBox ("You have been unjailed !", theNoob, 193, 13, 13) 
     else 
           outputChatBox ("Access denied !", localPlayer, 193, 13, 13) 
     end 
end 
   
addCommandHandler("aj", jailBastard ) 
addCommandHandler("auj", unJail ) 
  
isStaff = function ( uPlayer ) 
    if ( getTeamName ( getPlayerTeam ( uPlayer ) ) == getTeamFromName ( 'Staff' ) ) then  
        return true; 
    end 
end 

Link to comment
addCommandHandler ( 'aj',  
    function ( sCommand, uTarget, nTime ) 
        if ( isStaff ( localPlayer ) ) then  
            nTime = nTime * 60 * 1000 
            local target = getPlayerFromName ( uTarget ); 
            setElementInterior ( target, 6 ); 
            setElementPosition ( target, 265.21185302734, 77.63591003418, 1001.0390625 ); 
            setTimer ( setElementPosition, nTime, 1, target, 268.03460693359, 77.43824005127, 1001.03906 ); 
            outputChatBox ( 'You have been jailed!', target, 193, 13, 13 ); 
            outputChatBox ( 'INFO: ' .. getPlayerName ( target ) .. ' has been jailed for 5 minutes by Admin.', root, 255, 0, 0 ); 
            outputDebugString ( getPlayerName ( target ) .. ' has been jailed!' ); 
        else 
            outputChatBox ( 'Acess denied to the command!', localPlayer, 193, 13, 13 ); 
        end 
    end 
) 
  
addCommandHandler ( 'auj', 
    function ( sCommand, uTarget ) 
        if ( isStaff ( localPlayer ) ) then  
            local target = getPlayerFromName ( uTarget ); 
            setElementInterior ( target, 6 ); 
            setElementPosition ( target, 268.03460693359, 77.43824005127, 1001.03906 ); 
            outputChatBox ( 'You have been unjailed!', target, 193, 13, 13 ); 
        else 
            outputChatBox ( 'Acess denied to the command!', localPlayer, 193, 13, 13 ) 
        end 
    end 
) 
  
isStaff = function ( uPlayer ) 
    if ( getTeamName ( getPlayerTeam ( uPlayer ) ) == getTeamFromName ( 'Staff' ) ) then  
        return true; 
    else 
        return false; 
    end 
end 

Here.

You got a lot of errors in the code:

You used localPlayer to get team in "isStaff" function and you haven't used player parameter instead ( that's why you get Acess denied ).

You forgot somethings in the outputChatBox too.

I added a thing in your code. Type /aj

You can easily remove if you don't want: Just remove nTime parameter, nTime declaration and change time parameter in setTimer to the time you want.

Link to comment
addCommandHandler ( 'aj',  
    function ( sCommand, uTarget, nTime ) 
        if ( isStaff ( localPlayer ) ) then  
            nTime = nTime * 60 * 1000 
            local target = getPlayerFromName ( uTarget ); 
            setElementInterior ( target, 6 ); 
            setElementPosition ( target, 265.21185302734, 77.63591003418, 1001.0390625 ); 
            setTimer (  
                function ( uTarget ) 
                    setElementPosition ( uTarget, 268.03460693359, 77.43824005127, 1001.03906 ); 
                    setElementInterior ( uTarget, 1 ); 
                end, 
            nTime, 1, target ) 
            outputChatBox ( 'You have been jailed!', target, 193, 13, 13 ); 
            outputChatBox ( 'INFO: ' .. getPlayerName ( target ) .. ' has been jailed for 5 minutes by Admin.', root, 255, 0, 0 ); 
            outputDebugString ( getPlayerName ( target ) .. ' has been jailed!' ); 
        else 
            outputChatBox ( 'Acess denied to the command!', localPlayer, 193, 13, 13 ); 
        end 
    end 
) 
  
addCommandHandler ( 'auj', 
    function ( sCommand, uTarget ) 
        if ( isStaff ( localPlayer ) ) then  
            local target = getPlayerFromName ( uTarget ); 
            setElementInterior ( target, 1 ); 
            setElementPosition ( target, 268.03460693359, 77.43824005127, 1001.03906 ); 
            outputChatBox ( 'You have been unjailed!', target, 193, 13, 13 ); 
        else 
            outputChatBox ( 'Acess denied to the command!', localPlayer, 193, 13, 13 ) 
        end 
    end 
) 
  
isStaff = function ( uPlayer ) 
    if ( getTeamName ( getPlayerTeam ( uPlayer ) ) == getTeamFromName ( 'Staff' ) ) then  
        return true; 
    else 
        return false; 
    end 
end 

See line 22. Changed to set interior 1.

Edited by Guest
Link to comment

What's the problem here ?

addCommandHandler ( 'aaa', 
    function ( sCommand, thePlayer ) 
        if ( isStaff ( thePlayer ) ) then 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
        else 
            outputChatBox ( 'Acess denied!', localPlayer, 193, 13, 13 ) 
        end 
    end 
) 
  
  

WARNING: shit\afk.lua:33: Bad argument @ 'getPlayerTeam'

It says access denied

Link to comment
addCommandHandler ( 'aaa', 
    function ( thePlayer, sCommand ) -- First argument is the player who executed the command ( just server side ). 
        if ( isStaff ( thePlayer ) ) then 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
        else 
            outputChatBox ( 'Access denied!', thePlayer, 193, 13, 13 ) 
        end 
    end 
) 

Link to comment
addCommandHandler ( 'aaa', 
    function ( thePlayer, sCommand ) -- First argument is the player who executed the command ( just server side ). 
        if ( isStaff ( thePlayer ) ) then 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
            outputChatBox ( 'ADMIN HELP HERE', thePlayer, 193, 13, 13 ); 
        else 
            outputChatBox ( 'Access denied!', thePlayer, 193, 13, 13 ) 
        end 
    end 
) 

thanks ! But is still the same

Link to comment
Show function 'isStaff'.
isStaff = function ( thePlayer ) 
team = getPlayerTeam(localPlayer) 
if team == getTeamFromName("Staff") then 
        return true; 
    else 
        return false; 
    end 
end 

It works for jail...

Link to comment

:/

localPlayer used only in client side!

isStaff = function ( uPlayer ) 
    local uTeam = getPlayerTeam( uPlayer ) 
    if not uTeam then 
        return false 
    end 
    if uTeam == getTeamFromName 'Staff' then 
        return true 
    end 
    return false 
end 

Read my post about predefined variables..

Edited by Guest
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...