Spectate positioning not working correctly.
#1

I'm having an issue with the admin spectate system. After you type /specoff, instead of teleporting to your original position, the person you were spectating is sent there, OR you're both sent to spawn.

pawn Код:
COMMAND:specoff(playerid,params[])
{
    #if EnableSpectate == true
    if(PlayerInfo[playerid][pAdmin] >=1)
    {
        if(gPlayerSpectating[playerid] == 1)
        {
            TogglePlayerSpectating(playerid, 0);
            gSpectateID[playerid] = INVALID_PLAYER_ID;
            gPlayerSpectating[playerid] = 0;
            gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
            SendClientMessage(playerid, COLOR_GREEN, "You have stopped spectating!");
            TextDrawHideForPlayer(playerid,Spectation);
            spectimer = SetTimer("SpecSpawn",1000,0);
        }
        else SendClientMessage(playerid,COLOR_RED,"ERROR: You are not in spectate mode!");
    }
    else SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use this command.");
    #endif
    return 1;
}

forward SpecSpawn(playerid);
public SpecSpawn(playerid)
{
    SetPlayerPos(playerid,sx, sy, sz);
    SetPlayerFacingAngle(playerid, sa);
    SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
    KillTimer(spectimer);
    return 1;
}

COMMAND:spec(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >=1)
    {
            if(gPlayerSpectating[playerid] == 0)
            {
                new Target;
                if(!sscanf(params, "u", Target))
                {
                    if(gPlayerSpectating[Target] == 0)
                    {
                        if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_BRIGHTRED,"ERROR: That player is not connected.");
                        GetPlayerPos(playerid,sx, sy, sz);
                        GetPlayerFacingAngle(playerid, sa);
                        TogglePlayerSpectating(playerid, 1);
                        PlayerSpectatePlayer(playerid, Target);
                        SetPlayerInterior(playerid,GetPlayerInterior(Target));
                        gSpectateID[playerid] = Target;
                        gPlayerSpectating[playerid] = 1;
                        gSpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
                        new tname[MAX_PLAYER_NAME];
                        GetPlayerName(Target,tname,sizeof(tname));
                        new MyString[128];
                        format(MyString,sizeof MyString, "You are now spectating %s! Type /specoff to stop!", tname);
                        SendClientMessage(playerid, COLOR_GREEN, MyString);
                    }
                    else SendClientMessage(playerid,COLOR_RED,"ERROR: Player is in spectate mode!");
                }
                else SendClientMessage(playerid,COLOR_WHITE,"USAGE: /spec <playerid>");
            }
            else SendClientMessage(playerid,COLOR_RED,"ERROR: You are already in spectate mode!");
        }
        else SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use this command.");
    return 1;
}
Reply


Messages In This Thread
Spectate positioning not working correctly. - by Aerotactics - 18.03.2014, 22:28
Re: Spectate positioning not working correctly. - by Patrick - 18.03.2014, 22:32
Re: Spectate positioning not working correctly. - by Aerotactics - 18.03.2014, 22:53

Forum Jump:


Users browsing this thread: 1 Guest(s)