Player::registerheadshot: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
Line 7: Line 7:
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
let pedHeadShot;
    if (pedHeadShot == null) {
        pedHeadShot = mp.players.local.registerheadshot();
        mp.gui.chat.push(`pedHeadShot: ${pedHeadShot});
    }
    if (mp.game.ped.isPedheadshotValid(pedHeadShot) && mp.game.ped.isPedheadshotReady(pedHeadShot)) {
        let headshotTexture = mp.game.ped.getPedheadshotTxdString(pedHeadShot);
        mp.events.add(`render`, () => {
            mp.game.graphics.drawSprite(headshotTexture, headshotTexture, 0.5, 0.5, 0.1, 0.1, 0, 255, 255, 255, 100);
        })
    }
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==
{{Player_function_c}}
{{Player_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Revision as of 11:13, 19 August 2018

Syntax

player.registerheadshot();

Required Arguments

Return value

  • unknown (to be checked)

Example

let pedHeadShot;
    if (pedHeadShot == null) {
        pedHeadShot = mp.players.local.registerheadshot();
        mp.gui.chat.push(`pedHeadShot: ${pedHeadShot});
    }
    if (mp.game.ped.isPedheadshotValid(pedHeadShot) && mp.game.ped.isPedheadshotReady(pedHeadShot)) {
        let headshotTexture = mp.game.ped.getPedheadshotTxdString(pedHeadShot);
        mp.events.add(`render`, () => {
            mp.game.graphics.drawSprite(headshotTexture, headshotTexture, 0.5, 0.5, 0.1, 0.1, 0, 255, 255, 255, 100);
        })
    }

See also