Jump to content

bartje01

Members
  • Posts

    208
  • Joined

  • Last visited

Posts posted by bartje01

  1. WHere is the easy part of that :P

    Didn't worked btw:(

    In my console no errors or warnings

    In my script editor there are errors:

    ')'Expected (to close '(' at line 45) near 'end'

    '' expected near 'end'

    ')' expected (to close '(' at line 53) near 'setPlayerMoney'

    Btw. Why setPlayerMoney?:P

    I didn't need that with element date cash right?

  2. [2011-03-06 23:18:16] WARNING: testmode\server.lua:25: Bad argument @ 'getElementData'

    And it must be there.

    My whole script

      
    function onLoginSetCash ( ) 
        if not isGuestAccount ( getPlayerAccount ( source ) ) then 
            if getElementData ( source, "data.cash" ) then 
                outputChatBox ( "You're cash is transfered back!", source ) 
            else 
                setElementData ( source, "data.cash", 0 ) 
                outputChatBox ( "You're new and your cash will now be saved." ) 
            end 
        end 
    end 
      
    function onWastedSetCash ( ) 
        if not isGuestAccount ( getPlayerAccount ( source ) ) then 
            local getPlayerCash = getElementData ( source, "data.cash" ) 
            setElementData ( source, "data.cash", getPlayerCash + 100 ) 
            outputChatBox ( "You got 100$ for your death.", source ) 
        end 
    end 
      
    addEventHandler ( "onPlayerLogin", root, onLoginSetCash ) 
    addEventHandler ( "onPlayerWasted", root, onWastedSetCash ) 
      
      
    function myCash ( thePlayer ) 
          local cash = getElementData ( source, "data.cash" ) 
          outputChatBox ( "Your cash is: " .. tostring ( cash ), thePlayer ) 
    end 
    addCommandHandler ( "cash", myCash ) 
      
    

  3. Thanks for helping but,

    We're using element data cash now.

    You can see that in the posts above.

    I've edited it to this now

    function myCash ( thePlayer ) 
      
        local cash = getPlayerCash ( thePlayer ) 
      
        outputChatBox ( "Your cash is: " .. tostring ( cash ), thePlayer ) 
    end 
    addCommandHandler ( "cash", myCash ) 
    

    Just no message shows up

  4. Alright. It shows me the outputchatbox texts.

    But will this save? Even when I reconnect?

    And can someone help me making the cmd to check my cash?

    I tried:

      
    function myCash ( thePlayer, commandName ) 
      
        local cash = getPlayerCash ( thePlayer ) 
      
        outputChatBox ( "Your cash is: " .. cash, thePlayer ) 
    end 
    addCommandHandler ( "cash", myCash ) 
      
    

    And failed. No message shows up when I type /cash

    Thank you very much Proracer

  5. Aaah proracer. I see. I already noticed that there was no money bar in the right cornor of the game.

    But can you please give an example on how to do this? Or send me the right wiki page?

    Because when I know how to make element data cash I can do much more.

  6. Hey guys,. Sorry that I'm asking something again but I want to save money but it doesn't work

    I've got no errors

      
    function onPlayerQuit ( ) 
          -- when a player leaves, store his current money amount in his account data 
          local playeraccount = getPlayerAccount ( source ) 
          if ( playeraccount ) then 
                local playermoney = getPlayerMoney ( source ) 
                setAccountData ( playeraccount, "savemoney.money", playermoney ) 
          end 
    end 
      
    function onPlayerLogin ( ) 
          -- when a player joins, retrieve his money amount from his account data and set it 
          local playeraccount = getPlayerAccount ( source ) 
          if ( playeraccount ) then 
                local playermoney = getAccountData ( playeraccount, "savemoney.money" ) 
                -- make sure there was actually a value saved under this key (check if playermoney is not false). 
                -- this will for example not be the case when a player plays the gametype for the first time 
                if ( playermoney ) then 
                      setPlayerMoney ( source, playermoney ) 
                end 
          end 
    end 
      
      
    addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) 
    addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) 
      
    

    Please help

  7. Hey guys.

    I'm trying to make a createteam command here.

      
    function createATeam ( source, commandName, teamName ) 
      local newTeam = createTeam ( teamName ) 
    end 
    addCommandHandler ( "createteam", createATeam) 
      
    

    No errors or warnings.

    Itj ust has no effect. :*(

  8. Awesome it works now :D With your last code.

    But

    It only works in the kill list

    In the chat box my name is still white :(

    Can I chagne that as well?

    Thanks by the way

    PS

    I noticed the friend list is yours.

    Well it's so damn awesome xD

  9. Hey guys, I'm making a /namecolor command so people can set their name color.

    I've followed instructions from the wiki here.

      
    function nametagColorChange ( thePlayer, commandName, r, g, b ) 
    setPlayerNametagColor ( thePlayer, r, g, b ) 
    outputChatBox("HINT:/namecolor  [Colorid 0-250]") 
    end 
    addCommandHandler ( "namecolor", nametagColorChange) 
      
    

    WARNING: race\race_server.lua:1431: Bad argument @ 'setPlayerNametagColor'

    It sends me the message: Hint:/namecolor [colorid 0-250]

    So I know it must be something with this line

    setPlayerNametagColor ( thePlayer, r, g, b )

    So what could it be?

    Thanks

  10. Alright, my apologise. But I didn't mean that you're a stupid guy though.

    Well. I've really read the basics. I did it more times. Because a little while ago I was a bit into scripting MTA as well.

    I just couldn't find it.

    Sorry.

×
×
  • Create New...