07.03.2010, 07:25
I'm not 100% sure what spectating system you're using, but I have seen it before. If I remember right, there are 3 different spectating modes, so the code should be like this. Am I right?
pawn Код:
dcmd_spec(playerid, params[])
{
new index = 0;
tmp2 = strtok(params, index);
if (pInfo[playerid][pAdmin] < 1)
{
SystemMessage(playerid, "You are not an Administrator with the required level.");
return 1;
}
if(!strlen(tmp2))
{
SystemMessage(playerid, "[USAGE] ''/spec [playername/id]''.");
return 1;
}
new string[MAX_STRING];
new second, minute, hour, day, month, year;
giveplayerid = ReturnUser(tmp2);
if(IsPlayerConnected(giveplayerid))
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, giveplayerid);
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
gSpectateID[playerid] = giveplayerid;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_VEHICLE;
gettime(hour, minute, second);
getdate(year, month, day);
format(string, sizeof(string), "Player %s started spectating player %s on %d/%d/%d at %d:%d:%d.", PlayerName(playerid), PlayerName(giveplayerid), month, day, year, hour, minute, second);
ServerLog(string);
printf(string);
}
else
{
format(string, sizeof(string), "That player is not active.");
SystemMessage(playerid, string);
}
return 1;
}