Lead Developer JokeDevil Posted November 19, 2022 Lead Developer Share Posted November 19, 2022 Here i will explain how to add the export to the esx_ambulancejob revive command Since we don’t have the second player id available we need to change the code for the revive command to get the information we need. First we need to change getting the player to getting the player id. {name = 'playerId', help = 'The player id', type = 'player'} By default it will return a player but we need the id so we change it to this: {name = 'playerId', help = 'The player id', type = 'playerId'} But since we now have the player id and not the player we need to get the player to revive them. For that we add this line of code: tPlayer = ESX.GetPlayerFromId(args.playerId) Good so now we have the player id and the player we want to revive. To revive the player we need to change this args.playerId.triggerEvent('esx_ambulancejob:revive') to this: tPlayer.triggerEvent('esx_ambulancejob:revive') This is because we changed the player to the player id. Now that the player has been revived we will make the log to show in discord. We add the export right below the revive function. exports.JD_logsV3:createLog({ EmbedMessage = "**"..GetPlayerName(xPlayer.source).."** has revived **".. GetPlayerName(tPlayer.source).."**", player_id = xPlayer.source, player_2_id = tPlayer.source, channel = "revive", }) The Embed message will show: Player_A has revived Player_B SO TO SUM UP THE CODE WE HAVE CHANGED HERE IS A BEFORE AND AFTER: Before: ESX.RegisterCommand('revive', 'admin', function(xPlayer, args, showError) args.playerId.triggerEvent('esx_ambulancejob:revive') end, true, {help = _U('revive_help'), validate = true, arguments = { {name = 'playerId', help = 'The player id', type = 'player'} }}) After: ESX.RegisterCommand('revive', 'admin', function(xPlayer, args, showError) tPlayer = ESX.GetPlayerFromId(args.playerId) tPlayer.triggerEvent('esx_ambulancejob:revive') exports.JD_logs:createLog({ EmbedMessage = "**"..GetPlayerName(xPlayer.source).."** has revived **".. GetPlayerName(tPlayer.source).."**", player_id = xPlayer.source, player_2_id = tPlayer.source, channel = "revive", }) end, true, {help = _U('revive_help'), validate = true, arguments = { {name = 'playerId', help = 'The player id', type = 'playerId'} }}) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.