Moin,
hab nen /tv Command:
if(strcmp(cmd, "/tv", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(Spectating[playerid])
{
Spectating[playerid] = 0;
IsSpectated[SpectatingPlayer[playerid]] = 0;
SpectatingPlayer[playerid] = INVALID_PLAYER_ID;
TogglePlayerSpectating(playerid, 0);
return 1;
}
else if(!Spectating[playerid])
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, Grey, "Verwendung: /TV [PlayerID/Name]");
new pid = ReturnUser(tmp);
if(IsPlayerConnected(pid))
{
Spectating[playerid] = 1;
SpectatingPlayer[playerid] = pid;
IsSpectated[pid] = 1;
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, pid);
new str[128];
format(str, sizeof str, "Du beobachtest nun %s", pn(pid));
SendClientMessage(playerid, Grey, str);
return 1;
}
return 1;
}
return 1;
}
return 1;
}
Aber wenn der Player in ein Interior geht wird der Screen weiß.
Deswegen hab ich das gemacht:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
if(IsSpectated[playerid] == 1)
{
for(new i = 0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(SpectatingPlayer[i] == playerid && Spectating[i] == 1 && GetPlayerState(i) == PLAYER_STATE_SPECTATING)
{
SetPlayerInterior(i, newinteriorid);
return 1;
}
}
}
}
return 1;
}
und das gehört auch noch dazu:
if(Spectating[playerid] && SpectatingPlayer[playerid] != INVALID_PLAYER_ID)
{
new targetid = SpectatingPlayer[playerid];
if(IsPlayerConnected(targetid))
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new Float:health;
new name[MAX_PLAYER_NAME];
GetPlayerName(targetid, name, sizeof(name));
GetPlayerHealth(targetid, health);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~y~%s(ID:%d)~n~~y~Leben:%.1f",name,targetid,health);
GameTextForPlayer(playerid, string, 2500, 3);
SetPlayerInterior(playerid, GetPlayerInterior(targetid));
if(IsPlayerInAnyVehicle(targetid))
{
new carid = GetPlayerVehicleID(targetid);
PlayerSpectateVehicle(playerid, carid);
}
else
{
PlayerSpectatePlayer(playerid, targetid);
}
}
}
}
Aber irgendwie kann man den Player nicht im Interior beobachten -.-
Wie geht das? Bin bissel außer Übung