Advertisement
Guest User

Help with esx_identity

a guest
Aug 22nd, 2019
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. -- Server script esx_identity
  2. -- Getting information if player is on State 1 in VIP
  3. function getVip(source, callback)
  4.     local identifier = GetPlayerIdentifiers(source)[1]
  5.     MySQL.Async.fetchAll('SELECT vip FROM `users` WHERE `identifier` = @identifier', {
  6.         ['@identifier'] = identifier
  7.     }, function(result)
  8.             local data = {
  9.                 identifier  = result[1].identifier,
  10.                 vip         = result[1].vip
  11.             }
  12.             callback(data)
  13.     end)
  14. end
  15.  
  16. -- Restricting the Command so that VIP's only can use this
  17. TriggerEvent('es:addCommand', 'register', function(source, args, user)
  18.     if data.vip == 1 then
  19.         getCharacters(source, function(data)
  20.             if data.firstname3 ~= '' then
  21.                 TriggerClientEvent('chat:addMessage', source, { args = { '^[IDENTITY]', 'You can only have 3 registered characters. Use the ^3/chardel^0  command in order to delete existing characters.' } })
  22.             else
  23.                 TriggerClientEvent('esx_identity:showRegisterIdentity', source, {})
  24.             end
  25.         end)
  26.     else
  27.         TriggerClientEvent('chat:addMessage', source, { args = { '^[DUSK CITY]', 'Du hast keine Berechtigung dies zu tun.'} })
  28.     end
  29. end, {help = "Register a new character"})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement