Hi,
dies soll ein Befehl sein, der es möglich macht einen Zug-NPC für Personen im Interior zu spectaten/beobachten. Leider beobachtet dieser aber immer nur die ID 0, und nicht die ID 1.
Für Hilfe wäre ich dankbar (Am besten gleich das editierte Codeschnipsel hier posten )
Mit freundlichen Grüßen
Code
CMD:trainspec(playerid, params[])
{
new tmp[32];
new giveplayerid = ReturnUser(tmp);
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if( InsideTut[giveplayerid] >= 1 )
{
}
if(GetPVarInt(giveplayerid, "IsInArena") >= 0)
if(Spectating[playerid] == 0)
{
if(!IsPlayerInRangeOfPoint(playerid,20.0, 199.6787, 812.9191, 2503.7085))
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a Subway Train!");
return 1;
}
new Float: pPositions[ 3 ];
GetPlayerPos(playerid, pPositions[ 0 ], pPositions[ 1 ], pPositions[ 2 ]);
SetPVarFloat(playerid, "SpecPosX", pPositions[ 0 ]);
SetPVarFloat(playerid, "SpecPosY", pPositions[ 1 ]);
SetPVarFloat(playerid, "SpecPosZ", pPositions[ 2 ]);
SetPVarInt(playerid, "SpecInt", GetPlayerInterior(playerid));
SetPVarInt(playerid, "SpecVW", GetPlayerVirtualWorld(playerid));
//SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
if(IsPlayerInAnyVehicle(giveplayerid))
{
TogglePlayerSpectating(playerid, true);
new carid = GetPlayerVehicleID( 0 );
PlayerSpectateVehicle( playerid, carid );
SendClientMessage(playerid, COLOR_GRAD2, "Do the command twice if you can't see the train!");
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
else
{
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer( playerid, giveplayerid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
GettingSpectated[giveplayerid] = playerid;
Spectate[playerid] = giveplayerid;
Spectating[playerid] = 1;
}
else
{
if(IsPlayerInAnyVehicle(giveplayerid))
{
TogglePlayerSpectating(playerid, true);
new carid = GetPlayerVehicleID( giveplayerid );
PlayerSpectateVehicle( playerid, carid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
else
{
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer( playerid, giveplayerid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
GettingSpectated[Spectate[playerid]] = 999;
GettingSpectated[giveplayerid] = playerid;
Spectate[playerid] = giveplayerid;
Spectating[playerid] = 1;
}
}
}
return 1;
}
Alles anzeigen