Jump to content

Setting Stats


Guest Chudy

Recommended Posts

What's wrong with this code?

function setFullStats ( player ) 
    setPlayerStat ( player, 22, 999.0 ) 
    setPlayerStat ( player, 24, 999.0 ) 
    setPlayerStat ( player, 25, 999.0 ) 
    setPlayerStat ( player, 69, 999.0 ) 
    setPlayerStat ( player, 70, 999.0 ) 
    setPlayerStat ( player, 71, 999.0 ) 
    setPlayerStat ( player, 72, 999.0 ) 
    setPlayerStat ( player, 73, 999.0 ) 
    setPlayerStat ( player, 74, 999.0 ) 
    setPlayerStat ( player, 75, 999.0 ) 
    setPlayerStat ( player, 76, 999.0 ) 
    setPlayerStat ( player, 77, 999.0 ) 
    setPlayerStat ( player, 78, 999.0 ) 
    setPlayerStat ( player, 79, 999.0 ) 
    setPlayerStat ( player, 80, 999.0 ) 
    setPlayerStat ( player, 81, 999.0 ) 
    setPlayerStat ( player, 160, 999 ) 
    setPlayerStat ( player, 230, 999 ) 
    setPlayerStat ( player, 231, 999 ) 
end 
  
addEventHandler ( "onPlayerJoin", getRootElement(), setFullStats ) 

[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 2 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 3 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 4 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 5 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 6 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 7 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 8 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 9 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 10 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 11 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 12 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 13 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 14 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 15 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 16 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 17 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 18 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 19 
[18:43:28] WARNING: stats.lua: Bad argument @ 'setPlayerStat' - Line: 20 

Link to comment

Weapon stats are locked at the moment, so weapon skills won't work. The next release will have weapon stats defaulted to high.

I'm only beggining lua for MTA but I think I know whats wrong.

Forward the source to the player. The problem is in the event handler. Try this:

addEventHandler ( "onPlayerJoin", getRootElement(), setFullStats( source ) ) 

The source gets the element that triggered the event. In this case, the source is the player triggering the event.

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