/revive need some help


#1

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


#2

or do i use RegisterCommand insteed of RegisterNetEvent?


#3

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)

#4

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


#5

dint work :L hmmmmmmm


#6

Are you using a custom chat resource?


#7

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


#8

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

no permissions