Advertisement
Hauke

h_interiors

Jul 31st, 2011
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 27.94 KB | None | 0 0
  1. /*
  2.     h_interiors 1.0, 31.07.2011, by Hauke Marquardt alias |-|auke
  3.  
  4.     This code is free: you can redistribute it and/or modify
  5.     it under the terms of the GNU General Public License as published by
  6.     the Free Software Foundation, either version 3 of the License, or
  7.     (at your option) any later version.
  8.  
  9.     This code is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU General Public License
  15.     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16.     You´re not allowed to copy any code from this, into your code without
  17.     naming authors name in credits!
  18. */
  19. //========== Custom setup
  20. #define INTERIOR_QUANTITY 10                /* Number of maximal Interiors */
  21. #define LANG "Press ENTER to return"        /* shown message if pickup is usable on key ENTER */
  22. #define WAIT_TIME 1000                      /* Textdraw and pickup-locktime in milliseconds */
  23. #define INTERIOR_CREATOR true               /* Set to true, if you want to use the intigrated AddInterior ( ... ) creator */
  24. //========== Additional setup
  25. #define STANDARD_PICKUPMODEL 1318
  26. #define STANDARD_PICKUPTYPE 3
  27. #define STANDARD_INTERIOR 0
  28. #define STANDARD_VIRTUALWORLD 0
  29. #define STANDARD_GAMETEXTSTYLE 1
  30. #define _CreatePickup CreatePickup          /* must return specific id! */
  31. //========== Developer setup
  32. #include <a_samp>
  33. #define OFFSET 16235277                     /* in H Coder - extrem trinary "H" */
  34. #define NULL -1
  35. #define DIALOG_IDS 432
  36.  
  37. forward ResetInterior ( playerid );
  38. 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 );
  39. forward __RemoveInterior ( interior );
  40.  
  41. enum Interior {
  42.     GetInMessage[ 64 ],
  43.     InVirtualWorld,
  44.     InInteriorID,
  45.     Float:InX,
  46.     Float:InY,
  47.     Float:InZ,
  48.     Float:InAngle,
  49.     InPickupType,
  50.     InPickupModel,
  51.     InGameTextStyle,
  52.     InAllowKey,
  53.     GetOutMessage[ 64 ],
  54.     OutVirtualWorld,
  55.     OutInteriorID,
  56.     Float:OutX,
  57.     Float:OutY,
  58.     Float:OutZ,
  59.     Float:OutAngle,
  60.     OutPickupType,
  61.     OutPickupModel,
  62.     OutGameTextStyle,
  63.     OutAllowKey
  64. }
  65.  
  66. new const Interiors[ INTERIOR_QUANTITY ][ Interior ];
  67. new Interior_Pickups[ INTERIOR_QUANTITY ][ 2 ] , LastInterior[ MAX_PLAYERS ];
  68.  
  69. 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 ) {
  70.     new interior = GetFreeSlot ( );
  71.     if ( interior == NULL )
  72.         return -1;
  73.     format ( Interiors[ interior ][ GetInMessage ] , 64 , iM );
  74.     Interiors[ interior ][ InVirtualWorld ] = iVW == NULL ? STANDARD_VIRTUALWORLD : iVW;
  75.     Interiors[ interior ][ InInteriorID ] = iI;
  76.     Interiors[ interior ][ InX ] = iX;
  77.     Interiors[ interior ][ InY ] = iY;
  78.     Interiors[ interior ][ InZ ] = iZ;
  79.     Interiors[ interior ][ InAngle ] = iA;
  80.     Interiors[ interior ][ InPickupType ] = iPT;
  81.     Interiors[ interior ][ InPickupModel ] = iPM;
  82.     Interiors[ interior ][ InGameTextStyle ] = iG;
  83.     Interiors[ interior ][ InAllowKey ] = iAK;
  84.     format ( Interiors [ interior ][ GetOutMessage ] , 64 , oM );
  85.     Interiors[ interior ][ OutVirtualWorld ] = oVW;
  86.     Interiors[ interior ][ OutInteriorID ] = oI;
  87.     Interiors[ interior ][ OutX ] = oX;
  88.     Interiors[ interior ][ OutY ] = oY;
  89.     Interiors[ interior ][ OutZ ] = oZ;
  90.     Interiors[ interior ][ OutAngle ] = oA;
  91.     Interiors[ interior ][ OutPickupType ] = oPT;
  92.     Interiors[ interior ][ OutPickupModel ] = oPM;
  93.     Interiors[ interior ][ OutGameTextStyle ] = oG;
  94.     Interiors[ interior ][ OutAllowKey ] = oAK;
  95.     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;
  96.     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;
  97.     return interior;
  98. }
  99.  
  100. public __RemoveInterior ( interior ) {
  101.     if ( !IsInterior ( interior ) )
  102.         return false;
  103.     DestroyPickup ( Interior_Pickups[ interior ][ 0 ] - OFFSET );
  104.     DestroyPickup ( Interior_Pickups[ interior ][ 1 ] - OFFSET );
  105.     Interior_Pickups[ interior ][ 0 ] = 0;
  106.     return true;
  107. }
  108.  
  109. public OnFilterScriptInit ( ) {
  110.     printf ( "    H Interiors is loading..." );
  111.     #if WAIT_TIME < 500
  112.         printf ( "    H_Interiors: FilterScript is set incorrectly!  ( WAIT_TIME is less than 500 )" );
  113.         SendRconCommand ( "exit" );
  114.     #endif
  115.     #if OFFSET < 1
  116.         printf ( "    H_Interiors: FilterScript is set incorrectly!  ( OFFSET is less than 1 )" );
  117.         SendRconCommand ( "exit" );
  118.     #endif
  119.     printf ( "    H Interiors was setted up correctly and was started now!" );
  120. }
  121.  
  122. public OnFilterScriptExit ( ) {
  123.     return 1;
  124. }
  125.  
  126. public OnPlayerPickUpPickup ( playerid , pickupid )
  127.     for ( new interior; interior < sizeof Interiors; interior++ )
  128.         if ( Interior_Pickups[ interior ][ 0 ] == pickupid + OFFSET && LastInterior[ playerid ] != interior + OFFSET && IsInterior ( interior ) ) {
  129.             GoInInterior ( playerid , interior );
  130.             break;
  131.         }
  132.         else if ( Interior_Pickups[ interior ][ 1 ] == pickupid + OFFSET && LastInterior[ playerid ] != interior + OFFSET && IsInterior ( interior ) ) {
  133.             GoOutInterior ( playerid , interior );
  134.             break;
  135.         }
  136.  
  137. public OnPlayerKeyStateChange ( playerid , newkeys , oldkeys )
  138.     if(newkeys & KEY_SECONDARY_ATTACK)
  139.         for ( new interior; interior < sizeof Interiors; interior++ )
  140.             if ( IsPlayerInRangeOfPoint ( playerid , 2 , Interiors[ interior ][ InX ], Interiors[ interior ][ InY ], Interiors[ interior ][ InZ ] ) && Interiors[ interior ][ OutAllowKey ] && GetPlayerVirtualWorld ( playerid ) == Interiors[ interior ][ InVirtualWorld ] && IsInterior ( interior ) )
  141.                 GoInInterior ( playerid , interior );
  142.             else if ( IsPlayerInRangeOfPoint ( playerid , 2 , Interiors[ interior ][ OutX ], Interiors[ interior ][ OutY ], Interiors[ interior ][ OutZ ] ) && Interiors[ interior ][ InAllowKey ] && GetPlayerVirtualWorld ( playerid ) == Interiors[ interior ][ OutVirtualWorld ] && IsInterior ( interior ) )
  143.                 GoOutInterior ( playerid , interior );
  144.  
  145. public ResetInterior ( playerid )
  146.     return LastInterior[ playerid ] = 0 - ( OFFSET + 1 );
  147.  
  148. stock GoInInterior ( playerid , interior ) {
  149.     new msg[128];
  150.     if ( Interiors[ interior ][ InAllowKey ] )
  151.         format ( msg , 128 , "%s~n~~y~%s" , Interiors[ interior ][ GetInMessage ] , LANG );
  152.     else
  153.         format ( msg , 128 , Interiors[ interior ][ GetInMessage ] );
  154.     LastInterior[ playerid ] = interior + OFFSET;
  155.     SetPlayerInterior ( playerid , ( Interiors[ interior ][ OutInteriorID ] == NULL ) ? STANDARD_INTERIOR : Interiors[ interior ][ OutInteriorID ] );
  156.     SetPlayerPos ( playerid , Interiors[ interior ][ OutX ] , Interiors[ interior ][ OutY ] , Interiors[ interior ][ OutZ ] );
  157.     SetPlayerFacingAngle ( playerid , Interiors[ interior ][ OutAngle ] );
  158.     SetPlayerVirtualWorld ( playerid , Interiors[ interior ][ OutVirtualWorld ] );
  159.     GameTextForPlayer ( playerid , msg , WAIT_TIME - 500 , ( Interiors[ interior ][ OutGameTextStyle ] == NULL ) ? STANDARD_GAMETEXTSTYLE : Interiors[ interior ][ OutGameTextStyle ] );
  160.     SetTimerEx ( "ResetInterior" , WAIT_TIME , 0 , "i" , playerid );
  161. }
  162.  
  163. stock GoOutInterior ( playerid , interior ) {
  164.     new msg[128];
  165.     if ( Interiors[ interior ][ OutAllowKey ] )
  166.         format ( msg , 128 , "%s~n~~y~%s" , Interiors[ interior ][ GetOutMessage ] , LANG );
  167.     else
  168.         format ( msg , 128 , Interiors[ interior ][ GetInMessage ] );
  169.     LastInterior[ playerid ] = interior + OFFSET;
  170.     SetPlayerInterior ( playerid , ( Interiors[ interior ][ InInteriorID ] == NULL ) ? STANDARD_INTERIOR : Interiors[ interior ][ InInteriorID ] );
  171.     SetPlayerPos ( playerid , Interiors[ interior ][ InX ] , Interiors[ interior ][ InY ] , Interiors[ interior ][ InZ ] );
  172.     SetPlayerFacingAngle ( playerid , Interiors[ interior ][ InAngle ] );
  173.     SetPlayerVirtualWorld ( playerid , Interiors[ interior ][ InVirtualWorld ] );
  174.     GameTextForPlayer ( playerid , msg , WAIT_TIME - 500 , ( Interiors[ interior ][ InGameTextStyle ] == NULL ) ? STANDARD_GAMETEXTSTYLE : Interiors[ interior ][ InGameTextStyle ] );
  175.     SetTimerEx ( "ResetInterior" , WAIT_TIME , 0 , "i" , playerid );
  176. }
  177.  
  178. stock GetFreeSlot ( ) {
  179.     for ( new interior; interior < sizeof Interiors; interior++ )
  180.         if ( !Interior_Pickups[ interior ][ 0 ] )
  181.             return interior;
  182.     return NULL;
  183. }
  184.  
  185. stock IsInterior ( interior )
  186.     return Interior_Pickups[ interior ][ 0 ] ? true : false;
  187.    
  188. #if INTERIOR_CREATOR == true
  189.  
  190. new const f = false;
  191. #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"
  192. #define INTERIOR_CREATOR_HEADLINE "H Interiors - AddInterior Creator"
  193. #define SPP "H inGameSetPlayerPos"
  194. #define CLEAR_CHAT for ( new m; m < 11; m++ ) SendClientMessage ( playerid , 0xFFFFFF , "" );
  195. #define OPERATION_CANCELED() do { p[ playerid ][ CreatorStep ] = 0; CLEAR_CHAT SendClientMessage ( playerid , 0x99001FAA , "Operation canceled" ); } while ( f )
  196.  
  197. enum data {
  198.     CreatorStep,
  199.     Float:iX,
  200.     Float:iY,
  201.     Float:iZ,
  202.     Float:iA,
  203.     iIID,
  204.     iVW,
  205.     iM[ 64 ],
  206.     iAK,
  207.     Float:oX,
  208.     Float:oY,
  209.     Float:oZ,
  210.     Float:oA,
  211.     oIID,
  212.     oVW,
  213.     oM[ 64 ],
  214.     oAK
  215. }
  216.  
  217. enum temp_data {
  218.     Float:sX,
  219.     Float:sY,
  220.     Float:sZ,
  221. }
  222.  
  223. new p[ MAX_PLAYERS ][ data ];
  224. new tp[ MAX_PLAYERS ][ temp_data ];
  225.  
  226. public OnPlayerText ( playerid , text[] ) {
  227.     if ( text[ 0 ] == '#' && text[ 1 ] != '\0' && text[ 1 ] != ' ' && IsPlayerAdmin ( playerid ) ) {
  228.         if ( !strcmp ( "#setexit" , text ) ) {
  229.             if ( p[ playerid ][ CreatorStep ] < 3 ) {
  230.                 CLEAR_CHAT
  231.                 SendClientMessage ( playerid , 0x99001FAA , "You have to use \"#setenter\" before!" );
  232.                 return 0;
  233.             }
  234.             new Float:X , Float:Y , Float:Z , InteriorID , msg[ 512 ];
  235.             GetPlayerPos ( playerid , X , Y , Z );
  236.             InteriorID = GetPlayerInterior ( playerid );
  237.             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 );
  238.             ShowPlayerDialog ( playerid , DIALOG_IDS + 9, DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , msg , "Yes" , "No" );
  239.             return 0;
  240.         }
  241.         if ( !strcmp ( "#spp" , text ) ) {
  242.             ShowPlayerDialog ( playerid , DIALOG_IDS + 5 , DIALOG_STYLE_INPUT , SPP , "Type in the X float" , "Next" , "Cancel" );
  243.             return 0;
  244.         }
  245.         if ( !strcmp ( "#setenter" , text ) ) {
  246.             if ( p[ playerid ][ CreatorStep ] < 1 ) {
  247.                 CLEAR_CHAT
  248.                 SendClientMessage ( playerid , 0x99001FAA , "First use \"#new\"!" );
  249.                 return 0;
  250.             }
  251.             new Float:X , Float:Y , Float:Z , InteriorID , msg[ 512 ];
  252.             GetPlayerPos ( playerid , X , Y , Z );
  253.             InteriorID = GetPlayerInterior ( playerid );
  254.             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 );
  255.             ShowPlayerDialog ( playerid , DIALOG_IDS + 3, DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , msg , "Yes" , "No" );
  256.             return 0;
  257.         }
  258.         if ( !strcmp ( "#new" , text ) ) {
  259.             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" );
  260.             return 0;
  261.         }
  262.         if ( !strcmp ( "#help" , text ) ) {
  263.             ShowPlayerDialog ( playerid , DIALOG_IDS + 1 , DIALOG_STYLE_LIST , "H Interiors - Help Center" , HELP_CENTER_LIST , "Select" , "Close" );
  264.             return 0;
  265.         }
  266.         ShowPlayerDialog ( playerid , DIALOG_IDS , DIALOG_STYLE_MSGBOX , "H Interiors - Error" , "The command you entered is not valid H Interiors command!" , "Help Center" , "OK" );
  267.         return 0;
  268.     }
  269.     return 1;
  270. }
  271.  
  272. public OnDialogResponse ( playerid , dialogid , response , listitem , inputtext[ ] ) {
  273.     if ( !IsPlayerAdmin ( playerid ) )
  274.         return 0;
  275.     switch ( dialogid ) {
  276.         case DIALOG_IDS:
  277.             if ( response )
  278.                 ShowPlayerDialog ( playerid , DIALOG_IDS + 1 , DIALOG_STYLE_LIST , "H Interiors - Help Center" , HELP_CENTER_LIST , "Select" , "Close" );
  279.         case DIALOG_IDS + 1:
  280.             if ( response )
  281.                 switch ( listitem ) {
  282.                     case 0:
  283.                         ShowPlayerDialog ( playerid , DIALOG_IDS + 1 , DIALOG_STYLE_LIST , "H Interiors - Help Center" , HELP_CENTER_LIST , "Select" , "Close" );
  284.                     case 1:
  285.                         if ( p[ playerid ][ CreatorStep ] != 0 ) {
  286.                             CLEAR_CHAT
  287.                             SendClientMessage ( playerid , 0x99001FAA , "AddInterior Generator is already in progress!" );
  288.                             SendClientMessage ( playerid , 0xFFFFFF , "" );
  289.                             SendClientMessage ( playerid , 0x6600CC , "Your next step is to use \"#setenter\"" );
  290.                         }
  291.                         else
  292.                             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" );
  293.                     case 2: {
  294.                         if ( p[ playerid ][ CreatorStep ] < 1 ) {
  295.                             CLEAR_CHAT
  296.                             SendClientMessage ( playerid , 0x99001FAA , "First use \"#new\"!" );
  297.                             return 0;
  298.                         }
  299.                         new Float:X , Float:Y , Float:Z , InteriorID , msg[ 512 ];
  300.                         GetPlayerPos ( playerid , X , Y , Z );
  301.                         InteriorID = GetPlayerInterior ( playerid );
  302.                         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 );
  303.                         ShowPlayerDialog ( playerid , DIALOG_IDS + 3, DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , msg , "Yes" , "No" );
  304.                     }
  305.                     case 3: {
  306.                         if ( p[ playerid ][ CreatorStep ] < 3 ) {
  307.                             CLEAR_CHAT
  308.                             SendClientMessage ( playerid , 0x99001FAA , "You have to use \"#setenter\" before!" );
  309.                             return 0;
  310.                         }
  311.                         new Float:X , Float:Y , Float:Z , InteriorID , msg[ 512 ];
  312.                         GetPlayerPos ( playerid , X , Y , Z );
  313.                         InteriorID = GetPlayerInterior ( playerid );
  314.                         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 );
  315.                         ShowPlayerDialog ( playerid , DIALOG_IDS + 9, DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , msg , "Yes" , "No" );
  316.                     }
  317.                     case 4:
  318.                         ShowPlayerDialog ( playerid , DIALOG_IDS + 5 , DIALOG_STYLE_INPUT , SPP , "Type in the X float" , "Next" , "Cancel" );
  319.                 }
  320.         case DIALOG_IDS + 2: {
  321.             if ( response ) {
  322.                 p[ playerid ][ CreatorStep ] = 1;
  323.                 CLEAR_CHAT
  324.                 SendClientMessage ( playerid , 0x6600CC , "Now please go to the point where your Interior or Teleport should be." );
  325.                 SendClientMessage ( playerid , 0x6600CC , "Then type \"#setenter\" to continue." );
  326.             }
  327.             else
  328.                 OPERATION_CANCELED ( );
  329.         }
  330.         case DIALOG_IDS + 3: {
  331.             if ( response ) {
  332.                 GetPlayerPos ( playerid , p[ playerid ][ iX ] , p[ playerid ][ iY ] , p[ playerid ][ iZ ] );
  333.                 GetPlayerFacingAngle ( playerid , p[ playerid ][ iA ] );
  334.                 p[ playerid ][ iIID ] = GetPlayerInterior ( playerid );
  335.                 p[ playerid ][ CreatorStep ] = 2;
  336.                 CLEAR_CHAT
  337.                 SendClientMessage ( playerid , 0x6600CC , "This position was successfully saved!" );
  338.                 SendClientMessage ( playerid , 0x6600CC , "Now lets go on!" );
  339.                 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" );
  340.             }
  341.             else {
  342.                 CLEAR_CHAT
  343.                 SendClientMessage ( playerid , 0x99001FAA , "Ok, then try to find a better place..." );
  344.                 SendClientMessage ( playerid , 0xFFFFFF , "" );
  345.                 SendClientMessage ( playerid , 0x6600CC , "Now please go to the point where your Interior or Teleport should be." );
  346.                 SendClientMessage ( playerid , 0x6600CC , "Then type \"#setenter\" to continue." );
  347.             }
  348.         }
  349.         case DIALOG_IDS + 4: {
  350.             if ( response ) {
  351.                 if ( strlen ( inputtext ) ) {
  352.                     if ( strval ( inputtext ) > 0 ) {
  353.                         p[ playerid ][ iVW ] = strval ( inputtext );
  354.                         p[ playerid ][ CreatorStep ] = 3;
  355.                         CLEAR_CHAT
  356.                         SendClientMessage ( playerid , 0x6600CC , "Perfect!" );
  357.                         SendClientMessage ( playerid , 0x6600CC , "Now go and search for a good point for the exit-pickup!" );
  358.                         SendClientMessage ( playerid , 0x6600CC , "If it is to be in an interior, you might find \"H inGameSetPlayerPos\" with integrated interior function usefull..." );
  359.                         SendClientMessage ( playerid , 0x6600CC , "Use it by typing \"#spp\"" );
  360.                     }
  361.                     else {
  362.                         CLEAR_CHAT
  363.                         SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
  364.                         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" );
  365.                     }
  366.                 }
  367.                 else {
  368.                     p[ playerid ][ iVW ] = NULL;
  369.                     p[ playerid ][ CreatorStep ] = 3;
  370.                     CLEAR_CHAT
  371.                     SendClientMessage ( playerid , 0x6600CC , "Perfect!" );
  372.                     SendClientMessage ( playerid , 0x6600CC , "Now go and search for a good point for the exit-pickup! Then type \"#setexit\"." );
  373.                     SendClientMessage ( playerid , 0x6600CC , "If it is to be in an interior, you might find \"H inGameSetPlayerPos\" with integrated interior function usefull..." );
  374.                     SendClientMessage ( playerid , 0x6600CC , "Use it by typing \"#spp\"" );
  375.                 }
  376.             }
  377.             else
  378.                 OPERATION_CANCELED ( );
  379.         }
  380.         case DIALOG_IDS + 5: {
  381.             if ( response ) {
  382.                 if ( strfind ( inputtext , "." ) != -1 ) {
  383.                     tp[ playerid ][ sX ] = floatstr ( inputtext );
  384.                     ShowPlayerDialog ( playerid , DIALOG_IDS + 6 , DIALOG_STYLE_INPUT , SPP , "Type in the Y float" , "Next" , "Cancel" );
  385.                 }
  386.                 else {
  387.                     CLEAR_CHAT
  388.                     SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
  389.                     ShowPlayerDialog ( playerid , DIALOG_IDS + 5 , DIALOG_STYLE_INPUT , SPP , "Type in the X float" , "Next" , "Cancel" );
  390.                 }
  391.             }
  392.             else
  393.                 OPERATION_CANCELED ( );
  394.         }
  395.         case DIALOG_IDS + 6: {
  396.             if ( response ) {
  397.                 if ( strfind ( inputtext , "." ) != -1 ) {
  398.                     tp[ playerid ][ sY ] = floatstr ( inputtext );
  399.                     ShowPlayerDialog ( playerid , DIALOG_IDS + 7 , DIALOG_STYLE_INPUT , SPP , "Type in the Z float" , "Next" , "Cancel" );
  400.                 }
  401.                 else {
  402.                     CLEAR_CHAT
  403.                     SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
  404.                     ShowPlayerDialog ( playerid , DIALOG_IDS + 6 , DIALOG_STYLE_INPUT , SPP , "Type in the Y float" , "Next" , "Cancel" );
  405.                 }
  406.             }
  407.             else
  408.                 OPERATION_CANCELED ( );
  409.         }
  410.         case DIALOG_IDS + 7: {
  411.             if ( response ) {
  412.                 if ( strfind ( inputtext , "." ) != -1 ) {
  413.                     tp[ playerid ][ sZ ] = floatstr ( inputtext );
  414.                     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" );
  415.                 }
  416.                 else {
  417.                     CLEAR_CHAT
  418.                     SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
  419.                     ShowPlayerDialog ( playerid , DIALOG_IDS + 7 , DIALOG_STYLE_INPUT , SPP , "Type in the Z float" , "Next" , "Cancel" );
  420.                 }
  421.             }
  422.             else
  423.                 OPERATION_CANCELED ( );
  424.         }
  425.         case DIALOG_IDS + 8: {
  426.             if ( response ) {
  427.                 if ( strval ( inputtext ) ) {
  428.                     SetPlayerInterior ( playerid , strval ( inputtext ) );
  429.                     SetPlayerPos ( playerid , tp[ playerid ][ sX ] , tp[ playerid ][ sY ] , tp[ playerid ][ sZ ] );
  430.                     CLEAR_CHAT
  431.                     SendClientMessage ( playerid , 0x6600CC , "Wooosh!" );
  432.                 }
  433.                 else {
  434.                     CLEAR_CHAT
  435.                     SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
  436.                     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" );
  437.                 }
  438.             }
  439.             else
  440.                 OPERATION_CANCELED ( );
  441.         }
  442.         case DIALOG_IDS + 9: {
  443.             if ( response ) {
  444.                 GetPlayerPos ( playerid , p[ playerid ][ oX ] , p[ playerid ][ oY ] , p[ playerid ][ oZ ] );
  445.                 GetPlayerFacingAngle ( playerid , p[ playerid ][ oA ] );
  446.                 p[ playerid ][ oIID ] = GetPlayerInterior ( playerid );
  447.                 p[ playerid ][ CreatorStep ] = 4;
  448.                 CLEAR_CHAT
  449.                 SendClientMessage ( playerid , 0x6600CC , "This position was successfully saved!" );
  450.                 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" );
  451.             }
  452.             else {
  453.                 CLEAR_CHAT
  454.                 SendClientMessage ( playerid , 0x99001FAA , "Ok, then try to find a better place..." );
  455.                 SendClientMessage ( playerid , 0xFFFFFF , "" );
  456.                 SendClientMessage ( playerid , 0x6600CC , "Now please go to the point where your exit-pickup should be." );
  457.                 SendClientMessage ( playerid , 0x6600CC , "Then type \"#setexit\" to continue." );
  458.             }
  459.         }
  460.         case DIALOG_IDS + 10: {
  461.             if ( response ) {
  462.                 if ( strlen ( inputtext ) ) {
  463.                     if ( strval ( inputtext ) > 0 ) {
  464.                         p[ playerid ][ oVW ] = strval ( inputtext );
  465.                         p[ playerid ][ CreatorStep ] = 5;
  466.                         CLEAR_CHAT
  467.                         SendClientMessage ( playerid , 0x6600CC , "Great!" );
  468.                         SendClientMessage ( playerid , 0x6600CC , "Now we do the fine adjustment!" );
  469.                         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" );
  470.                     }
  471.                     else {
  472.                         CLEAR_CHAT
  473.                         SendClientMessage ( playerid , 0x99001FAA , "You´ve entered an invalid value! Retry now..." );
  474.                         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" );
  475.                     }
  476.                 }
  477.                 else {
  478.                     p[ playerid ][ oVW ] = NULL;
  479.                     CLEAR_CHAT
  480.                     SendClientMessage ( playerid , 0x6600CC , "Great!" );
  481.                     SendClientMessage ( playerid , 0x6600CC , "Now we do the fine adjustment!" );
  482.                     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" );
  483.                 }
  484.             }
  485.             else
  486.                 OPERATION_CANCELED ( );
  487.         }
  488.         case DIALOG_IDS + 11: {
  489.             new msg [ 128 ];
  490.             format ( p[ playerid ][ iM ] , 64 , inputtext );
  491.             format ( msg , 256 , "Saved enter-message: %s\r\nWrite the text to be displayed when the player EXITS the interior." , inputtext );
  492.             ShowPlayerDialog ( playerid , DIALOG_IDS + 12 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , msg , "Next" , "Back" );
  493.         }
  494.         case DIALOG_IDS + 12: {
  495.             if ( response ) {
  496.                 new msg [ 256 ];
  497.                 format ( p[ playerid ][ oM ] , 64 , inputtext );
  498.                 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 );
  499.                 ShowPlayerDialog ( playerid , DIALOG_IDS + 13 , DIALOG_STYLE_MSGBOX , INTERIOR_CREATOR_HEADLINE , msg , "Yes" , "No" );
  500.             }
  501.             else
  502.                 ShowPlayerDialog ( playerid , DIALOG_IDS + 11 , DIALOG_STYLE_INPUT , INTERIOR_CREATOR_HEADLINE , "Write the text to be displayed when the player ENTERS the interior." , "Next" , "" );
  503.         }
  504.         case DIALOG_IDS + 13: {
  505.             if ( response )
  506.                 p[ playerid ][ iAK ] = 1;
  507.             else
  508.                 p[ playerid ][ iAK ] = 0;
  509.             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" );
  510.         }
  511.         case DIALOG_IDS + 14: {
  512.             if ( response )
  513.                 p[ playerid ][ oAK ] = 1;
  514.             else
  515.                 p[ playerid ][ oAK ] = 0;
  516.             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" , "" );
  517.         }
  518.         case DIALOG_IDS + 15: {
  519.             if ( strlen ( inputtext ) ) {
  520.                 new filename[ 32 ] , File:adi , msg[ 128 ] , function[ 1024 ] , temp_function[ 512 ] , VWorld[ 5 ] , AK[ 5 ];
  521.                 if ( p[ playerid ][ iVW ] == NULL )
  522.                     format ( VWorld , 5 , "NULL" );
  523.                 else
  524.                     format ( VWorld , 5 , p[ playerid ][ iVW ] );
  525.                 if ( p[ playerid ][ iAK ] == 1 )
  526.                     format ( AK , 5 , "YES" );
  527.                 else
  528.                     format ( AK , 5 , "NO" );
  529.                 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 );
  530.                 if ( p[ playerid ][ oVW ] == NULL )
  531.                     format ( VWorld , 5 , "NULL" );
  532.                 else
  533.                     format ( VWorld , 5 , p[ playerid ][ oVW ] );
  534.                 if ( p[ playerid ][ oAK ] == 1 )
  535.                     format ( AK , 5 , "YES" );
  536.                 else
  537.                     format ( AK , 5 , "NO" );
  538.                 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 );
  539.                 strcat ( function , temp_function );
  540.                 format ( filename , 32 , "%s.adi" , inputtext );
  541.                 adi = fopen ( filename , io_readwrite );
  542.                 fwrite ( adi , function );
  543.                 fclose ( adi );
  544.                 format ( msg , 128 , "You new interior %s was created in %s.adi" , inputtext , inputtext );
  545.                 p [ playerid ][ CreatorStep ] = 0;
  546.                 CLEAR_CHAT
  547.                 SendClientMessage ( playerid , 0x6600CC , "Thank you darling!" );
  548.             }
  549.             else
  550.                 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" , "" );
  551.         }
  552.     }
  553.     return 0;
  554. }
  555.  
  556. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement