Jump to content

Money check problem


Recommended Posts

    function checkmoney(thePlayer, command) 
        local money = getPlayerMoney(thePlayer) 
        if (money > 199999) then 
            outputChatBox("#FFFF00Your money stat:  #00ff00You are rich ! $" .. tonumber(money), thePlayer,255,255,255,true) 
        else 
        if (money > 999999) then 
            outputChatBox("#FFFF00Your money stat:  #00ff00You are so rich ! $$" .. tonumber(money), thePlayer,255,255,255,true) 
        else     
            outputChatBox("#FFFF00Your money stat:  #FF0000You are poor (Be serious in work) ", thePlayer,255,255,255,true) 
        end 
    end 
    addCommandHandler("checkmoney", checkmoney) 
  

Doesn't run

I want it rich,so rich,poor

Link to comment

try using "elseif", instead of doing "else

if"

Example:

if money > 100 then 
   --code 
elseif money < 100 then 
   --code 
end 

I'll fix this for you:

   function checkmoney(thePlayer, command) 
        local money = getPlayerMoney(thePlayer) 
        if (money > 199999) then 
            outputChatBox("#FFFF00Your money stat:  #00ff00You are rich ! $" .. tonumber(money), thePlayer,255,255,255,true) 
        elseif(money > 999999) then 
            outputChatBox("#FFFF00Your money stat:  #00ff00You are so rich ! $$" .. tonumber(money), thePlayer,255,255,255,true) 
        else    
            outputChatBox("#FFFF00Your money stat:  #FF0000You are poor (Be serious in work) ", thePlayer,255,255,255,true) 
        end 
    end 
    addCommandHandler("checkmoney", checkmoney) 

Plus you forgot to close the last "if" with "end".

Link to comment

He not know lua and doing nonsense .. I written to him. I guess he not want learn.

@teteomar: Well it's you choice. You can not know lua and something in mta scripting and you will ask 1000+ posts to help you with your code. Listen to me. It's not empty words.

Doesn't run

I want it rich,so rich,poor

If you use /debugscript 3 it's said to you about syntax error.

Link to comment
He not know lua and doing nonsense .. I written to him. I guess he not want learn.

@teteomar: Well it's you choice. You can not know lua and something in mta scripting and you will ask 1000+ posts to help you with your code. Listen to me. It's not empty words.

Doesn't run

I want it rich,so rich,poor

If you use /debugscript 3 it's said to you about syntax error.

I did it, Thanks ! it show all my line errors thanks :D

Link to comment
Teteomar, I must agree with Kenix. I saw your other topics, and really, you looks not know Lua. You must learn it.

I must some one learn me lua because Wiki and LUA.org hard explanation if someone want learn me please add me email removed

Remember " Wiki and LUA | hard explanation |

Edited by Guest
Link to comment
try using "elseif", instead of doing "else

if"

Example:

if money > 100 then 
   --code 
elseif money < 100 then 
   --code 
end 

I'll fix this for you:

   function checkmoney(thePlayer, command) 
        local money = getPlayerMoney(thePlayer) 
        if (money > 199999) then 
            outputChatBox("#FFFF00Your money stat:  #00ff00You are rich ! $" .. tonumber(money), thePlayer,255,255,255,true) 
        elseif(money > 999999) then 
            outputChatBox("#FFFF00Your money stat:  #00ff00You are so rich ! $$" .. tonumber(money), thePlayer,255,255,255,true) 
        else    
            outputChatBox("#FFFF00Your money stat:  #FF0000You are poor (Be serious in work) ", thePlayer,255,255,255,true) 
        end 
    end 
    addCommandHandler("checkmoney", checkmoney) 

Plus you forgot to close the last "if" with "end".

Thanks :|

Link to comment
Teteomar, I'm sorry if I'm being rude, but we aren't teachers. If we know, is because we use the Wiki and LUA Manual. Yes, I agree with you: it's hard. But we need try, bro. Read, and read again, and again.

I read it about 41 times each day and i still don't understand

Link to comment

Shadow i was made it by guieditor

take a look

  
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) 
GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) 
GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|PlanetsTrip|=====\nWelcome to the\" Planets trip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Tickets|====\nMoon 50,000$\nMars 64,000$\nVenus 54,000$\nSaturn 75,000$\nMercury 35,000$=====|PlanetsTrip|====",false,GUIEditor_Window[1]) 
  
addEventHandler('guiSetVisible') 
  

And i think it's not alright :\

Link to comment
addEventHandler('guiSetVisible') 

What's that?

  
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) 
GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) 
GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|PlanetsTrip|=====\nWelcome to the\" Planets trip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Tickets|====\nMoon 50,000$\nMars 64,000$\nVenus 54,000$\nSaturn 75,000$\nMercury 35,000$=====|PlanetsTrip|====",false,GUIEditor_Window[1]) 
  
guiSetVisible(GUIEditor_Window[1], false) 
  

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