SA-MP Forums Archive
I have a Question - 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)
+--- Thread: I have a Question (/showthread.php?tid=637832)



I have a Question - FaLLenGirL - 22.07.2017

Hello there friends.
I have a simple questions for those who knows about what i'm talking.
Why if i use "TogglePlayerSpectating( playerid, true )" at public "OnPlayerConnect( playerid )", my map that must
to appear at public "OnPlayerRequestClass( playerid, classid )" don't appear ? I disable the spectate when a player "Login/Register" because i want to use "Spectate Mode" just when a player "Login/Register".

* If i use "TogglePlayerSpectate" even if it is disabled when the public "OnPlayerRequest" comes, appears to me
when i press "<< >> or SPAWN" just parts from map and then dissapear immediate. Does anyone have any idea?


Re: I have a Question - jlalt - 22.07.2017

You mean your objects not appearing when you TogglePlayerSpectate?

well if yes then you have to use Streamer Update.
you can use this after setting player pos
PHP код:
Streamer_Update(playerid); 
or also you can use this which is more accurate.
PHP код:
 Streamer_UpdateEx(playeridFloat:xFloat:yFloat:z); 



Re: I have a Question - FaLLenGirL - 22.07.2017

Quote:
Originally Posted by jlalt
Посмотреть сообщение
You mean your objects not appearing when you TogglePlayerSpectate?

well if yes then you have to use Streamer Update.
you can use this after setting player pos
PHP код:
Streamer_Update(playerid); 
or also you can use this which is more accurate.
PHP код:
 Streamer_UpdateEx(playeridFloat:xFloat:yFloat:z); 
Hello there @jlalt

Код:
switch( classid )
	{
		case 0..55:
		{
		    SetPlayerTime( playerid, 0, 0 );
			SetPlayerInterior( playerid, 0 );

			if( GetPlayerVirtualWorld( playerid ) != 11 )
				SetPlayerVirtualWorld( playerid, 11 );

			SetPlayerPos( playerid, 1929.6469,-2818.9055,5.7799 );
			SetPlayerFacingAngle( playerid, 178.9658 );
			ApplyAnimation( playerid, "DANCING", "DAN_Loop_A", 4.0, 1, 0, 0, 0, 0 );
		 	ApplyAnimation( playerid, "DANCING", "DAN_Loop_A", 4.0, 1, 0, 0, 0, 0 );
			SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.330000, -0.079999, 0.150000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
			SetPlayerAttachedObject( playerid, 1, 18693, 5, -0.100000, 0.000000, -1.750000, 0.000000, 0.000000, 0.000000, 100.000000, 1.000000, 1.000000 );
			SetPlayerAttachedObject( playerid, 2, 18693, 6, 0.000000, 0.000000, 1.750000, 180.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
			SetPlayerCameraPos( playerid, 1928.8866, -2825.4265, 6.5730 );
			SetPlayerCameraLookAt( playerid, 1929.1681, -2824.4680, 6.5030 );
			Streamer_UpdateEx( playerid, 1931.51624, -2832.97754, 5.74180, 11 );
		}
	}
- I use this already.. or it is something wrong with it ?


Re: I have a Question - StrikerZ - 22.07.2017

Show the code of request class, I wanna clear out my doubt


Re: I have a Question - FaLLenGirL - 22.07.2017

Код:
forward OnPlayerRequestClass( playerid, classid );
public OnPlayerRequestClass( playerid, classid )
{
    HideIntroTextdraws( playerid );
	HideSpawnTextdraws( playerid );

	gPlayerSpawned[ playerid ] = false;
    gTeamSelection[ playerid ] = true;
    
	TextDrawHideForPlayer( playerid, TextAfk1 );
	TextDrawHideForPlayer( playerid, TextAfk2 );
	TextDrawHideForPlayer( playerid, Name_Intro );
	TextDrawHideForPlayer( playerid, Reaction_TD );
	
	PlayerTextDrawHide( playerid, gTerswarTD[ playerid ] );
	PlayerTextDrawHide( playerid, gTerswarBarTD[ playerid ] );
	HidePlayerProgressBar( playerid, gTerswarBar[ playerid ] );

    switch( classid )
	{
		case 0..55:
		{
		    SetPlayerTime( playerid, 0, 0 );
			SetPlayerInterior( playerid, 0 );

			if( GetPlayerVirtualWorld( playerid ) != 11 )
				SetPlayerVirtualWorld( playerid, 11 );

			SetPlayerPos( playerid, 1929.6469,-2818.9055,5.7799 );
			SetPlayerFacingAngle( playerid, 178.9658 );
			ApplyAnimation( playerid, "DANCING", "DAN_Loop_A", 4.0, 1, 0, 0, 0, 0 );
		 	ApplyAnimation( playerid, "DANCING", "DAN_Loop_A", 4.0, 1, 0, 0, 0, 0 );
			SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.330000, -0.079999, 0.150000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
			SetPlayerAttachedObject( playerid, 1, 18693, 5, -0.100000, 0.000000, -1.750000, 0.000000, 0.000000, 0.000000, 100.000000, 1.000000, 1.000000 );
			SetPlayerAttachedObject( playerid, 2, 18693, 6, 0.000000, 0.000000, 1.750000, 180.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
			SetPlayerCameraPos( playerid, 1928.8866, -2825.4265, 6.5730 );
			SetPlayerCameraLookAt( playerid, 1929.1681, -2824.4680, 6.5030 );
			Streamer_UpdateEx( playerid, 1931.51624, -2832.97754, 5.74180, 11 );
		}
	}
	return 1;
}
That's it.
Also i saw that, one of the objects it is not dynamic and appear, can be this the problem ? Maybe i must make the objects from request not dynamic ?


Re: I have a Question - jlalt - 22.07.2017

NVM...


Re: I have a Question - FaLLenGirL - 22.07.2017

if( GetPlayerVirtualWorld( playerid ) != 11 ) SetPlayerVirtualWorld( playerid, 11 );
That "11" it is for World if u look closer. The Interior is 0.


Re: I have a Question - StrikerZ - 22.07.2017

Show any 1 line of your map code


Re: I have a Question - FaLLenGirL - 22.07.2017

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
Show any 1 line of your map code
Thank you very much to all, the problem was that the objects were dynamic. Solved. Thank you.