SA-MP Forums Archive
[Spectate] Command. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Spectate] Command. (/showthread.php?tid=220001)



[Spectate] Command. - Rocketeer - 02.02.2011

Hey guys, does anyone have a spectate command. For example /spectate [id] and /spectateoff. Thanks verymuch!


Re: [Spectate] Command. - PeteShag - 02.02.2011

In the default SA-MP package there is an FS called adminspec, I think that is what you need.


Re: [Spectate] Command. - Rocketeer - 02.02.2011

wow thx alot


Re: [Spectate] Command. - Unknown123 - 02.02.2011

This should work too =/

pawn Код:
#include <a_samp>
#include <sscanf>

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(spectate, 8, cmdtext);
    dcmd(spectateoff, 11, cmdtext);
    return 0;
}

dcmd_spectate(playerid, params[])
{
    new targetid;

    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /spectate (id)");
    else if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "Invalid ID");
    {
        TogglePlayerSpectating(playerid, 1);
        if(IsPlayerInAnyVehicle(targetid))
        {
            PlayerSpectateVehicle(playerid, targetid);
            return 1;
        }
        else
        {
            PlayerSpectatePlayer(playerid, targetid);
            return 1;
        }
    }
}

dcmd_spectateoff(playerid, params[])
{
    #pragma unused params
    TogglePlayerSpectating(playerid, 0);
    return 1;
}



Re: [Spectate] Command. - Rocketeer - 02.02.2011

nvm fixed