[0.3.7] SetPlayerInterior bug
#1

Can't set player interior if player was never spawned.

SetPlayerInterior returns 1 ( success ), but GetPlayerInterior returns 0.

* I'm using spectate mode to avoid default spawn system, so it might be part of the problem.
Reply
#2

Show the code.
Reply
#3

This is not a proper bug report, you should have posted in the scripting help section.
Reply
#4

Sorry i was busy, example code:

Code:
#include <a_samp>

forward TIMER_SetInterior( playerid );


public OnGameModeInit()
{
    AddPlayerClass( 1, 207.737991, -109.019996, 1005.132812, 269.15, 26, 36, 28, 150, 0, 0 ); // CJ
	return 1;
}


public OnPlayerConnect( playerid )
{
	ShowPlayerDialog( playerid, 1, DIALOG_STYLE_MSGBOX, "Enable spectating mode", "Click next to enable spectating mode.", "Next", "" );
	return 1;
}


public OnDialogResponse( playerid, dialogid, response )
{
	if( dialogid == 1 )
	{
	    if( response )
		{
			TogglePlayerSpectating( playerid, 1 );
			SetPlayerCameraPos( playerid, 207.737991, -109.019996, 1005.532812 ); // Binco interior
			SetPlayerCameraLookAt( playerid, 207.4800, -103.9329, 1005.2578 );
			SetTimerEx( "TIMER_SetInterior", 1000, true, "i", playerid );
		}
	    return 1;
	}
	return 1;
}


public TIMER_SetInterior( playerid )
{
	SendClientMessage( playerid, -1, "Trying to set interior..." );
	
	if( SetPlayerInterior( playerid, 15 ) ) print( "SetPlayerInterior returns 1" );
	else print( "SetPlayerInterior returns 0" );
	
	printf( "GetPlayerInterior returns %i\n", GetPlayerInterior( playerid ) );
	return 1;
}


public OnPlayerSpawn( playerid )
{
	SetPlayerPos( playerid, 207.737991, -109.019996, 1005.132812 );
	return 1;
}
Reply
#5

This probably doesn't get set correctly (by that I mean the data GetPlayerInterior fetches) because you're in a spectating state. However, you SHOULD be in the interior. Use /interior on the client side, it will tell what interior ID you're in.
Reply
#6

Never encountered such bug. If you skip the class selection you'll be forced after next death unless you bypass it.
Reply
#7

Quote:
Originally Posted by J0sh...
View Post
This probably doesn't get set correctly (by that I mean the data GetPlayerInterior fetches) because you're in a spectating state. However, you SHOULD be in the interior. Use /interior on the client side, it will tell what interior ID you're in.
Hmm, yes /interior is 15, but you can't see binco interior, which should be client sided ?
And, if you remove SetPlayerCam... GTA map and water disappears, so you are in interior.

So it's GetPlayerInterior. It could be fixed with simple include, but plugins that use GetPlayerInterior ( like streamer ) would still return 0, so it's not an option, and should be fixed by Kal if possible.


Quote:
Originally Posted by Variable™
View Post
Never encountered such bug. If you skip the class selection you'll be forced after next death unless you bypass it.
Yes i'm bypass'ing it. I think that this class system should be removed, in most servers I've seen it's unused but you have to press "Spawn" to spawn in.
You don't have to remove it, just allow us to disable it. ( DisableClassSystem ? )
Reply
#8

Quote:
Originally Posted by Y_Less
View Post
Actually the bug is the fact that TogglePlayerSpectating skips class selection, which puts you in a bug state. The fact that other things don't work from this point on isn't that surprising.
Turning off spectating mode spawns and auto kicks player from server, but if you use SpawnInfo before turning off spectating mode you don't get kicked.
I have been using this "method" to skip class selection for many years now, and i haven't noticed any other problems.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)