Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- h_interiors 1.0, 31.07.2011, by Hauke Marquardt alias |-|auke
- This code is free: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This code is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- You´re not allowed to copy any code from this, into your code without
- naming authors name in credits!
- */
- //========== Custom setup
- #define INTERIOR_QUANTITY 10 /* Number of maximal Interiors */
- #define LANG "Press ENTER to return" /* shown message if pickup is usable on key ENTER */
- #define WAIT_TIME 1000 /* Textdraw and pickup-locktime in milliseconds */
- #define INTERIOR_CREATOR true /* Set to true, if you want to use the intigrated AddInterior ( ... ) creator */
- //========== Additional setup
- #define STANDARD_PICKUPMODEL 1318
- #define STANDARD_PICKUPTYPE 3
- #define STANDARD_INTERIOR 0
- #define STANDARD_VIRTUALWORLD 0
- #define STANDARD_GAMETEXTSTYLE 1
- #define _CreatePickup CreatePickup /* must return specific id! */
- //========== Developer setup
- #include <a_samp>
- #define OFFSET 16235277 /* in H Coder - extrem trinary "H" */
- #define NULL -1
- #define DIALOG_IDS 432
- forward ResetInterior ( playerid );
- forward __AddInterior ( iM[ ] , iVW , iI , Float:iX , Float:iY , Float:iZ , Float:iA , iPT , iPM , iG , iAK , oM[ ] , oVW , oI , Float:oX , Float:oY , Float:oZ , Float:oA , oPT , oPM , oG , oAK );
- forward __RemoveInterior ( interior );
- enum Interior {
- GetInMessage[ 64 ],
- InVirtualWorld,
- InInteriorID,
- Float:InX,
- Float:InY,
- Float:InZ,
- Float:InAngle,
- InPickupType,
- InPickupModel,
- InGameTextStyle,
- InAllowKey,
- GetOutMessage[ 64 ],
- OutVirtualWorld,
- OutInteriorID,
- Float:OutX,
- Float:OutY,
- Float:OutZ,
- Float:OutAngle,
- OutPickupType,
- OutPickupModel,
- OutGameTextStyle,
- OutAllowKey
- }
- new const Interiors[ INTERIOR_QUANTITY ][ Interior ];
- new Interior_Pickups[ INTERIOR_QUANTITY ][ 2 ] , LastInterior[ MAX_PLAYERS ];
- public __AddInterior ( iM[ ] , iVW , iI , Float:iX , Float:iY , Float:iZ , Float:iA , iPT , iPM , iG , iAK , oM[ ] , oVW , oI , Float:oX , Float:oY , Float:oZ , Float:oA , oPT , oPM , oG , oAK ) {
- new interior = GetFreeSlot ( );
- if ( interior == NULL )
- return -1;
- format ( Interiors[ interior ][ GetInMessage ] , 64 , iM );
- Interiors[ interior ][ InVirtualWorld ] = iVW == NULL ? STANDARD_VIRTUALWORLD : iVW;
- Interiors[ interior ][ InInteriorID ] = iI;
- Interiors[ interior ][ InX ] = iX;
- Interiors[ interior ][ InY ] = iY;
- Interiors[ interior ][ InZ ] = iZ;
- Interiors[ interior ][ InAngle ] = iA;
- Interiors[ interior ][ InPickupType ] = iPT;
- Interiors[ interior ][ InPickupModel ] = iPM;
- Interiors[ interior ][ InGameTextStyle ] = iG;
- Interiors[ interior ][ InAllowKey ] = iAK;
- format ( Interiors [ interior ][ GetOutMessage ] , 64 , oM );
- Interiors[ interior ][ OutVirtualWorld ] = oVW;
- Interiors[ interior ][ OutInteriorID ] = oI;
- Interiors[ interior ][ OutX ] = oX;
- Interiors[ interior ][ OutY ] = oY;
- Interiors[ interior ][ OutZ ] = oZ;
- Interiors[ interior ][ OutAngle ] = oA;
- Interiors[ interior ][ OutPickupType ] = oPT;
- Interiors[ interior ][ OutPickupModel ] = oPM;
- Interiors[ interior ][ OutGameTextStyle ] = oG;
- Interiors[ interior ][ OutAllowKey ] = oAK;
- Interior_Pickups[ interior ][ 0 ] = _CreatePickup ( ( Interiors[ interior ][ InPickupModel ] == NULL ) ? STANDARD_PICKUPMODEL : Interiors[ interior ][ InPickupModel ] , ( Interiors[ interior ][ InPickupType ] == NULL ) ? STANDARD_PICKUPTYPE : Interiors[ interior ][ InPickupType ] , Interiors[ interior ][ InX ] , Interiors[ interior ][ InY ] , Interiors[ interior ][ InZ ] , Interiors[ interior ][ OutVirtualWorld ] ) + OFFSET;
- Interior_Pickups[ interior ][ 1 ] = _CreatePickup ( ( Interiors[ interior ][ OutPickupModel ] == NULL ) ? STANDARD_PICKUPMODEL : Interiors[ interior ][ OutPickupModel ] , ( Interiors[ interior ][ OutPickupType ] == NULL ) ? STANDARD_PICKUPTYPE : Interiors[ interior ][ OutPickupType ] , Interiors[ interior ][ OutX ] , Interiors[ interior ][ OutY ] , Interiors[ interior ][ OutZ ] , Interiors[ interior ][ InVirtualWorld ] ) + OFFSET;
- return interior;
- }
- public __RemoveInterior ( interior ) {
- if ( !IsInterior ( interior ) )
- return false;
- DestroyPickup ( Interior_Pickups[ interior ][ 0 ] - OFFSET );
- DestroyPickup ( Interior_Pickups[ interior ][ 1 ] - OFFSET );
- Interior_Pickups[ interior ][ 0 ] = 0;
- return true;
- }
- public OnFilterScriptInit ( ) {
- printf ( " H Interiors is loading..." );
- #if WAIT_TIME < 500
- printf ( " H_Interiors: FilterScript is set incorrectly! ( WAIT_TIME is less than 500 )" );
- SendRconCommand ( "exit" );
- #endif
- #if OFFSET < 1
- printf ( " H_Interiors: FilterScript is set incorrectly! ( OFFSET is less than 1 )" );
- SendRconCommand ( "exit" );
- #endif
- printf ( " H Interiors was setted up correctly and was started now!" );
- }
- public OnFilterScriptExit ( ) {
- return 1;
- }
- public OnPlayerPickUpPickup ( playerid , pickupid )
- for ( new interior; interior < sizeof Interiors; interior++ )
- if ( Interior_Pickups[ interior ][ 0 ] == pickupid + OFFSET && LastInterior[ playerid ] != interior + OFFSET && IsInterior ( interior ) ) {
- GoInInterior ( playerid , interior );
- break;
- }
- else if ( Interior_Pickups[ interior ][ 1 ] == pickupid + OFFSET && LastInterior[ playerid ] != interior + OFFSET && IsInterior ( interior ) ) {
- GoOutInterior ( playerid , interior );
- break;
- }
- public OnPlayerKeyStateChange ( playerid , newkeys , oldkeys )
- if(newkeys & KEY_SECONDARY_ATTACK)
- for ( new interior; interior < sizeof Interiors; interior++ )
- if ( IsPlayerInRangeOfPoint ( playerid , 2 , Interiors[ interior ][ InX ], Interiors[ interior ][ InY ], Interiors[ interior ][ InZ ] ) && Interiors[ interior ][ OutAllowKey ] && GetPlayerVirtualWorld ( playerid ) == Interiors[ interior ][ InVirtualWorld ] && IsInterior ( interior ) )
- GoInInterior ( playerid , interior );
- else if ( IsPlayerInRangeOfPoint ( playerid , 2 , Interiors[ interior ][ OutX ], Interiors[ interior ][ OutY ], Interiors[ interior ][ OutZ ] ) && Interiors[ interior ][ InAllowKey ] && GetPlayerVirtualWorld ( playerid ) == Interiors[ interior ][ OutVirtualWorld ] && IsInterior ( interior ) )
- GoOutInterior ( playerid , interior );
- public ResetInterior ( playerid )
- return LastInterior[ playerid ] = 0 - ( OFFSET + 1 );
- stock GoInInterior ( playerid , interior ) {
- new msg[128];
- if ( Interiors[ interior ][ InAllowKey ] )
- format ( msg , 128 , "%s~n~~y~%s" , Interiors[ interior ][ GetInMessage ] , LANG );
- else
- format ( msg , 128 , Interiors[ interior ][ GetInMessage ] );
- LastInterior[ playerid ] = interior + OFFSET;
- SetPlayerInterior ( playerid , ( Interiors[ interior ][ OutInteriorID ] == NULL ) ? STANDARD_INTERIOR : Interiors[ interior ][ OutInteriorID ] );
- SetPlayerPos ( playerid , Interiors[ interior ][ OutX ] , Interiors[ interior ][ OutY ] , Interiors[ interior ][ OutZ ] );
- SetPlayerFacingAngle ( playerid , Interiors[ interior ][ OutAngle ] );
- SetPlayerVirtualWorld ( playerid , Interiors[ interior ][ OutVirtualWorld ] );
- GameTextForPlayer ( playerid , msg , WAIT_TIME - 500 , ( Interiors[ interior ][ OutGameTextStyle ] == NULL ) ? STANDARD_GAMETEXTSTYLE : Interiors[ interior ][ OutGameTextStyle ] );
- SetTimerEx ( "ResetInterior" , WAIT_TIME , 0 , "i" , playerid );
- }
- stock GoOutInterior ( playerid , interior ) {
- new msg[128];
- if ( Interiors[ interior ][ OutAllowKey ] )
- format ( msg , 128 , "%s~n~~y~%s" , Interiors[ interior ][ GetOutMessage ] , LANG );
- else
- format ( msg , 128 , Interiors[ interior ][ GetInMessage ] );
- LastInterior[ playerid ] = interior + OFFSET;
- SetPlayerInterior ( playerid , ( Interiors[ interior ][ InInteriorID ] == NULL ) ? STANDARD_INTERIOR : Interiors[ interior ][ InInteriorID ] );
- SetPlayerPos ( playerid , Interiors[ interior ][ InX ] , Interiors[ interior ][ InY ] , Interiors[ interior ][ InZ ] );
- SetPlayerFacingAngle ( playerid , Interiors[ interior ][ InAngle ] );
- SetPlayerVirtualWorld ( playerid , Interiors[ interior ][ InVirtualWorld ] );
- GameTextForPlayer ( playerid , msg , WAIT_TIME - 500 , ( Interiors[ interior ][ InGameTextStyle ] == NULL ) ? STANDARD_GAMETEXTSTYLE : Interiors[ interior ][ InGameTextStyle ] );
- SetTimerEx ( "ResetInterior" , WAIT_TIME , 0 , "i" , playerid );
- }
- stock GetFreeSlot ( ) {
- for ( new interior; interior < sizeof Interiors; interior++ )
- if ( !Interior_Pickups[ interior ][ 0 ] )
- return interior;
- return NULL;
- }
- stock IsInterior ( interior )
- return Interior_Pickups[ interior ][ 0 ] ? true : false;
- #if INTERIOR_CREATOR == true
- new const f = false;
- #define HELP_CENTER_LIST "#help\t\t: Open H Interiors help center\r\n#new\t\t: Opens AddInterior Generator\r\n#setenter\t: Set position of enter pickup\r\n#setexit\t: Set position of exit pickup\r\n#spp\t\t: H inGameSetPlayerPos"
- #define INTERIOR_CREATOR_HEADLINE "H Interiors - AddInterior Creator"
- #define SPP "H inGameSetPlayerPos"
- #define CLEAR_CHAT for ( new m; m < 11; m++ ) SendClientMessage ( playerid , 0xFFFFFF , "" );
- #define OPERATION_CANCELED() do { p[ playerid ][ CreatorStep ] = 0; CLEAR_CHAT SendClientMessage ( playerid , 0x99001FAA , "Operation canceled" ); } while ( f )
- enum data {
- CreatorStep,
- Float:iX,
- Float:iY,
- Float:iZ,
- Float:iA,
- iIID,
- iVW,
- iM[ 64 ],
- iAK,
- Float:oX,
- Float:oY,
- Float:oZ,
- Float:oA,
- oIID,
- oVW,
- oM[ 64 ],
- oAK
- }
- enum temp_data {
- Float:sX,
- Float:sY,
- Float:sZ,
- }
- new p[ MAX_PLAYERS ][ data ];
- new tp[ MAX_PLAYERS ][ temp_data ];
- public OnPlayerText ( playerid , text[] ) {
- if ( text[ 0 ] == '#' && text[ 1 ] != '\0' && text[ 1 ] != ' ' && IsPlayerAdmin ( playerid ) ) {
- if ( !strcmp ( "#setexit" , text ) ) {
- if ( p[ playerid ][ CreatorStep ] < 3 ) {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "You have to use \"#setenter\" before!" );
- return 0;
- }
- new Float:X , Float:Y , Float:Z , InteriorID , msg[ 512 ];
- GetPlayerPos ( playerid , X , Y , Z );
- InteriorID = GetPlayerInterior ( playerid );
- format ( msg , 512 , "You are located:\r\nX:\t\t%f\r\nY:\t\t%f\r\nZ:\t\t%f\r\nInterior:\t%i\r\n\nDo you really want to set the exit-pickup to this position?\r\nRemember that the players will go exact to this position and angle on entering Interior!!" , X , Y , Z , InteriorID );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 9, DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , msg , "Yes" , "No" );
- return 0;
- }
- if ( !strcmp ( "#spp" , text ) ) {
- ShowPlayerDialog ( playerid , DIALOG_IDS + 5 , DIALOG_STYLE_INPUT , SPP , "Type in the X float" , "Next" , "Cancel" );
- return 0;
- }
- if ( !strcmp ( "#setenter" , text ) ) {
- if ( p[ playerid ][ CreatorStep ] < 1 ) {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "First use \"#new\"!" );
- return 0;
- }
- new Float:X , Float:Y , Float:Z , InteriorID , msg[ 512 ];
- GetPlayerPos ( playerid , X , Y , Z );
- InteriorID = GetPlayerInterior ( playerid );
- format ( msg , 512 , "You are located:\r\nX:\t\t%f\r\nY:\t\t%f\r\nZ:\t\t%f\r\nInterior:\t%i\r\n\nDo you really want to set the enter-pickup to this position?\r\nRemember that the players will go exact to this position and angle on leaving Interior!!" , X , Y , Z , InteriorID );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 3, DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , msg , "Yes" , "No" );
- return 0;
- }
- if ( !strcmp ( "#new" , text ) ) {
- ShowPlayerDialog ( playerid , DIALOG_IDS + 2, DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , "Please go to the Enter Point of you new Interior / Teleport.\r\nThen type \"#setenter\" to continue..." , "OK" , "Cancel" );
- return 0;
- }
- if ( !strcmp ( "#help" , text ) ) {
- ShowPlayerDialog ( playerid , DIALOG_IDS + 1 , DIALOG_STYLE_LIST , "H Interiors - Help Center" , HELP_CENTER_LIST , "Select" , "Close" );
- return 0;
- }
- ShowPlayerDialog ( playerid , DIALOG_IDS , DIALOG_STYLE_MSGBOX , "H Interiors - Error" , "The command you entered is not valid H Interiors command!" , "Help Center" , "OK" );
- return 0;
- }
- return 1;
- }
- public OnDialogResponse ( playerid , dialogid , response , listitem , inputtext[ ] ) {
- if ( !IsPlayerAdmin ( playerid ) )
- return 0;
- switch ( dialogid ) {
- case DIALOG_IDS:
- if ( response )
- ShowPlayerDialog ( playerid , DIALOG_IDS + 1 , DIALOG_STYLE_LIST , "H Interiors - Help Center" , HELP_CENTER_LIST , "Select" , "Close" );
- case DIALOG_IDS + 1:
- if ( response )
- switch ( listitem ) {
- case 0:
- ShowPlayerDialog ( playerid , DIALOG_IDS + 1 , DIALOG_STYLE_LIST , "H Interiors - Help Center" , HELP_CENTER_LIST , "Select" , "Close" );
- case 1:
- if ( p[ playerid ][ CreatorStep ] != 0 ) {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "AddInterior Generator is already in progress!" );
- SendClientMessage ( playerid , 0xFFFFFF , "" );
- SendClientMessage ( playerid , 0x6600CC , "Your next step is to use \"#setenter\"" );
- }
- else
- ShowPlayerDialog ( playerid , DIALOG_IDS + 2 , DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , "Please go to the Enter Point of you new Interior / Teleport.\r\nThen type \"#setenter\" to continue..." , "OK" , "Cancel" );
- case 2: {
- if ( p[ playerid ][ CreatorStep ] < 1 ) {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "First use \"#new\"!" );
- return 0;
- }
- new Float:X , Float:Y , Float:Z , InteriorID , msg[ 512 ];
- GetPlayerPos ( playerid , X , Y , Z );
- InteriorID = GetPlayerInterior ( playerid );
- format ( msg , 512 , "You are located:\r\nX:\t\t%f\r\nY:\t\t%f\r\nZ:\t\t%f\r\nInterior:\t%i\r\n\nDo you really want to set the enter pickup to this position?\r\nRemember that the players will go exact to this position and angle on leaving Interior!!" , X , Y , Z , InteriorID );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 3, DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , msg , "Yes" , "No" );
- }
- case 3: {
- if ( p[ playerid ][ CreatorStep ] < 3 ) {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "You have to use \"#setenter\" before!" );
- return 0;
- }
- new Float:X , Float:Y , Float:Z , InteriorID , msg[ 512 ];
- GetPlayerPos ( playerid , X , Y , Z );
- InteriorID = GetPlayerInterior ( playerid );
- format ( msg , 512 , "You are located:\r\nX:\t\t%f\r\nY:\t\t%f\r\nZ:\t\t%f\r\nInterior:\t%i\r\n\nDo you really want to set the exit-pickup to this position?\r\nRemember that the players will go exact to this position and angle on entering Interior!!" , X , Y , Z , InteriorID );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 9, DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , msg , "Yes" , "No" );
- }
- case 4:
- ShowPlayerDialog ( playerid , DIALOG_IDS + 5 , DIALOG_STYLE_INPUT , SPP , "Type in the X float" , "Next" , "Cancel" );
- }
- case DIALOG_IDS + 2: {
- if ( response ) {
- p[ playerid ][ CreatorStep ] = 1;
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x6600CC , "Now please go to the point where your Interior or Teleport should be." );
- SendClientMessage ( playerid , 0x6600CC , "Then type \"#setenter\" to continue." );
- }
- else
- OPERATION_CANCELED ( );
- }
- case DIALOG_IDS + 3: {
- if ( response ) {
- GetPlayerPos ( playerid , p[ playerid ][ iX ] , p[ playerid ][ iY ] , p[ playerid ][ iZ ] );
- GetPlayerFacingAngle ( playerid , p[ playerid ][ iA ] );
- p[ playerid ][ iIID ] = GetPlayerInterior ( playerid );
- p[ playerid ][ CreatorStep ] = 2;
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x6600CC , "This position was successfully saved!" );
- SendClientMessage ( playerid , 0x6600CC , "Now lets go on!" );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 4 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , "In wich VirtualWorld should be the pickup?\r\nType in a positive number.\r\nIf you want the standard, type in nothing!" , "Next" , "Back" );
- }
- else {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "Ok, then try to find a better place..." );
- SendClientMessage ( playerid , 0xFFFFFF , "" );
- SendClientMessage ( playerid , 0x6600CC , "Now please go to the point where your Interior or Teleport should be." );
- SendClientMessage ( playerid , 0x6600CC , "Then type \"#setenter\" to continue." );
- }
- }
- case DIALOG_IDS + 4: {
- if ( response ) {
- if ( strlen ( inputtext ) ) {
- if ( strval ( inputtext ) > 0 ) {
- p[ playerid ][ iVW ] = strval ( inputtext );
- p[ playerid ][ CreatorStep ] = 3;
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x6600CC , "Perfect!" );
- SendClientMessage ( playerid , 0x6600CC , "Now go and search for a good point for the exit-pickup!" );
- SendClientMessage ( playerid , 0x6600CC , "If it is to be in an interior, you might find \"H inGameSetPlayerPos\" with integrated interior function usefull..." );
- SendClientMessage ( playerid , 0x6600CC , "Use it by typing \"#spp\"" );
- }
- else {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 4 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , "In wich VirtualWorld should be the pickup?\r\nType in a positive number.\r\nIf you want the standard, type in nothing!" , "Next" , "Back" );
- }
- }
- else {
- p[ playerid ][ iVW ] = NULL;
- p[ playerid ][ CreatorStep ] = 3;
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x6600CC , "Perfect!" );
- SendClientMessage ( playerid , 0x6600CC , "Now go and search for a good point for the exit-pickup! Then type \"#setexit\"." );
- SendClientMessage ( playerid , 0x6600CC , "If it is to be in an interior, you might find \"H inGameSetPlayerPos\" with integrated interior function usefull..." );
- SendClientMessage ( playerid , 0x6600CC , "Use it by typing \"#spp\"" );
- }
- }
- else
- OPERATION_CANCELED ( );
- }
- case DIALOG_IDS + 5: {
- if ( response ) {
- if ( strfind ( inputtext , "." ) != -1 ) {
- tp[ playerid ][ sX ] = floatstr ( inputtext );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 6 , DIALOG_STYLE_INPUT , SPP , "Type in the Y float" , "Next" , "Cancel" );
- }
- else {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 5 , DIALOG_STYLE_INPUT , SPP , "Type in the X float" , "Next" , "Cancel" );
- }
- }
- else
- OPERATION_CANCELED ( );
- }
- case DIALOG_IDS + 6: {
- if ( response ) {
- if ( strfind ( inputtext , "." ) != -1 ) {
- tp[ playerid ][ sY ] = floatstr ( inputtext );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 7 , DIALOG_STYLE_INPUT , SPP , "Type in the Z float" , "Next" , "Cancel" );
- }
- else {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 6 , DIALOG_STYLE_INPUT , SPP , "Type in the Y float" , "Next" , "Cancel" );
- }
- }
- else
- OPERATION_CANCELED ( );
- }
- case DIALOG_IDS + 7: {
- if ( response ) {
- if ( strfind ( inputtext , "." ) != -1 ) {
- tp[ playerid ][ sZ ] = floatstr ( inputtext );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 8 , DIALOG_STYLE_INPUT , SPP , "Type in the interior id.\r\nLook them up at: http://wiki.sa-mp.com/wiki/Interiors" , "Next" , "Cancel" );
- }
- else {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 7 , DIALOG_STYLE_INPUT , SPP , "Type in the Z float" , "Next" , "Cancel" );
- }
- }
- else
- OPERATION_CANCELED ( );
- }
- case DIALOG_IDS + 8: {
- if ( response ) {
- if ( strval ( inputtext ) ) {
- SetPlayerInterior ( playerid , strval ( inputtext ) );
- SetPlayerPos ( playerid , tp[ playerid ][ sX ] , tp[ playerid ][ sY ] , tp[ playerid ][ sZ ] );
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x6600CC , "Wooosh!" );
- }
- else {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 8 , DIALOG_STYLE_INPUT , SPP , "Type in the interior id.\r\nLook them up at: http://wiki.sa-mp.com/wiki/Interiors" , "Next" , "Cancel" );
- }
- }
- else
- OPERATION_CANCELED ( );
- }
- case DIALOG_IDS + 9: {
- if ( response ) {
- GetPlayerPos ( playerid , p[ playerid ][ oX ] , p[ playerid ][ oY ] , p[ playerid ][ oZ ] );
- GetPlayerFacingAngle ( playerid , p[ playerid ][ oA ] );
- p[ playerid ][ oIID ] = GetPlayerInterior ( playerid );
- p[ playerid ][ CreatorStep ] = 4;
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x6600CC , "This position was successfully saved!" );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 10 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , "In wich VirtualWorld should be the exit-pickup?\r\nType in a positive number.\r\nIf you want the standard, type in nothing!" , "Next" , "Back" );
- }
- else {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "Ok, then try to find a better place..." );
- SendClientMessage ( playerid , 0xFFFFFF , "" );
- SendClientMessage ( playerid , 0x6600CC , "Now please go to the point where your exit-pickup should be." );
- SendClientMessage ( playerid , 0x6600CC , "Then type \"#setexit\" to continue." );
- }
- }
- case DIALOG_IDS + 10: {
- if ( response ) {
- if ( strlen ( inputtext ) ) {
- if ( strval ( inputtext ) > 0 ) {
- p[ playerid ][ oVW ] = strval ( inputtext );
- p[ playerid ][ CreatorStep ] = 5;
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x6600CC , "Great!" );
- SendClientMessage ( playerid , 0x6600CC , "Now we do the fine adjustment!" );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 11 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , "Write the text to be displayed when the player enters the interior." , "Next" , "Back" );
- }
- else {
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 10 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , "In wich VirtualWorld should be the exit-pickup?\r\nType in a positive number.\r\nIf you want the standard, type in nothing!" , "Next" , "Back" );
- }
- }
- else {
- p[ playerid ][ oVW ] = NULL;
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x6600CC , "Great!" );
- SendClientMessage ( playerid , 0x6600CC , "Now we do the fine adjustment!" );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 11 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , "Write the text to be displayed when the player ENTERS the interior." , "Next" , "Next" );
- }
- }
- else
- OPERATION_CANCELED ( );
- }
- case DIALOG_IDS + 11: {
- new msg [ 128 ];
- format ( p[ playerid ][ iM ] , 64 , inputtext );
- format ( msg , 256 , "Saved enter-message: %s\r\nWrite the text to be displayed when the player EXITS the interior." , inputtext );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 12 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , msg , "Next" , "Back" );
- }
- case DIALOG_IDS + 12: {
- if ( response ) {
- new msg [ 256 ];
- format ( p[ playerid ][ oM ] , 64 , inputtext );
- format ( msg , 256 , "Saved exit-message: %s\r\nWould you like to allow that players can press ENTER instead of picking up a pickup at ENTERING this interior?" , inputtext );
- ShowPlayerDialog ( playerid , DIALOG_IDS + 13 , DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , msg , "Yes" , "No" );
- }
- else
- ShowPlayerDialog ( playerid , DIALOG_IDS + 11 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , "Write the text to be displayed when the player ENTERS the interior." , "Next" , "" );
- }
- case DIALOG_IDS + 13: {
- if ( response )
- p[ playerid ][ iAK ] = 1;
- else
- p[ playerid ][ iAK ] = 0;
- ShowPlayerDialog ( playerid , DIALOG_IDS + 14 , DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , "Ok! Saved boss!\r\nWould you like to allow that players can press ENTER instead of picking up a pickup at LEAVING this interior?" , "Yes" , "No" );
- }
- case DIALOG_IDS + 14: {
- if ( response )
- p[ playerid ][ oAK ] = 1;
- else
- p[ playerid ][ oAK ] = 0;
- ShowPlayerDialog ( playerid , DIALOG_IDS + 15 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , "All saved!\r\nNow enter a nice sounding name to identify you interior." , "Next" , "" );
- }
- case DIALOG_IDS + 15: {
- if ( strlen ( inputtext ) ) {
- new filename[ 32 ] , File:adi , msg[ 128 ] , function[ 1024 ] , temp_function[ 512 ] , VWorld[ 5 ] , AK[ 5 ];
- if ( p[ playerid ][ iVW ] == NULL )
- format ( VWorld , 5 , "NULL" );
- else
- format ( VWorld , 5 , p[ playerid ][ iVW ] );
- if ( p[ playerid ][ iAK ] == 1 )
- format ( AK , 5 , "YES" );
- else
- format ( AK , 5 , "NO" );
- format ( function , 1024 , "AddInterior ( \"%s\" , %s , %d , %f , %f , %f , %f , NULL , NULL , NULL , %s " , p[ playerid ][ iM ] , VWorld , p[ playerid ][ iIID ] , p[ playerid ][ iX ] , p[ playerid ][ iY ] , p[ playerid ][ iZ ] , p[ playerid ][ iA ] , AK );
- if ( p[ playerid ][ oVW ] == NULL )
- format ( VWorld , 5 , "NULL" );
- else
- format ( VWorld , 5 , p[ playerid ][ oVW ] );
- if ( p[ playerid ][ oAK ] == 1 )
- format ( AK , 5 , "YES" );
- else
- format ( AK , 5 , "NO" );
- format ( temp_function , 512 , ", \"%s\" , %s , %d , %f , %f , %f , %f , NULL , NULL , NULL , %s );" , p[ playerid ][ oM ] , VWorld , p[ playerid ][ oIID ] , p[ playerid ][ oX ] , p[ playerid ][ oY ] , p[ playerid ][ oZ ] , p[ playerid ][ oA ] , AK );
- strcat ( function , temp_function );
- format ( filename , 32 , "%s.adi" , inputtext );
- adi = fopen ( filename , io_readwrite );
- fwrite ( adi , function );
- fclose ( adi );
- format ( msg , 128 , "You new interior %s was created in %s.adi" , inputtext , inputtext );
- p [ playerid ][ CreatorStep ] = 0;
- CLEAR_CHAT
- SendClientMessage ( playerid , 0x6600CC , "Thank you darling!" );
- }
- else
- ShowPlayerDialog ( playerid , DIALOG_IDS + 15 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , "No name entered! Try again.\r\nNow enter a nice sounding name to identify you interior." , "Next" , "" );
- }
- }
- return 0;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement