Farhan Posted August 2, 2018 Share Posted August 2, 2018 Hi guys ! please give me script for set player wanted ! command : /wanted <playername> <amount> for acl on group ! ------------------------------------------------------------------------------ chat box for admin : You set the wanted to <amount> for <playername> --------------------------------------------------------------------------------- chat box for player: Admin <admin name> your set wanted to <amount> please answer me Link to comment
Dimos7 Posted August 3, 2018 Share Posted August 3, 2018 We are not your selve also you didn't read the forum rules we are here to help you with your code not make it if you want a resource go to community site search it and simple download it Link to comment
xMKHx Posted August 3, 2018 Share Posted August 3, 2018 On 8/3/2018 at 02:17, Dimos7 said: We are not your selve also you didn't read the forum rules we are here to help you with your code not make it if you want a resource go to community site search it and simple download it as @Dimos7 said but i'll help you this time, next time you have to paste your code here or you can search on community try this function setWanted (player, cmd, target, amount) local target_ = getPlayerFromName(target) if target_ then if amount then local acc = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then if (amount == nil) or (amount < 0) or (amount > 6) or (amount == false) or (amount == "") then return outputChatBox("Please enter a valid wanted level", player, 255, 0, 0) end local targetN = getPlayerName(target_) setPlayerWantedLevel(target_, amount) outputChatBox(targetN.."'s wanted level is now "..amount, player, 0, 255 , 0) outputChatBox(getPlayerName(player).." has set your wanted level to "..amount, target_, 0, 255 , 0) else outputChatBox("Sorry, we don't know a person called" .. targetN, player, 255, 0, 0) end end end end addCommandHandler("wanted", setWanted) Link to comment
Farhan Posted August 4, 2018 Author Share Posted August 4, 2018 14 hours ago, xMKHx said: as @Dimos7 said but i'll help you this time, next time you have to paste your code here or you can search on community try this function setWanted (player, cmd, target, amount) local target_ = getPlayerFromName(target) if target_ then if amount then local acc = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then if (amount == nil) or (amount < 0) or (amount > 6) or (amount == false) or (amount == "") then return outputChatBox("Please enter a valid wanted level", player, 255, 0, 0) end local targetN = getPlayerName(target_) setPlayerWantedLevel(target_, amount) outputChatBox(targetN.."'s wanted level is now "..amount, player, 0, 255 , 0) outputChatBox(getPlayerName(player).." has set your wanted level to "..amount, target_, 0, 255 , 0) else outputChatBox("Sorry, we don't know a person called" .. targetN, player, 255, 0, 0) end end end end addCommandHandler("wanted", setWanted) Not work and i need script for acl on my group ! for example : function test(thePlayer) if not ( isPlayerOnGroup ( thePlayer ) ) then outputChatBox("#ff0000[Error]: #ffffffpermission denied", thePlayer, 255, 255, 255, true) return false end outputChatBox("#ffffff Just For Test", thePlayer, 208, 0, 15,true) end addCommandHandler("test", test) Link to comment
xMKHx Posted August 4, 2018 Share Posted August 4, 2018 Here is function as you said and you can export it -- server side function isPlayerInGroup ( player ) local acc = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then return true else return false end end Link to comment
Farhan Posted August 5, 2018 Author Share Posted August 5, 2018 On 8/4/2018 at 13:08, xMKHx said: Here is function as you said and you can export it -- server side function isPlayerInGroup ( player ) local acc = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then return true else return false end end On 8/3/2018 at 21:32, xMKHx said: as @Dimos7 said but i'll help you this time, next time you have to paste your code here or you can search on community try this function setWanted (player, cmd, target, amount) local target_ = getPlayerFromName(target) if target_ then if amount then local acc = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then if (amount == nil) or (amount < 0) or (amount > 6) or (amount == false) or (amount == "") then return outputChatBox("Please enter a valid wanted level", player, 255, 0, 0) end local targetN = getPlayerName(target_) setPlayerWantedLevel(target_, amount) outputChatBox(targetN.."'s wanted level is now "..amount, player, 0, 255 , 0) outputChatBox(getPlayerName(player).." has set your wanted level to "..amount, target_, 0, 255 , 0) else outputChatBox("Sorry, we don't know a person called" .. targetN, player, 255, 0, 0) end end end end addCommandHandler("wanted", setWanted) not work Link to comment
Dimos7 Posted August 5, 2018 Share Posted August 5, 2018 function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function setWanted(thePlayer, cmd, target, amount) local targetPlayer = getPlayerFromPartialName(target) if targetPlayer ~= thePlayer then if isPlayerOnGroup(thePlayer) then if amount < 0 or amount > 6 then outputChatBox("[Error]: wanted level must be from 0 to 6!", thePlayer, 255, 0, 0) else setPlayerWantedLevel(targetPlayer, amount) outputChatBox(targetPlayer.. "wanted level is now "..amount,thePlayer, 0, 255, 0) outputChatBox(getPlayerName(thePlayer).." has set your wanted level to "..amount, targetPlayer, 0, 255, 0) end else outputChatBox("#ff0000[Error]: #ffffffpermission denied", thePlayer, 255, 0, 0, true) end end end addCommandHandler("wanted", setWanted, false, false) try this Link to comment
Farhan Posted August 5, 2018 Author Share Posted August 5, 2018 31 minutes ago, Dimos7 said: function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function setWanted(thePlayer, cmd, target, amount) local targetPlayer = getPlayerFromPartialName(target) if targetPlayer ~= thePlayer then if isPlayerOnGroup(thePlayer) then if amount < 0 or amount > 6 then outputChatBox("[Error]: wanted level must be from 0 to 6!", thePlayer, 255, 0, 0) else setPlayerWantedLevel(targetPlayer, amount) outputChatBox(targetPlayer.. "wanted level is now "..amount,thePlayer, 0, 255, 0) outputChatBox(getPlayerName(thePlayer).." has set your wanted level to "..amount, targetPlayer, 0, 255, 0) end else outputChatBox("#ff0000[Error]: #ffffffpermission denied", thePlayer, 255, 0, 0, true) end end end addCommandHandler("wanted", setWanted, false, false) try this not work Link to comment
Dimos7 Posted August 5, 2018 Share Posted August 5, 2018 function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function setWanted(thePlayer, cmd, target, amount) local targetPlayer = getPlayerFromPartialName(target) if targetPlayer ~= thePlayer then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("admin")) then if amount < 0 or amount > 6 then outputChatBox("[Error]: wanted level must be from 0 to 6!", thePlayer, 255, 0, 0) else setPlayerWantedLevel(targetPlayer, amount) outputChatBox(targetPlayer.. "wanted level is now "..amount,thePlayer, 0, 255, 0) outputChatBox(getPlayerName(thePlayer).." has set your wanted level to "..amount, targetPlayer, 0, 255, 0) end else outputChatBox("#ff0000[Error]: #ffffffpermission denied", thePlayer, 255, 0, 0, true) end end end addCommandHandler("wanted", setWanted, false, false) if not work then you are not admin Link to comment
Farhan Posted August 5, 2018 Author Share Posted August 5, 2018 Error : attempt to call global 'getPlayerFromPartialName' (a nil value) Link to comment
Dimos7 Posted August 5, 2018 Share Posted August 5, 2018 are you sure you type the correct name of the player and it not your name? Link to comment
Farhan Posted August 5, 2018 Author Share Posted August 5, 2018 1 minute ago, Dimos7 said: are you sure you type the correct name of the player and it not your name? yes Link to comment
Dimos7 Posted August 5, 2018 Share Posted August 5, 2018 wired never had that error before are you sure you copy the code i send you? Link to comment
Farhan Posted August 5, 2018 Author Share Posted August 5, 2018 1 minute ago, Dimos7 said: wired never had that error before are you sure you copy the code i send you? do you have Skype ? Link to comment
Dimos7 Posted August 5, 2018 Share Posted August 5, 2018 (edited) i do but you copy the code getPlayerFromPartialName because that function not exist without that code Edited August 5, 2018 by Dimos7 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