spec off
#1

hey guys i have this spec cmd

Код HTML:
CMD:spec(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
	if(IsPlayerConnected(playerid))
 	{
		if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2)
		{
			new id,giveplayer[25],string[256],sendername[25];
			if(sscanf(params, "u", id)) return SCM(playerid,COLOR_WHITE,"{5024FF}Syntax:{FFFFFF}/spec <Name/Playerid>");
			{
				if(IsPlayerConnected(id))
				{
				    if(id != INVALID_PLAYER_ID)
				    {
						if(Spectate[playerid] == -1)
						{
							BeforeSpectate[playerid][pState] = GetPlayerState(playerid);
							BeforeSpectate[playerid][pWorld] = GetPlayerVirtualWorld(playerid);
							BeforeSpectate[playerid][pInt] = GetPlayerInterior(playerid);
							BeforeSpectate[playerid][pSpectating] = true;
							new Float: x, Float: y, Float: z;
							GetPlayerPos(playerid, x, y, z);

							if(!IsPlayerInAnyVehicle(playerid))
							{
								BeforeSpectate[playerid][pOldPos][0] = x;
								BeforeSpectate[playerid][pOldPos][1] = y;
								BeforeSpectate[playerid][pOldPos][2] = z;
							}
							else
								BeforeSpectate[playerid][pInVehicle] = GetPlayerVehicleID(playerid);
						}
				        Spectate[playerid] = id;
						new Float:health;
						GetPlayerHealthEx(Spectate[playerid], health);
						GetPlayerName(Spectate[playerid], giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						if(togspec[id] == 1) return SCM(playerid,COLOR_WHITE,"{FFFF00}Acel admin este ocupat. Nu poti da /spec pe el!");
						if(reportreason[id] == 0)
						{
							format(string, sizeof(string), "Admin/Helper %s is now spectating %s.",sendername,giveplayer);
						}
                        if(reportreason[id] == 1)
						{
							format(string, sizeof(string), "Admin %s is now spectating %s (reported for being stuck).",sendername,giveplayer);
						}
						if(reportreason[id] == 2)
						{
							format(string, sizeof(string), "Admin %s is now spectating %s (reported for DM).",sendername,giveplayer);
						}
						else if(reportreason[id] == 3)
						{
							format(string, sizeof(string), "Admin %s is now spectating %s (reported for cheats).",sendername,giveplayer);
						}
						ReportTime[id] = 0;
						format(reporttext[id], 30, "NULL");
						format(cheattext[id], 30, "NULL");
						reportcheater[id] = -1;
						reportreason[id] = 0;
						if(playerreported[id] != -1)
						{
							reportreason[playerreported[id]] = 0;
						}
						playerreported[id] = -1;
						KillTimer(timerreport[id]);
						ABroadCast(COLOR_RED,string,1);
						format(string, sizeof(string), "(%d) %s | Level: %d | Health: %.0f | AFK: %d | Duty: %d | Ping: %d | FPS: %d | County: None",Spectate[playerid],giveplayer,PlayerInfo[Spectate[playerid]][pLevel],health,IsPlayerAFK[Spectate[playerid]],OnDuty[Spectate[playerid]],GetPlayerPing(Spectate[playerid]), PlayerInfo[playerid][pFPS]);
						SendClientMessage(playerid, COLOR_DARKPINK, string);
						TogglePlayerSpectating(playerid, 1);
						if(IsPlayerInAnyVehicle(Spectate[playerid]))
						{
						    new carid = GetPlayerVehicleID(Spectate[playerid]);
						    PlayerSpectateVehicle(playerid, carid);
							SpectateState[id] = 2;
						}
						else
						{
						    PlayerSpectatePlayer(playerid, Spectate[playerid]);
							SpectateState[id] = 1;
						}
						PlayerTextDrawSetString(playerid, TextDrawSpec[playerid][1], "LOADING...");
						PlayerTextDrawShow(playerid, TextDrawSpec[playerid][1]);
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
				}
			}
   		}
		else
		{
			SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
			return 1;
		}
	}
	return 1;
}
and i have this , if i press F it should spec off but it works only for id 0 , why?

Код HTML:
if(newkeys & KEY_SECONDARY_ATTACK && Spectate[playerid] == 1)
   {
		new sendername[30], string[256];
		GetPlayerName(playerid, sendername, sizeof(sendername));
	   	format(string,sizeof(string),"{F89AD6}Spec OFF.", sendername);
	    SCM(playerid, COLOR_RED, string);
		TogglePlayerControllable(playerid, 1);
		TogglePlayerSpectating(playerid, 0);
		SetPlayerInterior(playerid,Unspec[playerid][sPint]);
		PlayerInfo[playerid][pInt] = Unspec[playerid][sPint];
		PlayerInfo[playerid][pLocal] = Unspec[playerid][sLocal];
		Unspec[playerid][sLocal] = -1;
		gTeam[playerid] = PlayerInfo[playerid][pTeam];
		SetPlayerToTeamColor(playerid);
	   	PlayerTextDrawHide(playerid, TextDrawSpec[playerid][1]);
		PlayerTextDrawHide(playerid, TextDrawSpec[playerid][2]);
		PlayerTextDrawHide(playerid, TextDrawSpec[playerid][3]);
	   	PlayerTextDrawHide(playerid, TextDrawSpec[playerid][4]);
	 	PlayerTextDrawHide(playerid, TextDrawSpec[playerid][5]);
		Spectate[playerid] = -1;
   }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)