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
#2

Help
Reply
#3

1. Don't bump in less than 24 hours.
2. The script is using 'y' and 'n', not the arrow keys. Go try to use 'y' and 'n' and see if it switches players.
Reply
#4

work does not work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)