/revive need some help

am trying to make a /revive script with ped restriction but am still learning do you guys think this is gonna work?

https://pastebin.com/TP39q1Wu

or do i use RegisterCommand insteed of RegisterNetEvent?

Use something like this:

local models = {
    "s_m_y_cop_01", -- and add all your others here too
}

RegisterCommand("revive", function()
    local ped = PlayerPedId()
    local pedModel = GetEntityModel(ped)
    local allowed = false
    for _,model in pairs(models) do
        if pedModel == GetHashKey(model) then
            allowed = true
            break
        end
    end
    if allowed then
        -- do your reviving here
    else
        TriggerEvent("chatMessage", "", {255,255,255}, "^1You are not allowed to use this command.")
    end
end)

thank you so much :slight_smile: am trying to learn but its so hard :frowning:

dint work :L hmmmmmmm

Are you using a custom chat resource?

not sure am using the esx framework, but when am not in the cop ped its says i dont are allowd to use the command, but in the skin when i tried it it dint say anything. or my friend dint het revived

all off my members cannot use /revive - any idea?

no permissions

This is working and restricts the revive command to PEDS, but the thing is you cannot revive anymore…