opnaiC Posted July 12, 2016 Posted July 12, 2016 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 ?
Bean666 Posted July 12, 2016 Posted July 12, 2016 tell us whats wrong in debugscript 3 and what is this script for or what are u trying to do
opnaiC Posted July 12, 2016 Author Posted July 12, 2016 It should be a police command to get all players that have a wanted level. There is nothing in debugscript ...
xyz Posted July 12, 2016 Posted July 12, 2016 Do you have an actual police team? If so, change it so that team can use it, as that faction thingy might cause problems
Mega9 Posted July 12, 2016 Posted July 12, 2016 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).
Captain Cody Posted July 12, 2016 Posted July 12, 2016 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.
فاّرس Posted July 12, 2016 Posted July 12, 2016 ^ it's >= not => , <= less than or equal to, >= greater than or equal to.
Captain Cody Posted July 12, 2016 Posted July 12, 2016 Oh yeh never mind, that just didn't look right at all.
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