Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Chat commands Script by Sam Cliffe")
- function getIdentity(source)
- local identifier = GetPlayerIdentifiers(source)[1]
- local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {['@identifier'] = identifier})
- if result[1] ~= nil then
- local identity = result[1]
- return {
- identifier = identity['identifier'],
- firstname = identity['firstname'],
- lastname = identity['lastname'],
- dateofbirth = identity['dateofbirth'],
- sex = identity['sex'],
- height = identity['height']
- }
- else
- return nil
- end
- end
- AddEventHandler('chatMessage', function(source, name, msg)
- sm = stringsplit(msg, " ");
- if sm[1] == "/ooc" then
- CancelEvent()
- TriggerClientEvent('chatMessage', -1, "OOC | " .. name, { 36, 36, 36 }, string.sub(msg,5))
- end
- end)
- function stringsplit(inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={} ; i=1
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- t[i] = str
- i = i + 1
- end
- return t
- end
- AddEventHandler('chatMessage', function(source, name, msg)
- sm = stringsplit(msg, " ");
- if sm[1] == "/twt" then
- CancelEvent()
- local name = getIdentity(source)
- fal = name.firstname .. " " .. name.lastname
- TriggerClientEvent('chatMessage', -1, "[Twitter] " .. fal { 0, 102, 204 }, string.sub(msg,5))
- end
- end)
- function stringsplit(inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={} ; i=1
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- t[i] = str
- i = i + 1
- end
- return t
- end
- AddEventHandler('chatMessage', function(name, source, msg)
- sm = stringsplit(msg, " ");
- if sm[1] == "/anonym" then
- CancelEvent()
- TriggerClientEvent('chatMessage', -1, "Anonym | ".. name .." ", {22, 2, 22}, string.sub(msg,5))
- end
- end)
- AddEventHandler('chatMessage', function(source, name, msg)
- sm = stringsplit(msg, " ");
- if sm[1] == "/ad" then
- CancelEvent()
- TriggerClientEvent('chatMessage', -1, "Advert | " .. name, { 255, 255, 0 }, string.sub(msg,5))
- end
- end)
- function stringsplit(inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={} ; i=1
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- t[i] = str
- i = i + 1
- end
- return t
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement