21.03.2015, 12:05
(
Последний раз редактировалось sampkinq; 21.03.2015 в 16:48.
)
How can I change the person from the keyboard
[/CENTER]
Код:
#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); }