[Release] [Free] [Standalone] | v2.1 DeathScript

A lightweight script that helps aid players with their roleplay by providing more roleplaying opportunities and providing staff a handful of very useful commands


Contributors


Features

  • Disables auto spawn while enabled.
  • lightweight and quick
  • Mappable keys for a quick self-revive or self-respawn. [Revive & Respawn]
  • Commands to revive and respawn everyone.
  • Standalone and compatible with most resources.
  • Exports for external use.

Installation

Download the latest release, extract the resource from the .zip, put the resource in the resources folder and remove the version number from the name, then add start DeathScript to your server.cfg


Controls, Commands, and permissions

Revive

This command can be used to revive the player who is using it ONLY

Command: /revive

Keybind: unbounded
(Any player can bind it to their desired key in their controls settings within their game)

Wait time: 240 seconds
(This can be changed by the server maintainers to their desired needs, instructions in next section)

AcePermission: Unrestricted
(Meaning, this cannot be restricted to be used by certain players)

Admin Revive

This command can be used to instantly revive the player who is using it or other players as well using their server ID

Command: /adrev [ID]
/adrev (would instant revive the person using the command)
/adrev 8 (would instant revive the person with the ID number 8)

Keybind: unbounded
(Any player can bind it to their desired key in their controls settings within their game)

AcePermission: “DeathScript.AdRev”
=====================================
add_ace identifier.fivem:63953 "DeathScript.AdRev" allow (Will give the person with the “fivem:63953” identifier permission to use the admin revive command and keybind)
add_ace group.admin "DeathScript.AdRev" allow (Will give all players within the group “admin” permission to use the admin revive command and keybind)
alternatively, you could use deny instead of allow to deny a player/group’s permission

Admin Revive All

This command can be used to revive all players instantly

Command: /adrevall

AcePermission: “DeathScript.AdRevAll”
=====================================
add_ace identifier.fivem:63953 "DeathScript.AdRevAll" allow (Will give the person with the “fivem:63953” identifier permission to use the admin revive all command)
add_ace group.admin "DeathScript.AdRevAll" allow (Will give all players within the group “admin” permission to use the admin revive all command)
alternatively, you could use deny instead of allow to deny a player/group’s permission

Respawn

This command can be used to respawn the player who is using it ONLY

Command: /respawn

Keybind: unbounded
(Any player can bind it to their desired key in their controls settings within their game)

Wait time: 120 seconds
(This can be changed by the server maintainers to their desired needs, instructions in next section)

AcePermission: Unrestricted
(Meaning, this cannot be restricted to be used by certain players)

Admin Respawn

This command can be used to instantly respawn the player who is using it or other players as well using their server ID

Command: /adres [ID]
/adrev (would instant respawn the person using the command)
/adrev 8 (would instant respawn the person with the ID number 8)

Keybind: unbounded
(Any player can bind it to their desired key in their controls settings within their game)

AcePermission: “DeathScript.AdRes”
=====================================
add_ace identifier.fivem:63953 "DeathScript.AdRes" allow (Will give the person with the “fivem:63953” identifier permission to use the admin respawn command and keybind)
add_ace group.admin "DeathScript.AdRes" allow (Will give all players within the group “admin” permission to use the admin respawn command and keybind)
alternatively, you could use deny instead of allow to deny a player/group’s permission

Admin Respawn All

This command can be used to respawn all players instantly

Command: /adresall

AcePermission: “DeathScript.AdResAll”
=====================================
add_ace identifier.fivem:63953 "DeathScript.AdResAll" allow (Will give the person with the “fivem:63953” identifier permission to use the admin respawn all command)
add_ace group.admin "DeathScript.AdResAll" allow (Will give all players within the group “admin” permission to use the admin respawn all command)
alternatively, you could use deny instead of allow to deny a player/group’s permission

Toggle DeathScript

This command can be used to disable the resource and allow players to automatically respawn after the set timer

Command: /toggleds

AcePermission: “DeathScript.ToggleDS”
=====================================
add_ace identifier.fivem:63953 "DeathScript.ToggleDS" allow (Will give the person with the “fivem:63953” identifier permission to use the toggle command)
add_ace group.admin "DeathScript.ToggleDS" allow (Will give all players within the group “admin” permission to use the toggle command)
alternatively, you could use deny instead of allow to deny a player/group’s permission

To set a keybind for command, go to pause menu > setting > keybinds > FiveM
and you will find a keybind slot for every respective command that has this feature

Click me!

image


Timers

Aka, wait time, this is set time that the player has to wait after being unalived before they’re able to use it

If you wish to change the waiting time, go to the sh_config.js file and you can find a variable called WaitTime or AutoRespawnTimer

Revive Timer

line no.11

  WaitTime: 240, // The default wait time the player has to wait before they can use the command // TIME IN SECONDS \\
Respawn Timer

line no.26

  WaitTime: 120, // The default wait time the player has to wait before they can use the command // TIME IN SECONDS \\
Auto Respawn Timer

This will be effective only if the resource was to be disabled using the Toggle DeathScript command /toggleds

line no.27

AutoRespawnTimer: 10, // this will be the wait time for auto respawn when the script is toggled off using the "/toggleds" command

keep in mind, setting a lower number could decrease the effectiveness of the script, and setting a higher number could make players bored.


Exports

// Client Side

  // Ex; exports.DeathScript.Revive()
    exports('Revive', () => RevivePed(PlayerPedId())) 
  // Ex; exports.DeathScript.Respawn()
    exports('Respawn', () => RespawnPed(PlayerPedId())) 
// Server Side

    // Ex; exports.DeathScript.Revive(2) /|\ exports.DeathScript.Revive('All')
    exports('Revive', (PlayerId) => {
        if (!isNaN(Player)) {
            const Ped = GetPlayerPed(PlayerId);
            if(GetEntityHealth(Ped) <= 1) {
                emitNet('DeathScript:Admin:Revive', PlayerId, 0, false);
            }
        } else if (PlayerId.toLowerCase() === 'all') {
            emitNet('DeathScript:Admin:Revive', -1, 0, true);
        }
    })
    
    // Ex; exports.DeathScript.Respawn(2) /|\ exports.DeathScript.Respawn('All')
    exports('Respawn', (PlayerId) => {
        if (!isNaN(Player)) {
            const Ped = GetPlayerPed(PlayerId);
            if(GetEntityHealth(Ped) <= 1) {
                emitNet('DeathScript:Admin:Respawn', PlayerId, 0, false);
            }
        } else if (PlayerId.toLowerCase() === 'all') {
            emitNet('DeathScript:Admin:Respawn', -1, 0, true);
        }
    })

Issues

  • None :stuck_out_tongue:

If you stumble upon an issue or a bug; make sure to report it by creating an issue card


License: Do whatever you want just don’t claim it’s yours.

FAQ

How can I give someone permissions?

The resource uses the default permissions system; AcePermissions, to make the resource compatible with most running servers.

To give a person permissions you basically need to know an identifier of theirs, doesn’t matter what identifier; steam, discord, IP, cfx doesn’t matter, you could use the GetPlayerIdentifier native to figure out their identifiers.
After you obtain one of the identifiers, you could add them to a group or give them the permission separately, for example; you could have a group called admin and you could give the group the permissions or give the person only that permission.
I’ve listed the commands’ formats you need below, use those formats to make the commands and put them somewhere in your server.cfg file, preferably in a separate permissions file to keep everything tidy.
To make a permissions file, simply, make a permissions.cfg file and put it in the same folder as the server.cfg, and add exec permissions.cfg anywhere in the server.cfg.

Add a person to a group
add_principal identifier.<IDENTIFIER> group.<GROUP_NAME>

ex; add_principal identifier.fivem:63953 group.admin
this would add the person with the fivem:63953 identifier to the admin group.

Remove a person from a group
remove_principal identifier.<IDENTIFIER> group.<GROUP_NAME>

ex; remove_principal identifier.fivem:63953 group.admin
this would remove the person with the fivem:63953 identifier from the admin group.

Give a group permission
add_ace group.<GROUP_NAME> command.<COMMAND_NAME>

ex; add_ace group.admin "DeathScript.AdRev" allow
this would give every person in the admin group permission to use the /adrev command.

Remove a group permission
remove_ace group.<GROUP_NAME> command.<COMMAND_NAME>

ex; remove_ace group.admin "DeathScript.AdRev"
this would remove every person’s permission in the admin group to use the /adrev command.

Give a person permission
add_ace identifier.<IDENFITIFER> command.<COMMAND_NAME>

ex; add_ace identifier.fivem:63953 "DeathScript.AdRev" allow
this would give the person with the fivem:63953 identifier permission to use the /adrev command.

Remove a person permission
remove_ace identifier.<IDENFITIFER> command.<COMMAND_NAME>

ex; remove_ace identifier.fivem:63953 "DeathScript.AdRev"
this would remove the person with the fivem:63953 identifier’s permission to use the adrev command.

This is an exaggerated simplification of how to work with AcePermissions, you could find the details for how it works in this page.

8 Likes

sorry maybe im confused where do i put the admin perms etc or setup admin perms?

5 Likes

If you’re using ace permissions, use this format add_ace <GROUP> commands.adrev allow
This will give a group of people access to the adrev command.
And replace adrev with any of the permissions from the post to give them access to the other commands.
You can refer to this page to see how it works.
Good luck :smile:

1 Like

Honestly thank you so much!

1 Like

also is there a way to add a command so that ems can revive or someone else revive you?

You could duplicate the adrev command and change the name of it, and give it to ems and possibly lock it so only ems group can use it, with the permission.

Great release, definitely going to use this now! :slight_smile:

:star::star::star::star::star: 5/5

1 Like

Now what if I wanted to take out the /revive & /respawn as I already have a script for that. I just want the admin perm stuff. Please let me know what I should take out so It is disabled

Just remove the RegisterCommand block for both revive and respawn in the server.lua file

ok thanks. also what is this togds command im also seeing for civs?

it’s for admins or whoever has permission, basically it disables the script and make it so you respawn automatically, but since you have another script to manage that, make sure my script it under the other script. (in the resources.lua)

sorry can u re phrase that?

wait when using /adrevive is it only for admins to revive themselves or is it for them to revive players. So you would do /adrevive 45 being the player number?

The command is /adrev, you can use it in two ways,

  1. /adrev alone will revive the admin who used it
  2. /adrev <ID> will revive whoever’s ID is used
    And the same concept applies on the /adres command, which admin respawns someone. (same as revive but will also teleport the player to a random hospital)

Ok thanks man. Perfect script. Been looking for this for a while. Keep up the good work. Sorry for all the questions

Glad you found it useful man, If you need anything else just shoot me a DM or here if it’s related to this script for other people to know as well. :smiley:

Hi i am lost and don’t know how to add permissions to this can you help
i am very new to all this

Hey there is there still support in here? Its working fine the script thank you. Id like to add something else if i can get help like when players respawn where can i set it for them to loose everything?

I’m sorry for my mistakes, but here is a link to the official Ace Permissions commands or lines.

add_ace is strictly used for assigning permissions.
Example from vMenu, add_ace group.admin "vMenu.DontBanMe" allow
that will give the group admin the permission to not be banned at all.
in the case of this script, you would do something like this:
add_ace group.admin command.adrev - Now this wil give the admin group permission to use this command.

on the other hand, add_principal is used to inherit permissions from another principal whether it’s a group or another person.
Example, add_principal group.owner group.executive
That will give the Owner group all of the permission that the executive group has.
in the case of this script, you would do something like this to share permissions between groups:
add_principal group.owner group.admin - This will give owner group all the permission that the admin group has.

Nice info thanks. Could we change in a way when players respawn “/respawn” to loose what they have ? Coul you help me out pls