Ped::isPedheadshotReady: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:


==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">ped.isPedheadshotReady(handle);</syntaxhighlight>
<syntaxhighlight lang="javascript">mp.game.ped.isPedheadshotReady(handle);</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''handle:''' int
*'''handle:''' int
Line 8: Line 8:
==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==
{{Ped_function_c}}
{{Ped_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 11:16, 19 August 2018

Syntax

mp.game.ped.isPedheadshotReady(handle);

Required Arguments

  • handle: int

Return value

  • Boolean

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