English our lua have error

8 replies
Goto Page
To the start Previous 1 Next To the start
24.01.19 10:00:13 am
Up
maninja
User
Offline Off
hello Guys

I was working on this Lua And I wanted to Add Save steam When I wanted to try it, boom Lua Error and No work Please any Someone Help me ?

Okey That Fix its !!
edited 1×, last 24.01.19 04:29:48 pm
24.01.19 10:23:06 am
Up
TrialAndError
User
Offline Off
Some if's are missing an end.

Spoiler >
24.01.19 10:38:26 am
Up
maninja
User
Offline Off
Thx You Very much


but have error

Ths is error
Code:
1
2
3
LUA ERROR: sys/lua/autorun/lvl_exp.lua:65: attempt to compare string with boolean
 -> sys/lua/autorun/lvl_exp.lua:65: in function <sys/lua/autorun/lvl_exp.lua:60>
 -> in Lua hook 'leave', params: 7, 0
edited 2×, last 24.01.19 04:30:16 pm
24.01.19 01:15:39 pm
Up
Quattro
GAME BANNED
Offline Off
(player(id,"steam")>"0")


Can you even compare strings like that? First check what is an empty value of steamid then make it

if player(id,"steam") <> that value then...


...or change steamid to number but from my experience you will run into some problems. That is why I used this in my huge script and even changed all usgns to string:

edit, found it for you in my script:
Code:
1
2
elseif steam == '0' or steam == nil or steam == 0 or steam == '' then
            return 0
24.01.19 08:32:41 pm
Up
Hajt
User
Offline Off
just use
player(id,"steam")~="0"
...
24.01.19 08:51:54 pm
Up
Quattro
GAME BANNED
Offline Off
@user Hajt:
Yeah, less paranoid approach
24.01.19 10:42:24 pm
Up
SQ
Moderator
Offline Off
@user Hajt: This is the only correct way of doing it. "
Code:
1
player(id,"steam")~="0"


@user Hajt: Lua does not support long integers, this is the reason we are using strings for this. Lua will convert to 32 float and will be corrupted, wont work as expected.

String method is way more reliable approach to pass steam id's, steam do the same with their API.
24.01.19 10:47:10 pm
Up
TrialAndError
User
Offline Off
It's also "steamid" instead of "steam" for the value parameter
24.01.19 10:48:54 pm
Up
maninja
User
Offline Off
Ok thx all im fix itt :())))))
To the start Previous 1 Next To the start