SHARE
TWEET

Exemplo elevador

Felipe_Alves May 21st, 2020 1,338 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Example Elevator
  3. */
  4. #pragma warning disable 239 //pawn 3.10.10
  5. #include a_samp
  6. #include streamer
  7. #include elevator
  8.  
  9. #define FILTERSCRIPT
  10.  
  11. #define DIALOG_ELEVADOR 2000
  12.  
  13. stock PlaySoundForPlayersInRange(soundid, Float:range, Float:x, Float:y, Float:z)
  14. {
  15.     for(new i=0; i<=GetPlayerPoolSize(); i++)
  16.     {
  17.         if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i,range,x,y,z))
  18.         {
  19.             PlayerPlaySound(i, soundid, x, y, z);
  20.         }
  21.     }
  22. }
  23.  
  24.  
  25. new Elevator1; // Downtown Los Santos
  26. new Elevator2; // Beachside Los Santos
  27. new Elevator3; // Market Los Santos
  28. new Elevator4; // ZomboTech San Fierro
  29.  
  30. public OnFilterScriptInit()
  31. {  
  32.     // Downtown Los Santos
  33.     Elevator1 = AddElevator(1786.6781, -1303.45948, 14.5710, 270.0, "Downtown Los Santos", 0, 0);
  34.     AddFloorToElevator(Elevator1, 14.5709, "Térreo", true);
  35.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479), "1º Andar");
  36.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 1.0)), "2º Andar");
  37.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 2.0)), "3º Andar");
  38.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 3.0)), "4º Andar");
  39.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 4.0)), "5º Andar");
  40.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 5.0)), "6º Andar");
  41.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 6.0)), "7º Andar");
  42.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 7.0)), "8º Andar");
  43.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 8.0)), "9º Andar");
  44.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 9.0)), "10º Andar");
  45.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 10.0)), "11º Andar");
  46.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 11.0)), "12º Andar");
  47.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 12.0)), "13º Andar");
  48.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 13.0)), "14º Andar");
  49.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 14.0)), "15º Andar");
  50.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 15.0)), "16º Andar");
  51.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 16.0)), "17º Andar");
  52.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 17.0)), "18º Andar");
  53.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 18.0)), "19º Andar");
  54.     AddFloorToElevator(Elevator1, (14.5709 + 8.5479 + (5.45155 * 19.0)), "20º Andar");
  55.  
  56.     // Beachside
  57.     Elevator2 = AddElevator(287.942413, -1609.341064, 18.755348, 80.0, "Beachside Los Santos", 0, 0);
  58.     AddFloorToElevator(Elevator2, 18.75, "Estacionamento");
  59.     AddFloorToElevator(Elevator2, 33.826, "Térreo", true);
  60.     AddFloorToElevator(Elevator2, 47.886, "1º Andar");
  61.     AddFloorToElevator(Elevator2, (47.886 + (29.130733 + (4.5 * 1))), "2º Andar");
  62.     AddFloorToElevator(Elevator2, (47.886 + (29.130733 + (4.5 * 2))), "3º Andar");
  63.     AddFloorToElevator(Elevator2, (47.886 + (29.130733 + (4.5 * 3))), "4º Andar");
  64.     AddFloorToElevator(Elevator2, (47.886 + (29.130733 + (4.5 * 4))), "5º Andar");
  65.     AddFloorToElevator(Elevator2, (47.886 + (29.130733 + (4.5 * 5))), "6º Andar");
  66.     AddFloorToElevator(Elevator2, (47.886 + (29.130733 + (4.5 * 6))), "7º Andar");
  67.     AddFloorToElevator(Elevator2, (47.886 + (29.130733 + (4.5 * 7))), "8º Andar");
  68.     AddFloorToElevator(Elevator2, (47.886 + (29.130733 + (4.5 * 8))), "9º Andar");
  69.     AddFloorToElevator(Elevator2, (47.886 + (29.130733 + (4.5 * 9))), "10º Andar");
  70.     AddFloorToElevator(Elevator2, (47.886 + (29.130733 + (4.5 * 10))), "11º Andar");
  71.     AddFloorToElevator(Elevator2, (47.886 + (29.130733 + (4.5 * 11))), "12º Andar");
  72.  
  73.     // Portas nos apartamentos
  74.     CreateDynamicObject(1536, 275.71625, -1621.05615, 46.00830,   0.00000, 0.00000, 79.88780);
  75.     CreateDynamicObject(1536, 275.73999, -1621.06470, 95.51733,   0.00000, 0.00000, 79.88779);
  76.     CreateDynamicObject(1536, 295.07391, -1624.46301, 95.51733,   0.00000, 0.00000, 79.88779);
  77.     CreateDynamicObject(1536, 295.07391, -1624.46301, 91.02124,   0.00000, 0.00000, 79.88779);
  78.     CreateDynamicObject(1536, 275.76733, -1621.02380, 91.02124,   0.00000, 0.00000, 79.88779);
  79.     CreateDynamicObject(1536, 275.74573, -1621.04224, 86.52446,   0.00000, 0.00000, 79.88779);
  80.     CreateDynamicObject(1536, 295.07285, -1624.44983, 86.52446,   0.00000, 0.00000, 79.88779);
  81.     CreateDynamicObject(1536, 295.07281, -1624.44983, 82.00750,   0.00000, 0.00000, 79.88780);
  82.     CreateDynamicObject(1536, 275.79099, -1621.04138, 82.00750,   0.00000, 0.00000, 79.88780);
  83.     CreateDynamicObject(1536, 275.82355, -1621.07202, 77.52800,   0.00000, 0.00000, 79.88780);
  84.     CreateDynamicObject(1536, 295.09464, -1624.48511, 77.52800,   0.00000, 0.00000, 79.88780);
  85.     CreateDynamicObject(1536, 295.10526, -1624.42615, 73.00648,   0.00000, 0.00000, 79.88780);
  86.     CreateDynamicObject(1536, 275.70840, -1621.05469, 73.00648,   0.00000, 0.00000, 79.88780);
  87.     CreateDynamicObject(1536, 275.70840, -1621.05469, 68.50540,   0.00000, 0.00000, 79.88780);
  88.     CreateDynamicObject(1536, 295.12576, -1624.46777, 68.50540,   0.00000, 0.00000, 79.88780);
  89.     CreateDynamicObject(1536, 295.20419, -1624.48340, 64.00517,   0.00000, 0.00000, 79.88780);
  90.     CreateDynamicObject(1536, 275.71280, -1621.05200, 63.98520,   0.00000, 0.00000, 79.88780);
  91.     CreateDynamicObject(1536, 275.67557, -1621.02722, 59.48780,   0.00000, 0.00000, 79.88780);
  92.     CreateDynamicObject(1536, 295.13309, -1624.44238, 59.50780,   0.00000, 0.00000, 79.88780);
  93.     CreateDynamicObject(1536, 295.13062, -1624.46228, 54.99290,   0.00000, 0.00000, 79.88780);
  94.     CreateDynamicObject(1536, 275.71942, -1621.03137, 54.99290,   0.00000, 0.00000, 79.88780);
  95.     CreateDynamicObject(1536, 275.71796, -1621.07141, 50.51244,   0.00000, 0.00000, 79.88780);
  96.     CreateDynamicObject(1536, 295.12808, -1624.46216, 50.51244,   0.00000, 0.00000, 79.88780);
  97.     CreateDynamicObject(1536, 295.12811, -1624.46216, 46.00830,   0.00000, 0.00000, 79.88780);
  98.  
  99.     //Market Los Santos
  100.     CreateDynamicObject(19595, 1160.96, -1180.58, 70.4141, 0.0, 0.0, 0.0);
  101.     CreateDynamicObject(19798, 1160.96, -1180.58, 20.4141, 0.0, 0.0, 0.0);
  102.  
  103.     Elevator3 = AddElevator(1181.622924, -1180.554687, 20.879316, 0.0, "Market Los Santos", 0, 0);
  104.     AddFloorToElevator(Elevator3, 20.879, "Estacionamento");
  105.     AddFloorToElevator(Elevator3, 34.485, "Recepção", true);
  106.     AddFloorToElevator(Elevator3, 39.688, "1º Andar");
  107.     AddFloorToElevator(Elevator3, 44.892, "2º Andar");
  108.     AddFloorToElevator(Elevator3, 50.10, "3º Andar");
  109.     AddFloorToElevator(Elevator3, 55.30, "4º Andar");
  110.     AddFloorToElevator(Elevator3, 60.504, "5º Andar");
  111.     AddFloorToElevator(Elevator3, 65.707, "6º Andar");
  112.     AddFloorToElevator(Elevator3, 70.911, "7º Andar");
  113.     AddFloorToElevator(Elevator3, 76.115, "8º Andar");
  114.     AddFloorToElevator(Elevator3, 81.319, "9º Andar");
  115.  
  116.     // ZomboTech San Fierro
  117.     CreateDynamicObject(19593, -1951.687500, 660.023986, 89.507797, 0, 0, 0);
  118.     CreateDynamicObject(19594, -1951.687500, 660.023986, 29.507797, 0, 0, 0);
  119.  
  120.     Elevator4 = AddElevator(-1951.603027, 636.418334, 47.45149, 270.0, "Laboratório ZomboTech", 0, 0);
  121.     AddFloorToElevator(Elevator4, 47.45149, "Recepção", true);
  122.     AddFloorToElevator(Elevator4, 25.82348, "Laboratório");
  123.  
  124.     // Remoção de objetos em jogadores online
  125.     for(new playerid; playerid <= GetPlayerPoolSize(); playerid++)
  126.     {
  127.         if(IsPlayerConnected(playerid))
  128.         {
  129.             RemovesForPlayer(playerid);
  130.         }
  131.     }
  132.     return 1;
  133. }
  134.  
  135. public OnFilterScriptExit()
  136. {
  137.     DestroyElevator(Elevator1); // Downtown Los Santos
  138.     DestroyElevator(Elevator2); // Beachside Los Santos
  139.     DestroyElevator(Elevator3); // Market Los Santos
  140.     DestroyElevator(Elevator4); // ZomboTech SF
  141.     return 1;
  142. }
  143.  
  144. public OnPlayerConnect(playerid)
  145. {
  146.     RemovesForPlayer(playerid);
  147.     return 1;
  148. }
  149. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  150. {
  151.     if(newkeys & KEY_YES)
  152.     {
  153.         if(IsPlayerInElevator(playerid, GetPVarInt(playerid, "elevator_id"))) return ShowDialogElevator(playerid);
  154.         if(CallElevatorToFloor(GetPVarInt(playerid, "front_elevator_id"), GetPlayerFrontElevator(playerid, GetPVarInt(playerid, "front_elevator_id"))))
  155.         {
  156.             return SendClientMessage(playerid, 0xFFFF00FF, "* Elevador chamado!");
  157.         }
  158.     }
  159.     return 1;
  160. }
  161.  
  162. public OnElevatorStoped(elevatorid)
  163. {
  164.     new Float:x, Float:y, Float:z;
  165.     GetElevatorPos(elevatorid, x, y, z);
  166.     PlaySoundForPlayersInRange(6401, 50.0, x, y, z);
  167.     return 1;
  168. }
  169. public OnPlayerEnterElevator(playerid, elevatorid)
  170. {
  171.     new Msg[144], ElevatorName[32];
  172.     GetElevatorName(elevatorid, ElevatorName, sizeof ElevatorName);
  173.     format(Msg, sizeof Msg, "* Você entrou no elevador %s!", ElevatorName);
  174.     SendClientMessage(playerid, 0xFFFF00FF, Msg);
  175.     SetPVarInt(playerid, "elevator_id", elevatorid);
  176.     return 1;
  177. }
  178. public OnPlayerIsFrontElevator(playerid, elevatorid, floor)
  179. {
  180.     new Msg[144], floorname[32], ElevatorName[32];
  181.     GetFloorNameForElevator(floor, elevatorid, floorname, 32);
  182.     GetElevatorName(elevatorid, ElevatorName, sizeof ElevatorName);
  183.     format(Msg, sizeof Msg, "* Você está no %s do elevador %s.", floorname, ElevatorName);
  184.     SendClientMessage(playerid, 0xFFFF00FF, Msg);
  185.     SetPVarInt(playerid, "front_elevator_id", elevatorid);
  186.     return 1;
  187. }
  188. public OnPlayerLeaveFrontElevator(playerid, elevatorid, floor)
  189. {
  190.     DeletePVar(playerid, "front_elevator_id");
  191.     return 1;
  192. }
  193. public OnPlayerLeaveElevator(playerid, elevatorid)
  194. {
  195.     DeletePVar(playerid, "elevator_id");
  196.     return 1;
  197. }
  198.  
  199. ShowDialogElevator(playerid)
  200. {
  201.     new eID = GetPVarInt(playerid, "elevator_id");
  202.     //if(!IsPlayerInElevator(playerid, eID)) return SendClientMessage(playerid, 0xFF0000FF, "* Você não está em um elevador.");
  203.     new Msg[400], Header[128], elevatorname[32];
  204.     GetElevatorName(eID, elevatorname, sizeof elevatorname);
  205.     format(Header, sizeof Header, "Elevador %s", elevatorname);
  206.     for(new i; i < GetMaxFloorElevator(eID); i++)
  207.     {
  208.         new floorname[32];
  209.         GetFloorNameForElevator(i, eID, floorname, sizeof floorname);
  210.         format(Msg, sizeof Msg, "%s%s%s\n", Msg, (i == GetElevatorOnFloor(eID) ? ("{FFFF00}") : ("{FFFFFF}")), floorname);
  211.     }
  212.     ShowPlayerDialog(playerid, DIALOG_ELEVADOR, DIALOG_STYLE_LIST, Header, Msg, "Selecionar", "Cancelar");
  213.     return 1;
  214. }
  215.  
  216. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  217. {
  218.     if(dialogid == DIALOG_ELEVADOR)
  219.     {
  220.         if(!response) return 1;
  221.         SelectFloorOnElevator(GetPVarInt(playerid, "elevator_id"), listitem);
  222.     }
  223.     return 1;
  224. }
  225.  
  226. RemovesForPlayer(playerid)
  227. {
  228.     // Beachside
  229.     RemoveBuildingForPlayer(playerid, 1226, 265.481, -1581.1, 32.9311, 5.0);
  230.     RemoveBuildingForPlayer(playerid, 6518, 280.297, -1606.2, 72.3984, 250.0);
  231.  
  232.     // Market
  233.     RemoveBuildingForPlayer(playerid, 5766, 1160.96, -1180.58, 70.4141, 250.0); // Awning shadows
  234.     RemoveBuildingForPlayer(playerid, 5767, 1160.96, -1180.58, 70.4141, 250.0); // Building
  235.     RemoveBuildingForPlayer(playerid, 5964, 1160.96, -1180.58, 70.4141, 250.0); // LOD
  236.  
  237.     // ZomboTech
  238.     RemoveBuildingForPlayer(playerid, 10027, -1951.687500, 660.023986, 89.507797, 250.0); // Building
  239.     RemoveBuildingForPlayer(playerid, 9939, -1951.687500, 660.023986, 89.507797, 250.0); // LOD
  240.  
  241. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top