public OnPlayerConnect( playerid ) {
if( fexist( find_accPath( playerid ) ) ) { //They are returning users - Account already exists!
INI_ParseFile(find_accPath(playerid), "LoadAccount_%s", .bExtra = true, .extra = playerid);
LOGDIALOG;
}
else { //They are new users - Account does not exist!
REGDIALOG;
}
SetPlayerTime(playerid, 0, 0);
JoinVehicle[ playerid ] = CreateVehicle ( 411, 92.7663, -164.9878, 2.5938, 269.3596, 3, 3, 360000 );
SetVehicleVirtualWorld( JoinVehicle[ playerid ], playerid+1 );
SetPlayerVirtualWorld( playerid, playerid+1 );
PutPlayerInVehicle( playerid, JoinVehicle[ playerid ], 0 );
TogglePlayerControllable( playerid, 0 );
TogglePlayerSpectating( playerid, 1 );
SetPlayerCameraPos( playerid, 100.9195, -164.8617, 2.5182 );
SetPlayerCameraLookAt( playerid, 92.7663, -164.9878, 2.5938 );
firstSpawn[ playerid ] = true;
return true;
}
public OnPlayerSpawn( playerid ) {
if(firstSpawn[ playerid ] == true ) {
DestroyVehicle( JoinVehicle[ playerid ] );
TogglePlayerSpectating( playerid, 0 );
SetPlayerVirtualWorld( playerid, 0 );
SetCameraBehindPlayer( playerid );
firstSpawn[ playerid ] = false;
}
return true;
}
Before I added TogglePlayerSpectating, this code worked perfectly - what happened to it?
|
What happened is that you added TogglePlayerSpectating. Remove it and see if it fixes the problem.
|
Well, how does it not work perfectly? Do you mean like the login/register wise? Or camera position wise?
|
Well, duh..
Camera Position-wise, sorry, I didn't specify. The camera position resets to Blueberry (the normal position near the bridge) |
It's because the player isn't spawned when you called TogglePlayerSpectating, which would set the camera to the blueberry position.
|
public OnPlayerConnect( playerid ) {
if( fexist( find_accPath( playerid ) ) ) { //They are returning users - Account already exists!
INI_ParseFile(find_accPath(playerid), "LoadAccount_%s", .bExtra = true, .extra = playerid);
LOGDIALOG;
}
else { //They are new users - Account does not exist!
REGDIALOG;
}
SetPlayerTime(playerid, 0, 0);
JoinVehicle[ playerid ] = CreateVehicle ( 411, 92.7663, -164.9878, 2.5938, 269.3596, 3, 3, -1 );
SetVehicleVirtualWorld( JoinVehicle[ playerid ], playerid+1 );
SetPlayerVirtualWorld( playerid, playerid+1 );
PutPlayerInVehicle( playerid, JoinVehicle[ playerid ], 0 );
TogglePlayerControllable( playerid, 0 );
//TogglePlayerSpectating( playerid, 1 );
SetPlayerCameraPos( playerid, 100.9195, -164.8617, 3.5182 );
SetPlayerCameraLookAt( playerid, 92.7663, -164.9878, 2.5938 );
TextDrawShowForPlayer( playerid, MissionTitle );
TextDrawShowForPlayer( playerid, RevisionNumber );
firstSpawn[ playerid ] = true;
return true;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerCameraPos( playerid, 100.9195, -164.8617, 3.5182 );
SetPlayerCameraLookAt( playerid, 92.7663, -164.9878, 2.5938 );
SetPlayerTime(playerid, 0, 0);
return true;
}
OnGameModeExit