SA-MP Forums Archive
Render player to press a key - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Render player to press a key (/showthread.php?tid=569331)



Kil - SukMathcuck - 29.03.2015

Resolvido!


Re: Render player to press a key - Evocator - 29.03.2015

As of what i understood, i came up with this:

Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys) 
{ 
    new 
        targetplayer = GetPlayerTargetPlayer(playerid)
    ;

    if ( (oldkeys & KEY_JUMP) && (newkeys & KEY_HANDBRAKE) )
    { 
        if (targetplayer != INVALID_PLAYER_ID) 
        {
            new 
                otherplayer = INVALID_PLAYER_ID
            ;

            for (new J = GetMaxPlayers(), i; i != J; i++)
            {
                if (!IsPlayerConnected(i)) continue;
                if (GetPlayerState(i) != PLAYER_STATE_ONFOOT) continue;
                if (GetPlayerTargetPlayer(i) == targetplayer)
                {
                    otherplayer = i;
                    break;
                }
            }

            if (otherplayer != INVALID_PLAYER_ID)
            {
                SendClientMessage(playerid, COLOR_BLACKRED, "<!> Rendered Player!"); 
                SendClientMessage(otherplayer, COLOR_BLACKRED, "<!> Rendered Player!"); 
                SetPlayerSpecialAction(targetplayer,SPECIAL_ACTION_HANDSUP); 
            }
            else SendClientMessage(playerid, COLOR_BLACKRED, "You need two players aiming to render a victim"); 
        } 
    } 
    return 1;
}



Re: Render player to press a key - SukMathcuck - 29.03.2015

Resolvido!