Hallo,
Ich habe eine Frage, undzwar:
Bei mir funktioniert mein /tv System nicht so ganz.
Wenn man in ein Interior reingeht, oder ein Fahrzeug
betritt. Buggt das System.
Code:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
if(IsBeingSpeced[playerid] == 1)
{
foreach(Player,i)
{
if(spectatorid[i] == playerid)
{
SetPlayerInterior(i,GetPlayerInterior(playerid));
SetPlayerVirtualWorld(i,GetPlayerVirtualWorld(playerid));
}
}
}
return 1;
}
Function OnPlayerStateChange(playerid, newstate, oldstate)
{
FRAC_OnPlayerStateChange(playerid, newstate, oldstate);
M_OnPlayerStateChange(playerid, newstate, oldstate);
new string[256];
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
if(IsBeingSpeced[playerid] == 1)
{
foreach(Player,i)
{
if(spectatorid[i] == playerid)
{
TogglePlayerSpectating(playerid, 0);
PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
//PlayerSpectatePlayer(i,playerid);
}
}
}
}
if(newstate == PLAYER_STATE_ONFOOT)
{
if(IsBeingSpeced[playerid] == 1)
{
foreach(Player,i)
{
if(spectatorid[i] == playerid)
{
PlayerSpectatePlayer(i, playerid);
}
}
}
}
Befehle: if(strcmp(cmd, "/tv", true) == 0)
{
new id;
if(!PlayerInfo[playerid][pAdmin] >= 1)return 1;
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, "Benutzung: /tv [ID]");
return 1;
}
if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, 0xFF0000AA, "Spieler nicht gefunden");
if(strval(tmp) == playerid)return SendClientMessage(playerid,Grey,"Du kannst dich nicht selber spectaten.");
if(IsSpecing[playerid] == 1)return SendClientMessage(playerid,Grey,"Du spectatest schon jemanden.");
GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
Inter[playerid] = GetPlayerInterior(playerid);
vWorld[playerid] = GetPlayerVirtualWorld(playerid);
TogglePlayerSpectating(playerid, true);
if(IsPlayerInAnyVehicle(id))
{
if(GetPlayerInterior(id) > 0)
{
SetPlayerInterior(playerid,GetPlayerInterior(id));
}
if(GetPlayerVirtualWorld(id) > 0)
{
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
}
PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
}
else
{
if(GetPlayerInterior(id) > 0)
{
SetPlayerInterior(playerid,GetPlayerInterior(id));
}
if(GetPlayerVirtualWorld(id) > 0)
{
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
}
PlayerSpectatePlayer(playerid,id);
}
GetPlayerName(id, Name, sizeof(Name));
format(String, sizeof(String),"You have started to spectate %s.",Name);
SendClientMessage(playerid,0x0080C0FF,String);
IsSpecing[playerid] = 1;
IsBeingSpeced[id] = 1;
spectatorid[playerid] = id;
return 1;
}