I’m just making a simple little command to set the players model to the police skin.
By doing /lspd, here is what I have so far. Is this correct?
Client.lua
RegisterNetEvent("lspdUniform")
AddEventHandler("lspdUniform", function()
RequestModel("s_m_y_cop_01")
while not HasModelLoaded("s_m_y_cop_01") do
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), GetHashKey("s_m_y_cop_01"))
end)
Server.lua
AddEventHandler('chatMessage', function(from,name,message)
if(message:sub(1,1) == "/") then
local args = stringsplit(message, " ")
local cmd = args[1]
if (cmd == "/lspd") then
CancelEvent()
TriggerClientEvent('lspdUniform', from)
end
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