Wei Posted April 14, 2012 Share Posted April 14, 2012 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
drk Posted April 14, 2012 Share Posted April 14, 2012 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
unknooooown Posted April 14, 2012 Share Posted April 14, 2012 Come on DrakeN.. At least tell him what you did so he can learn from it. Link to comment
drk Posted April 14, 2012 Share Posted April 14, 2012 Wait Wafamade, I found another bugs on his code. I'm recreating it. Link to comment
drk Posted April 14, 2012 Share Posted April 14, 2012 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
Wei Posted April 14, 2012 Author Share Posted April 14, 2012 How can I make now that will teleport me out of interrior ? Link to comment
drk Posted April 14, 2012 Share Posted April 14, 2012 You wanna put the player in his interior again? setElementInterior ( target, 1 ) Link to comment
Wei Posted April 14, 2012 Author Share Posted April 14, 2012 You wanna put the player in his interior again? setElementInterior ( target, 1 ) yyeah ty! Link to comment
Wei Posted April 14, 2012 Author Share Posted April 14, 2012 How can I add it to the script ? Link to comment
drk Posted April 14, 2012 Share Posted April 14, 2012 (edited) 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 April 14, 2012 by Guest Link to comment
Wei Posted April 14, 2012 Author Share Posted April 14, 2012 I mean when automaticaly release Link to comment
drk Posted April 14, 2012 Share Posted April 14, 2012 See my last code from line 8 to 13. Link to comment
Wei Posted April 14, 2012 Author Share Posted April 14, 2012 works fine... but normal world interior id is 0 THANK YOU ! Link to comment
drk Posted April 14, 2012 Share Posted April 14, 2012 Ok, thanks for telling me that. I thought that is 1. THANK YOU ! No problem Link to comment
Wei Posted April 14, 2012 Author Share Posted April 14, 2012 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
Castillo Posted April 14, 2012 Share Posted April 14, 2012 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
Wei Posted April 14, 2012 Author Share Posted April 14, 2012 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
Wei Posted April 14, 2012 Author Share Posted April 14, 2012 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
Kenix Posted April 14, 2012 Share Posted April 14, 2012 (edited) 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 April 14, 2012 by Guest Link to comment
Wei Posted April 14, 2012 Author Share Posted April 14, 2012 works now thanks both !!! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now