Keyboard Spec Problem
#1

How can I change the person from the keyboard





Код:
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))



public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_YES)) // does not work
{
SpectateOn(playerid);
SpectateNext(playerid);
SendClientMessage(playerid,-1,"Y bastım");
}
if (PRESSED(KEY_NO)) // does not work
{
SpectateOn(playerid);
SpectatePrevious(playerid);
SendClientMessage(playerid,-1,"N bastım");
}
	return 1;
}

forward SpectateNext(playerid);
public SpectateNext(playerid)
{
        SpectatedPlayer[playerid]++;
        for(new i=SpectatedPlayer[playerid]; i<MAX_PLAYERS; i++)
        {
                if(!IsPlayerConnected(i)) continue;
                if(IsPlayerInAnyVehicle(i))
                {
                        PlayerSpectateVehicle(playerid, GetPlayerVehicleID(i));
                }
                else
                {
                        PlayerSpectatePlayer(playerid, i);
                }
                SpectatedPlayer[playerid] = i;
                break;
        }
        new str[128];
        format(str, 128, "İzlenen Oyuncu: %s (ID:%d).", GetName(SpectatedPlayer[playerid]), SpectatedPlayer[playerid]);
        SendClientMessage(playerid, colorSPECTATE, str);
}
forward SpectatePrevious(playerid);
public SpectatePrevious(playerid)
{
    SpectatedPlayer[playerid]--;
        for(new i=SpectatedPlayer[playerid]; i>-1; i--)
        {
                if(!IsPlayerConnected(i)) continue;
                if(IsPlayerInAnyVehicle(i))
                {
                        PlayerSpectateVehicle(playerid, GetPlayerVehicleID(i));
                }
                else
                {
                        PlayerSpectatePlayer(playerid, i);
                }
                SpectatedPlayer[playerid] = i;
                break;
        }
        new str[128];
        format(str, 128, "İzlenen Oyuncu: %s (ID:%d).", GetName(SpectatedPlayer[playerid]), SpectatedPlayer[playerid]);
        SendClientMessage(playerid, colorSPECTATE, str);
}

forward SpectateOn(playerid);
public SpectateOn(playerid)
{
        TogglePlayerSpectating(playerid, 1);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(!IsPlayerConnected(i)) continue;
            SpectatedPlayer[playerid] = i;
                PlayerSpectatePlayer(playerid, i);
        }
        IsPlayerSpectating[playerid] = true;
        new str[128];
        format(str, 128, "İzlenen Oyuncu: %s (ID:%d).", GetName(SpectatedPlayer[playerid]), SpectatedPlayer[playerid]);
        SendClientMessage(playerid, colorSPECTATE, str);
}
[/CENTER]
Reply


Messages In This Thread
Keyboard Spec Problem - by sampkinq - 21.03.2015, 12:05
Re: Keyboard Spec Problem - by sampkinq - 21.03.2015, 16:49
Re: Keyboard Spec Problem - by Crayder - 21.03.2015, 19:45
Re: Keyboard Spec Problem - by sampkinq - 21.03.2015, 20:36

Forum Jump:


Users browsing this thread: 1 Guest(s)