Jump to content

[HELP] wanteds command


opnaiC

Recommended Posts

Posted
function wanteds(player) 
    local acc = getPlayerAccount(player) 
    local fac = getAccountData(acc,"Faction") or 0 
        if (tonumber(fac) == 2) then 
            outputChatBox("Список разыскиваемых:", player, 100, 100, 0) 
            for i, v in ipairs(getElementsByType("player")) do 
                if getPlayerWantedLevel(v) >= 1 then 
                    wanted = getPlayerWantedLevel(v) 
                    outputChatBox(""..getPlayerName(v).." Уровень розыска: "..wanted.."", player, 100, 100, 0) 
                end 
            end 
        end 
    end 
addCommandHandler("wanteds", wanteds) 

What is wrong here ?

Posted

Do you have an actual police team? If so, change it so that team can use it, as that faction thingy might cause problems

Posted

When things don't work start debugging your code line by line if needed, the culprit may be your account data that may not be set properly so check what it returns before proceeding further (debug outputs).

Posted

Line 7, = and > are backwards.

if getPlayerWantedLevel(v) => 1 then 

Also line 8, add a local before wanted. Will mess up if alot of people use it in the same time period without local.

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