Skip to content

A lightweight script the enhances that players' roleplay scenarios by providing a better death roleplaying opportunities and providing staff a handful of very useful commands

Notifications You must be signed in to change notification settings

ItsAmmarB/DeathScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[FiveM] 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! https://forum.cfx.re/uploads/default/original/4X/2/b/8/2b8aa033fdc1d5bdb722bbb8ef7c46133e3ed97b.png

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 :p

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.

About

A lightweight script the enhances that players' roleplay scenarios by providing a better death roleplaying opportunities and providing staff a handful of very useful commands

Topics

Resources

Stars

Watchers

Forks