Jump to content

set Player Wanted


Farhan

Recommended Posts

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

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

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