Advertisement
Guest User

Untitled

a guest
Nov 28th, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. function Pointshop2.UpdatePointsOverTime( )
  2. local groupMultipliers = Pointshop2.GetSetting( "Pointshop 2", "PointsOverTime.GroupMultipliers" )
  3. local points = Pointshop2.GetSetting( "Pointshop 2", "PointsOverTime.Points" )
  4. for k, ply in pairs( player.GetAll( ) ) do
  5. if groupMultipliers[ply:GetUserGroup( )] then
  6. local bonus = groupMultipliers[ply:GetUserGroup( )] * points - points
  7.  
  8. --Try to find a nice rank name
  9. local titleLookup = {}
  10. for k, v in pairs( PermissionInterface.getRanks( ) ) do
  11. titleLookup[v.internalName] = v.title
  12. end
  13. local rank = titleLookup[ply:GetUserGroup()] or ply:GetUserGroup( )
  14.  
  15. ply:PS2_AddStandardPoints( bonus, rank .. " Bonus", true )
  16. end
  17. ply:PS2_AddStandardPoints( points, "Spielen auf dem Server" )
  18.  
  19. end
  20. end
  21.  
  22. function Pointshop2.RegisterPOTtimer( )
  23. --Points over time is disabled for gamemodes with integration plugins
  24. if Pointshop2.IsCurrentGamemodePluginPresent( ) then
  25. return
  26. end
  27.  
  28. local delayInSeconds = Pointshop2.GetSetting( "Pointshop 2", "PointsOverTime.Delay" ) * 60
  29. timer.Create( "Pointshop2_POT", delayInSeconds, 0, function( )
  30. Pointshop2.UpdatePointsOverTime( )
  31. end )
  32. end
  33. hook.Add( "PS2_OnSettingsUpdate", "POTTimerUpdate", function( )
  34. Pointshop2.RegisterPOTtimer( )
  35. end )
  36. Pointshop2.SettingsLoadedPromise:Done( function( )
  37. Pointshop2.RegisterPOTtimer( )
  38. end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement