[Spectate] Command.
#1

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

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

wow thx alot
Reply
#4

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;
}
Reply
#5

nvm fixed
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)