Author Topic: VIP  (Read 2255 times)

0 Members and 1 Guest are viewing this topic.

Offline BlackDeft

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
VIP
« on: April 13, 2016, 11:46:02 AM »
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 ?

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: VIP
« Reply #1 on: April 13, 2016, 01:31:35 PM »
Code: [Select]
  if ( Player( 2 ):IsUserGroup( "VIP" ) ) then

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


Quote
"some_unique_name"

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