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 usedeny
instead ofallow
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 usedeny
instead ofallow
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 usedeny
instead ofallow
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 usedeny
instead ofallow
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 usedeny
instead ofallow
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!
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
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.