24.08.2015, 16:13
I want to check if player is pressing some key when he's aiming at other player like that(photo). I've seen this in one server, but I don't know how to do it, is there callback or something?
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new targetid = GetPlayerTargetPlayer(playerid);
if (targetid != INVALID_PLAYER_ID)
{
// Perform a key check here.
}
}
public OnPlayerUpdate(playerid) {
new targetplayer = GetPlayerTargetPlayer(playerid);
if(GetPlayerTeam(targetplayer) == GetPlayerTeam(playerid) && targetplayer != INVALID_PLAYER_ID)
{
GameTextForPlayer(playerid, "~R~do not shoot at team-mates!", 5000, 3);
}
}