15.12.2012, 09:12
What i do with my dynamic interior system is a bit more complicated than you need, but i'll try to make this as simple as i can.
I usually do it with enums. Like this:
Like i said, it's not one the easiest methods, but it's great if you are planning to add more interiors.
I usually do it with enums. Like this:
Код:
enum prison_Interiors{ Float:entrance_Coords[ 3 ], Float:interior_Coords[ 3 ], interior_ID, virtual_World }; static const prison_Positions[ NUMBER_OF_PRISON_POSITIONS ][ prison_Interiors ] = { {{ Entrance_X, Entrance_Y, Entrance_Z }}, {{ Exit_X, Exit_Y, Exit_Z }}, Interior, Virtual World }, // Replace this with coordinates, and then add positions just down here. NUMBER_OF_PRISON_INTERIORS must be the amount of lines here, you know that probably. }; // Then you can use this example very easy, like the example below for( new i = 0; i < sizeof( prison_Positions ); ++i ) { if( IsPlayerInRangeOfPoint( playerid, 5.0, prison_Positions[ i ][ entrance_Coords ][ 0 ], prison_Positions[ i ][ entrance_Coords ][ 1 ], prison_Positions[ i ][ entrance_Coords ][ 2 ] )) { SetPlayerPos( playerid, prison_Positions[ i ][ interiors_Coords ][ 0 ], prison_Positions[ i ][ interiors_Coords ][ 1 ], prison_Positions[ i ][ interiors_Coords ][ 2 ] ); SetPlayerInterior( playerid, interior_Positions[ i ][ interior_ID ] ); SetPlayerVirtualWorld( playerid, interior_Positions[ i ][ virtual_World ] ); return true; } } // This will check if the player is in the entrance coords, put him to te interior coords, set interior id and virtual world. // And you can do the reverse process to put the player back to entrance coords