• Need some help guys 'SetModelScale' (number expected, got no value)
    7 replies, posted
So I am trying to fix this addon [url]http://www.garrysmod.org/downloads/?a=view&id=131855[/url] but I fail at coding :(. Could somone fix this for me it's a small code and I would really appreciate it. The error I am getting; [ERROR] addons/spawnprotect/lua/entities/spawn_protect/cl_init.lua:7: bad argument #2 to 'SetModelScale' (number expected, got no value) 1. SetModelScale - [C]:-1 2. unknown - addons/spawnprotect/lua/entities/spawn_protect/cl_init.lua:7 Timer Failed! [Simple][@addons/spawnprotect/lua/entities/spawn_protect/cl_init.lua (line 5)]
Please show the code, it's easier than having everyone download it.
[url]http://pastebin.com/gMgkQnCy[/url] from cl_init.lua [url]http://pastebin.com/01dTBBbJ[/url] from init.lua [url]http://pastebin.com/fvYJsGiW[/url] from shared.lua
-snip-
self.Entity:SetModelScale(scale,1) would be the right thing then? I suck at coding. But I tried this and I get this error: [QUOTE][ERROR] addons/spawnprotect/lua/entities/spawn_protect/cl_init.lua:7: bad argument #1 to 'SetModelScale' (number expected, got userdata) 1. SetModelScale - [C]:-1 2. unknown - addons/spawnprotect/lua/entities/spawn_protect/cl_init.lua:7 Timer Failed! [Simple][@addons/spawnprotect/lua/entities/spawn_protect/cl_init.lua (line 5)][/QUOTE]
[QUOTE=TonyWolfie;41364495]self.Entity:SetModelScale(scale,1) would be the right thing then? I suck at coding. But I tried this and I get this error:[/QUOTE] THERE'S your problem, I googled the function and you need only a single argument, so your problem is in the line before, and GetScaleXYZ is returning something different. Put 'print(scale)' just before line 5 and see what it returns.
SetModelScale requires two arguments. The second argument is the time you want it to scale over. Usually 0.
[QUOTE=Internet1001;41364674]THERE'S your problem, I googled the function and you need only a single argument, so your problem is in the line before, and GetScaleXYZ is returning something different. Put 'print(scale)' just before line 5 and see what it returns.[/QUOTE] It returns " 0.000000 0.000000 0.000000 "
Sorry, you need to Log In to post a reply to this thread.