Jump to content

[HELP] Wantedoff


ville

Recommended Posts

Hi guys im new scripting but no im trying to make /wantedoff. It does change your wanted level to 0, it costs 1k. but i want to make it 1k for only player called Ville. i tested it and it worked for every player.. so can anyone help me :oops:

addCommandHandler("wantedoff", function(pSource) 
         if getAccountName(getPlayerAccount(player)) == "Ville" then 
     elseif getPlayerMoney(pSource) < 1000 then 
          outputChatBox("* Police: You don't have enough money!", pSource, 255, 0, 0) 
     return end 
     outputChatBox("* Police: You are clear now.", pSource, 0,255,0) 
    takePlayerMoney(pSource, 1000) 
   setPlayerWantedLevel(pSource, 0) 
end ) 
  

Link to comment

try now:

addCommandHandler("wantedoff", 
function() 
    if getAccountName(getPlayerAccount(source)) == "Ville" then 
        local money = getPlayerMoney(source) 
        if (money >= 1000) then 
            outputChatBox("* Police: You are clear now.", source, 0,255,0) 
            takePlayerMoney(source, 1000) 
            setPlayerWantedLevel(source, 0) 
        elseif (money < 1000) then 
            outputChatBox("* Police: You don't have enough money!", source, 255, 0, 0) 
        return 
        end 
    end 
end ) 

Link to comment
try now:
addCommandHandler("wantedoff", 
function() 
    if getAccountName(getPlayerAccount(source)) == "Ville" then 
        local money = getPlayerMoney(source) 
        if (money >= 1000) then 
            outputChatBox("* Police: You are clear now.", source, 0,255,0) 
            takePlayerMoney(source, 1000) 
            setPlayerWantedLevel(source, 0) 
        elseif (money < 1000) then 
            outputChatBox("* Police: You don't have enough money!", source, 255, 0, 0) 
        return 
        end 
    end 
end ) 

Now it doesnt work at all.. I get on debugscript: attempt to compare nil with number

Link to comment

Wath about this ?

function takeWantedLvl(player) 
    if getAccountName(getPlayerAccount(player)) == "Ville" then 
        local money = getPlayerMoney(player) 
        if (money >= 1000) then 
            outputChatBox("* Police: You are clear now.", player, 0,255,0) 
            takePlayerMoney(player, 1000) 
            setPlayerWantedLevel(player, 0) 
        elseif (money < 1000) then 
            outputChatBox("* Police: You don't have enough money!", player, 255, 0, 0) 
        end 
    end 
end 
addCommandHandler("wantedoff", takeWantedLvl) 

Link to comment
Wath about this ?
function takeWantedLvl(player) 
    if getAccountName(getPlayerAccount(player)) == "Ville" then 
        local money = getPlayerMoney(player) 
        if (money >= 1000) then 
            outputChatBox("* Police: You are clear now.", player, 0,255,0) 
            takePlayerMoney(player, 1000) 
            setPlayerWantedLevel(player, 0) 
        elseif (money < 1000) then 
            outputChatBox("* Police: You don't have enough money!", player, 255, 0, 0) 
        end 
    end 
end 
addCommandHandler("wantedoff", takeWantedLvl) 

Now its working! Thanks :P

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