On Pressed key help
#1

I want to make it so when a player fires his gun,it shows a playermarker
and when he stops shooting it removes the marker,this is my idea,but I dont know if it will work and I cant test it right now

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if( IsPlayerSpawned(playerid) && (PRESSED(KEY_FIRE)))
    {
        if (gTeam[playerid] == TEAM_BLUE)
        {
            ShowPlayerMarkers(2);
            SetPlayerMarkerForPlayer(TEAM_BLUE,TEAM_RED,COLOR_BLUE );//SetPlayerMarkerForPlayer(playerid, showplayerid, color)
        }
        else if (gTeam[playerid] == TEAM_RED)
        {
            ShowPlayerMarkers(2);
            SetPlayerMarkerForPlayer(TEAM_RED,TEAM_BLUE,COLOR_RED );
        }
        else if( IsPlayerSpawned(playerid) && (!PRESSED(KEY_FIRE)))
        {
            ShowPlayerMarkers(0);
        }
    }
    if( IsPlayerSpawned(playerid) && !IsPlayerInAnyVehicle(playerid) && (PRESSED(KEY_HANDBRAKE) || RELEASED(KEY_HANDBRAKE)) )
    {
        if(IsPlayerAiming(playerid))
        {
            SetPlayerFirstPersonMode(playerid,0);
            pFirstPersonTick[playerid] = GetTickCount();
        }
    }
    return 1;
}
Reply
#2

Well if you want to do so when a player shoots it will show a marker then you need to also check if the palyer is holding the key_fire.
Reply
#3

Oh okay.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)