Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------
- -- Client.
- ---------------
- RegisterNetEvent('resource:spawnPed')
- AddEventHandler('resource:spawnPed', function(ped)
- local pedhash = GetHashKey(ped)
- RequestModel(pedhash)
- repeat
- Citizen.Wait(10)
- until HasModelLoaded(pedhash)
- SetPlayerModel(PlayerId(), pedhash)
- -- Notification / Chat Message / Whatever.
- end)
- ---------------
- -- Server.
- ---------------
- local authList = {
- 'steam:id'
- }
- -- iirc GetPlayerIdentifiers won't return a steam id if they don't have steam running (gta5 not bought thru steam for example).
- -- This should be license keys instead since EVERYONE has one (and it's always present) and not every server requires steam to be running to connect.
- local function getIdentifier(type, id)
- local identifiers = {}
- local numIdentifiers = GetNumPlayerIdentifiers(id)
- for i = 0, numIdentifiers do
- table.insert(identifiers, GetPlayerIdentifier(id, i))
- end
- for i = 1, #identifiers do
- if string.find(identifiers[i], type, 1) then
- return identifiers[i]
- end
- end
- return false
- end
- RegisterCommand('setped', function(source, args)
- local src = source
- if args[1] == nil then
- -- Ped arg not present.
- return
- end
- local id = getIdentifier('steam', src)
- if not id then
- -- Chat message or whatever.
- return -- Stop the code from continuing.
- end
- for i = 1, #authList do
- if authList[i] == id then
- TriggerClientEvent('resource:spawnPed', src, args[1])
- return -- Exit the loop.
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement