SA-MP Forums Archive
[HELP] Specating - 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: [HELP] Specating (/showthread.php?tid=135655)



[HELP] Specating - Mechscape - 21.03.2010

I have LARP Gamemode, and i need help it specating fixing.

Код:
new Float:specatorX, Float:specatorY, Float:specatorZ;
new interior;
new virtualworld;
Код:
dcmd_specplayer(playerid, params[])
{
  new Giveplayerid, Name[256], String[256], Name2[256];
	if (PlayerInfo[playerid][pAdmin] >= 1)
	{
		if (sscanf(params, "d", Giveplayerid)) SendClientMessage(playerid,COLOR_WHITE, "SERVER: /specplayer [Playerid]");
		else if (!IsPlayerConnected(Giveplayerid)) SendClientMessage(playerid,COLOR_PURPLE,"Player not connected?");
		else
		{
			if ( Specing[Giveplayerid] == 1 )
			{
				SendClientMessage(playerid, COLOR_RED, "  The person you have tried to spec is spectating someone else.");
			}
			else
			{
	  		GetPlayerName(playerid, Name, 256);
				GetPlayerName(Giveplayerid, Name2, 256);
				format(String, 256, "[%i] %s is now spectating [%i] %s",playerid, Name,Giveplayerid, Name2);
				CallLocalFunction("ircRemoteSay", "iss", 1, "#FSE", String);
				Specing[playerid] = 1;
			}
			SpecAndmed(playerid);
			if ( !IsPlayerInAnyVehicle(Giveplayerid) )
			{
				TogglePlayerSpectating(playerid, 1);
				PlayerSpectatePlayer(playerid, Giveplayerid);
				SetPlayerInterior(playerid,GetPlayerInterior(Giveplayerid));
				SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(Giveplayerid));
				return 1;
			}
			else
			{
				TogglePlayerSpectating(playerid, 1);
				PlayerSpectateVehicle(playerid, GetPlayerVehicleID(Giveplayerid));
				SetPlayerInterior(playerid,GetPlayerInterior(Giveplayerid));
				SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(Giveplayerid));
				return 1;
			}
 		}
	}
	return 1;
}

dcmd_specoff(playerid, params[])
{
	#pragma unused params
	TogglePlayerSpectating(playerid, 0);
	Specing[playerid] = 0;
	SetPlayerHealth(playerid, 100.0);
	SetPlayerPos(playerid, specatorX, specatorY, specatorZ);
	SetPlayerInterior(playerid, interior);
	SetPlayerVirtualWorld(playerid, virtualworld);
	return 1;
}
Код:
public SpecAndmed(playerid)
{
	GetPlayerPos(playerid, specatorX, specatorY, specatorZ);
	new interior = GetPlayerInterior(playerid);
	new virworld = GetPlayerVirtualWorld(playerid);
	return 1;
}
Код:
C:\Documents and Settings\Kasutaja\My Documents\SAMP\gamemodes\sg.pwn(46308) : warning 219: local variable "interior" shadows a variable at a preceding level
C:\Documents and Settings\Kasutaja\My Documents\SAMP\gamemodes\sg.pwn(46309) : warning 204: symbol is assigned a value that is never used: "virworld"
C:\Documents and Settings\Kasutaja\My Documents\SAMP\gamemodes\sg.pwn(46308) : warning 204: symbol is assigned a value that is never used: "interior"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:      9588 bytes
Code size:     1640064 bytes
Data size:     10376316 bytes
Stack/heap size:   16384 bytes; estimated max. usage=5601 cells (22404 bytes)
Total requirements:12042352 bytes

3 Warnings.
That makes:
[[ PLAYER ]] Types /specplayer (id) >> Saves position >> [[ PLAYER ]] Specating >> [[ PLAYER ]] Types /specoff >> Turning [[ PLAYER ]] to back saved position


Re: [HELP] Specating - aircombat - 21.03.2010

new interior = GetPlayerInterior(playerid);
new virworld = GetPlayerVirtualWorld(playerid);

it means that u didn't use those lines above


Re: [HELP] Specating - Mechscape - 21.03.2010

Quote:
Originally Posted by [AC
Etch ]
new interior = GetPlayerInterior(playerid);
new virworld = GetPlayerVirtualWorld(playerid);

it means that u didn't use those lines above
Ummm?


Re: [HELP] Specating - aircombat - 21.03.2010

delete those 2 lines cause u don't use them :

new interior = GetPlayerInterior(playerid);
new virworld = GetPlayerVirtualWorld(playerid);




Re: [HELP] Specating - Mechscape - 21.03.2010

Quote:
Originally Posted by [AC
Etch ]
delete those 2 lines cause u don't use them :

new interior = GetPlayerInterior(playerid);
new virworld = GetPlayerVirtualWorld(playerid);

If he specating and specator will be interior changed...? And he return with another interior...


Re: [HELP] Specating - Mechscape - 22.03.2010

Help! This still doenst work, took it to hopistal...


Re: [HELP] Specating - MadeMan - 22.03.2010

pawn Код:
public SpecAndmed(playerid)
{
    GetPlayerPos(playerid, specatorX, specatorY, specatorZ);
    interior = GetPlayerInterior(playerid);
    virtualworld = GetPlayerVirtualWorld(playerid);
    return 1;
}



Re: [HELP] Specating - Mechscape - 22.03.2010

Quote:
Originally Posted by MadeMan
pawn Код:
public SpecAndmed(playerid)
{
    GetPlayerPos(playerid, specatorX, specatorY, specatorZ);
    interior = GetPlayerInterior(playerid);
    virtualworld = GetPlayerVirtualWorld(playerid);
    return 1;
}
Yeah, but it still took into hopistal. Not returned to back position where he did it /spec.


Re: [HELP] Specating - MadeMan - 22.03.2010

You have to return the player to his position under OnPlayerSpawn.


Re: [HELP] Specating - Mechscape - 22.03.2010

Quote:
Originally Posted by MadeMan
You have to return the player to his position under OnPlayerSpawn.
How?