joedajoester Posted November 12, 2011 Share Posted November 12, 2011 I need this script to work only for staff, i get an error. getPlayerAccount at argument 1 getAccountName at argument 1 And to output a message if a non staff member tries to do it. function getPlayerFromPartOfName(playerPart) local pl = getPlayerFromName(playerPart) if isElement(pl) then return pl else for i,v in ipairs (getElementsByType ("player")) do if (string.find(getPlayerName(v),playerPart)) then return v end end end end function Jail (player, command, name) local thePlayer = getPlayerFromPartOfName(name) if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",player,255,0,0) return end setElementPosition ( thePlayer, 52, 2483, 21 ) setElementData ( thePlayer, "isJailed", true ) outputChatBox (name.." has been jailed", getRootElement(), 255, 0, 0, true ) end end addCommandHandler("jail",Jail) function Unjail (player, command, name) local thePlayer = getPlayerFromPartOfName(name) if thePlayer then if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",player,255,0,0) return end setElementPosition ( thePlayer, 72, 2484, 16.3 ) setElementData ( thePlayer, "isJailed", false ) outputChatBox (name.." has been unjailed. Be good now, "..name, getRootElement(), 0, 255, 0, true ) end end addCommandHandler("unjail",Unjail) ped1inside = createPed ( 71, 69, 2503, 17) setElementFrozen (ped1inside, false ) setPedRotation (ped1inside, 180) Link to comment
Castillo Posted November 12, 2011 Share Posted November 12, 2011 function getPlayerFromPartOfName(playerPart) local pl = getPlayerFromName(playerPart) if isElement(pl) then return pl else for i,v in ipairs (getElementsByType ("player")) do if (string.find(getPlayerName(v),playerPart)) then return v end end end end function Jail (player, command, name) if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then local thePlayer = getPlayerFromPartOfName(name) if not thePlayer then return end if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",player,255,0,0) return end setElementPosition ( thePlayer, 52, 2483, 21 ) setElementData ( thePlayer, "isJailed", true ) outputChatBox (name.." has been jailed", getRootElement(), 255, 0, 0, true ) end end addCommandHandler("jail",Jail) function Unjail (player, command, name) if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then local thePlayer = getPlayerFromPartOfName(name) if not thePlayer then return end if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",player,255,0,0) return end setElementPosition ( thePlayer, 72, 2484, 16.3 ) setElementData ( thePlayer, "isJailed", false ) outputChatBox (name.." has been unjailed. Be good now, "..name, getRootElement(), 0, 255, 0, true ) end end addCommandHandler("unjail",Unjail) ped1inside = createPed ( 71, 69, 2503, 17) setElementFrozen (ped1inside, false ) setPedRotation (ped1inside, 180) Link to comment
joedajoester Posted November 12, 2011 Author Share Posted November 12, 2011 I tried this so it outputs chatbox when a non staff tries to use the command. It doesnt work function getPlayerFromPartOfName(playerPart) local pl = getPlayerFromName(playerPart) if isElement(pl) then return pl else for i,v in ipairs (getElementsByType ("player")) do if (string.find(getPlayerName(v),playerPart)) then return v end end end end function Jail (player, command, name) if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then local thePlayer = getPlayerFromPartOfName(name) if not thePlayer then outputChatBox (name..",you cannot use this command!", getRootElement(), 255, 0, 0, true ) if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",player,255,0,0) return end setElementPosition ( thePlayer, 52, 2483, 21 ) setElementData ( thePlayer, "isJailed", true ) outputChatBox (name.." has been jailed", getRootElement(), 255, 0, 0, true ) end end addCommandHandler("jail",Jail) function Unjail (player, command, name) if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then local thePlayer = getPlayerFromPartOfName(name) if not thePlayer then return end if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",player,255,0,0) return end setElementPosition ( thePlayer, 72, 2484, 16.3 ) setElementData ( thePlayer, "isJailed", false ) outputChatBox (name.." has been unjailed. Be good now, "..name, getRootElement(), 0, 255, 0, true ) end end addCommandHandler("unjail",Unjail) ped1inside = createPed ( 71, 69, 2503, 17) setElementFrozen (ped1inside, false ) setPedRotation (ped1inside, 180) Link to comment
Castillo Posted November 12, 2011 Share Posted November 12, 2011 (edited) function getPlayerFromPartOfName(playerPart) local pl = getPlayerFromName(playerPart) if isElement(pl) then return pl else for i,v in ipairs (getElementsByType ("player")) do if (string.find(getPlayerName(v),playerPart)) then return v end end end end function Jail (player, command, name) if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then local thePlayer = getPlayerFromPartOfName(name) if not thePlayer then return end if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",player,255,0,0) return end setElementPosition ( thePlayer, 52, 2483, 21 ) setElementData ( thePlayer, "isJailed", true ) outputChatBox (name.." has been jailed", getRootElement(), 255, 0, 0, true ) else outputChatBox ("You cannot use this command!", player, 255, 0, 0, true ) end end addCommandHandler("jail",Jail) function Unjail (player, command, name) if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then local thePlayer = getPlayerFromPartOfName(name) if not thePlayer then return end if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",player,255,0,0) return end setElementPosition ( thePlayer, 72, 2484, 16.3 ) setElementData ( thePlayer, "isJailed", false ) outputChatBox (name.." has been unjailed. Be good now, "..name, getRootElement(), 0, 255, 0, true ) else outputChatBox ("You cannot use this command!", player, 255, 0, 0, true ) end end addCommandHandler("unjail",Unjail) ped1inside = createPed ( 71, 69, 2503, 17) setElementFrozen (ped1inside, false ) setPedRotation (ped1inside, 180) Edited November 12, 2011 by Guest Link to comment
joedajoester Posted November 12, 2011 Author Share Posted November 12, 2011 Doesnt work, end expected too close 'function' at line 14 Link to comment
joedajoester Posted November 12, 2011 Author Share Posted November 12, 2011 Thank you 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