General > Developers Corner

VIP

(1/1)

BlackDeft:
Hi i want to create a vip using ulx
but if i create a script with one i want to give him some more healt and speed i get this error :



[ERROR] lua/viptest.lua:2: attempt to call method 'IsUserGroup' (a nil value)
  1. fn - lua/viptest.lua:2
   2. unknown - addons/ulib_557962238/lua/ulib/shared/hook.lua:110
    3. Spawn - [C]:-1
     4. unknown - gamemodes/base/gamemode/player.lua:115



 my script at that moment look :

local function spawn( ply )
   if ( Player( 2 ):IsUserGroup( "VIP" ) ) then

      SetPlayerSpeed( ply , 300, 80 )
   end
end
hook.Add( "PlayerSpawn", "some_unique_name", spawn )


can someone tell me whats wrong ?

Buzzkill:

--- Code: ---  if ( Player( 2 ):IsUserGroup( "VIP" ) ) then
--- End code ---


Why Player(2)?  Should by ply, like the other two references to it in your script.



--- Quote ---"some_unique_name"
--- End quote ---

You really should change that to something, um... unique.  :)

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given

[0] Board index

Go to full version