Spectate help appreciated
#1

Hey,

I was wondering if you could help me with the spectate issue i'm having, can anyone hit me up with a spec system, which is only for admins - where you can either /spec or /recon, and make it so when an admin is spectating someone, as they move their mouse they can see behind the player, basically so the camera angle rotates.

Also, how do I make it so when we do /spec or /recon off they don't die?

Can anyone link me to a script as I don't have the slightest of clues.
Reply
#2

Using citywide
Reply
#3

Bump
Reply
#4

Don't bump, it's not allowed.
Reply
#5

here use mine: (also thanks to seifs adminscript for providing an excellent example)
pawn Код:
if(strcmp(cmd,"/Spec",true)==0)
{//  \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ needs to be changed to whatever system of admin levels you have
  if(AdminLevel<The required level)return SendClientMessage(playerid,RED,"You are not an admin with the requried level.");
  tmp=strtok(cmdtext,idx);
  if(strlen(tmp)==0)return SendClientMessage(playerid,RED,"You need to type: (/Spec (Playername/PlayerID)) or (/SpecOff)");
  otherplayer=ReturnUser(tmp);
  if(otherplayer==INVALID_PLAYER_ID)return SendClientMessage(playerid,RED,"That player does not exist!");
  TogglePlayerSpectating(playerid,1);
  if(IsPlayerInAnyVehicle(otherplayer)==1)PlayerSpectateVehicle(playerid,GetPlayerVehicleID(otherplayer));
  else PlayerSpectatePlayer(playerid,otherplayer);
  SendClientMessage(playerid,GREEN,"To stop spectating use: /Specoff");
  return 1;
}
For this to work you will need strtok and to change otherplayer with whatever you use the player id the command affects.

And you'll need to have RED defined or replace it with the red hex code. (The same with GREEN).

Also here's spectate off:
pawn Код:
if(strcmp(cmd,"/SpecOff",true)==0)
{
  TogglePlayerSpectating(playerid,0);
  SetPlayerVirtualWorld(playerid,0);
  SetPlayerInterior(playerid,0);
  return 1;
}
Reply
#6

We require one that allows rotation by the move of the mouse angle / key angles. I've fixed the death error.
Reply
#7

Quote:
Originally Posted by Calgon
We require one that allows rotation by the move of the mouse angle / key angles. I've fixed the death error.
That Spectate should allow you to move ur mouse around as though you were playing. As far as i know, you can't really spectate someone with only one angle.
Reply
#8

Код:
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1524) : error 017: undefined symbol "AdminLevel"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1525) : error 017: undefined symbol "tmp"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1525) : error 017: undefined symbol "strtok"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1526) : error 017: undefined symbol "tmp"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1527) : error 017: undefined symbol "otherplayer"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1527) : error 017: undefined symbol "ReturnUser"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1528) : error 017: undefined symbol "otherplayer"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1530) : error 017: undefined symbol "otherplayer"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1530) : error 017: undefined symbol "otherplayer"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1531) : error 017: undefined symbol "otherplayer"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1536) : error 017: undefined symbol "cmd"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


11 Errors.
What could be the problem of that? I have done everything right...

//edit: Just to make a point, I have a normal admin script without Admin Levels.

Reply
#9

-The_Badger- gave an example from his or Seif's admin script. Your not supposed to just copy/paste it. Change "AdminLevel" to the variable that determines or sets the players level. If you don't have any sort of admin script or are just using RCON admin then remove that line and replace with:

pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You need to be Admin to do that!");
    {
      //paste the spec stuff here
    }
Also you need to have Strtok to use that specific command format.

https://sampwiki.blast.hk/wiki/Strtok

Good luck.
Reply
#10

The forum identation is ruined. D;

Код:
	if(strcmp(cmd,"/spec",true) == 0)
	{
  	if(PlayerInfo[playerid][pAdmin] < 1)
		{
			SendClientMessage(playerid, COLOR_YELLOW, "You're not authorised to spectate another player.");
			return 1;
		}
  	tmp = strtok(cmdtext,idx);
  	if(strlen(tmp) == 0)
		{
    	SendClientMessage(playerid, COLOR_GRAD1, "/spec [playerid/partofname] (or /specoff)");
			return 1;
		}
  	new otherplayer = ReturnUser(tmp);
  	if(otherplayer == INVALID_PLAYER_ID)
  	{
			SendClientMessage(playerid, COLOR_GREY, "Invalid player ID!");
			return 1;
		}
  	TogglePlayerSpectating(playerid,1);
  	if(IsPlayerInAnyVehicle(otherplayer)==1)
		{
		  new Float:health;
			new name[MAX_PLAYER_NAME];
			GetPlayerName(otherplayer, name, sizeof(name));
			GetPlayerHealth(otherplayer, health);
			format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~y~%s(ID:%d)~n~~y~health:%.1f",name,otherplayer,health);
			GameTextForPlayer(i, string, 2500, 3);
			PlayerSpectateVehicle(playerid, GetPlayerVehicleID(otherplayer));
		}
  	else
		{
		  new Float:health;
			new name[MAX_PLAYER_NAME];
			GetPlayerName(otherplayer, name, sizeof(name));
			GetPlayerHealth(otherplayer, health);
			format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~y~%s(ID:%d)~n~~y~health:%.1f",name,otherplayer,health);
			GameTextForPlayer(i, string, 2500, 3);
			PlayerSpectatePlayer(playerid,otherplayer);
		}
  	SendClientMessage(playerid, COLOR_WHITE, "To finish your spectation session, use /specoff.");
  	return 1;
	}
	if(strcmp(cmd,"/specoff",true)==0)
	{
  	TogglePlayerSpectating(playerid,0);
  	SetPlayerVirtualWorld(playerid,0);
  	SetPlayerInterior(playerid,0);
  	SendClientMessage(playerid, COLOR_YELLOW, "You have finished spectating.");
  	return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)