Advertisement
Hauke

h_interiors1.1

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