Portal SAMP
[Include] Adicione Elevadores - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Lançamentos (https://portalsamp.com/forumdisplay.php?fid=26)
+---- Fórum: Includes (https://portalsamp.com/forumdisplay.php?fid=27)
+---- Tópico: [Include] Adicione Elevadores (/showthread.php?tid=107)



Adicione Elevadores - Locky - 30/09/2020

Include simples para adicionar elevadores no mapa de San Andreas de forma rápida e sem muitas "gambiarras".

Requisitos
  • SA-MP Server (0.3.7 é recomendável)

  • Plugin Streamer (2.9.4 é recomendável)

Funções
  • AddElevator - Criar (ou adicionar) um elevador (avá)

  • IsValidElevator - Verificar se o elevador é válido

  • DestroyElevator - Destruir elevador

  • GetElevatorName - Obter o nome de um elevador

  • GetElevatorPos - Obter a posição de um elevador

  • GetElevatorOnFloor - Obter o andar de um elevador

  • GetElevatorPoolSize - Obtem o máximo de elevadores do jogo

  • AddFloorToElevator - Adicionar um andar ao elevador

  • CallElevatorToFloor - Chamar o elevador (utilizando muito internamente)

  • SelectFloorOnElevator - Selecionar o elevador (praticamente o mesmo uso da função acima)

  • OpenPortsElevator - Abrir portas do elevador (não é preciso chama-la)

  • ClosePortsElevator - Fechar portas do elevador (não é preciso chama-la)

  • GetMaxFloorElevator - Obtem o máximo de andares disponíveis por elevador

  • GetFloorNameForElevator - Obtem o nome do andar

  • IsPlayerInElevator - Verifica se o jogador está em um elevador

  • GetPlayerFrontElevator - Obtem o id do elevador que está bem na frente do jogador
Callbacks
  • OnElevatorCalled - Quando um elevador é chamado

  • OnElevatorStoped - Quando um elevador para em algum andar

  • OnPlayerEnterElevator - Quando um jogador entra em um elevador

  • OnPlayerIsFrontElevator - Quando um jogador fica na frente de um elevador

  • OnPlayerLeaveElevator - Quando um jogador sai de um elevador

  • OnPlayerLeaveFrontElevator - Quando um jogador sai da frente de um elevador

Um exemplo de uso da include, adicionei diversos elevadores ao jogo no mesmo script:
https://github.com/NicKv7/Elevator-Include/blob/master/filterscripts/test_elevator.pwn

Você pode obter a include através deste link:
https://github.com/NicKv7/Elevator-Include/blob/master/pawno/include/elevator.inc


Respostando a include devido ao fórum.sa-mp.com ter saído do ar :/


RE: Adicione Elevadores - JR_Junior - 05/09/2021

O cara posta uma parada com 3 mil erros e tchau.

Código PHP:
include\elevator.inc(273) : error 010invalid function or declaration
include\elevator.inc(273) : error 017undefined symbol "objectid"
include\elevator.inc(275) : error 010invalid function or declaration
include\elevator.inc(277) : error 010invalid function or declaration
include\elevator.inc(279) : error 021symbol already defined"OpenPortsElevator"
include\elevator.inc(280) : error 021symbol already defined"OpenDoorForFloor"
include\elevator.inc(281) : error 010invalid function or declaration
include\elevator.inc(284) : error 010invalid function or declaration
include\elevator.inc(294) : error 010invalid function or declaration
include\elevator.inc(294) : error 017undefined symbol "areaid"
include\elevator.inc(296) : error 010invalid function or declaration
include\elevator.inc(298) : error 010invalid function or declaration
include\elevator.inc(300) : error 010invalid function or declaration
include\elevator.inc(302) : error 010invalid function or declaration
include\elevator.inc(304) : error 010invalid function or declaration
include\elevator.inc(306) : error 010invalid function or declaration
include\elevator.inc(310) : error 010invalid function or declaration
include\elevator.inc(320) : error 010invalid function or declaration
include\elevator.inc(320) : error 017undefined symbol "areaid"
include\elevator.inc(322) : error 010invalid function or declaration
include\elevator.inc(324) : error 010invalid function or declaration
include\elevator.inc(326) : error 010invalid function or declaration
include\elevator.inc(328) : error 010invalid function or declaration
include\elevator.inc(330) : error 010invalid function or declaration
include\elevator.inc(332) : error 010invalid function or declaration
include\elevator.inc(336) : error 010invalid function or declaration 



RE: Adicione Elevadores - xbruno1000x - 05/09/2021

(05/09/2021 19:10)JR_Junior Escreveu: O cara posta uma parada com 3 mil erros e tchau.

Código PHP:
include\elevator.inc(273) : error 010invalid function or declaration
include\elevator.inc(273) : error 017undefined symbol "objectid"
include\elevator.inc(275) : error 010invalid function or declaration
include\elevator.inc(277) : error 010invalid function or declaration
include\elevator.inc(279) : error 021symbol already defined"OpenPortsElevator"
include\elevator.inc(280) : error 021symbol already defined"OpenDoorForFloor"
include\elevator.inc(281) : error 010invalid function or declaration
include\elevator.inc(284) : error 010invalid function or declaration
include\elevator.inc(294) : error 010invalid function or declaration
include\elevator.inc(294) : error 017undefined symbol "areaid"
include\elevator.inc(296) : error 010invalid function or declaration
include\elevator.inc(298) : error 010invalid function or declaration
include\elevator.inc(300) : error 010invalid function or declaration
include\elevator.inc(302) : error 010invalid function or declaration
include\elevator.inc(304) : error 010invalid function or declaration
include\elevator.inc(306) : error 010invalid function or declaration
include\elevator.inc(310) : error 010invalid function or declaration
include\elevator.inc(320) : error 010invalid function or declaration
include\elevator.inc(320) : error 017undefined symbol "areaid"
include\elevator.inc(322) : error 010invalid function or declaration
include\elevator.inc(324) : error 010invalid function or declaration
include\elevator.inc(326) : error 010invalid function or declaration
include\elevator.inc(328) : error 010invalid function or declaration
include\elevator.inc(330) : error 010invalid function or declaration
include\elevator.inc(332) : error 010invalid function or declaration
include\elevator.inc(336) : error 010invalid function or declaration 

A include não é do cara que fez o post, é uma include do fórum sa-mp.


RE: Adicione Elevadores - zBL4CK - 26/10/2023

(05/09/2021 19:10)JR_Junior Escreveu: O cara posta uma parada com 3 mil erros e tchau.
 para corrigir é bem simples


Código:
/*
    Inclusão para haver múltiplos elevadores no game

    Versão 1.0 - Inicial
*/
#if defined _elevator_locky
    #endinput
#endif

#if !defined _samp_included
    #error "Inclua a_samp primeiramente"
#endif

#if !defined _streamer_included
    #error "Inclua o plugin streamer"
#endif

#define _elevator_locky
#if !defined _ELEVATOR_MOVE_SPEED
    #define _ELEVATOR_MOVE_SPEED 5.0
#endif
#if !defined MAX_ELEVATORS
    #define MAX_ELEVATORS 5
#endif
#if !defined MAX_FLOOR_ELEVATOR
    #define MAX_FLOOR_ELEVATOR 22
#endif

enum _elevator_enum
{
    _ElevatorObj,
    _ElevatorPortR,
    _ElevatorPortL,
    Float:_ElevatorFloor[MAX_FLOOR_ELEVATOR],
    _ElevatorArea,
    _ElevatorOnFloor,
    _ElevatorDoorArea[MAX_FLOOR_ELEVATOR],
    _ElevatorDoorPortR[MAX_FLOOR_ELEVATOR],
    _ElevatorDoorPortL[MAX_FLOOR_ELEVATOR],
    bool:_ElevatorDoorOpened[MAX_FLOOR_ELEVATOR],
    _ElevatorName[32]
}   
static _ElevatorData[MAX_ELEVATORS][_elevator_enum];
static _ElevatorFloorName[MAX_ELEVATORS][MAX_FLOOR_ELEVATOR][32];

/*
native AddElevator(Float:posx, Float:posy, Float:posz, Float:ang, ElevatorName[] = "", Interior = -1, VirtualWorld = -1);
native IsValidElevator(elevatorid);
native DestroyElevator(elevatorid);
native GetElevatorName(elevatorid, &ElevatorName[], &size);
native GetElevatorPos(elevatorid, Float:x, Float:y, Float:z);
native GetElevatorOnFloor(elevatorid);
native AddFloorToElevator(elevatorid, Float:fz, floorname[], bool:IsOpen = false);
native CallElevatorToFloor(elevatorid, floorid);
native OpenPortsElevator(elevatorid);
native ClosePortsElevator(elevatorid);
native SelectFloorOnElevator(elevatorid, floorid);
native GetMaxFloorElevator(elevatorid);
native GetFloorNameForElevator(floorid, elevatorid, &floorname[], &size);
native IsPlayerInElevator(playerid, elevatorid);
native GetPlayerFrontElevator(playerid, elevatorid);
native GetElevatorPoolSize();
*/

stock IsValidElevator(elevatorid) return IsValidDynamicObject(_ElevatorData[elevatorid][_ElevatorObj]);
stock GetElevatorPoolSize()
{
    new Counter=-1;
    for(new i; i < MAX_FLOOR_ELEVATOR; i++)
        if(IsValidElevator(elevatorid))
            Counter++;
    return Counter;
}
stock IsPlayerInElevator(playerid, elevatorid) return IsPlayerInDynamicArea(playerid, _ElevatorData[elevatorid][_ElevatorArea]);
stock GetPlayerFrontElevator(playerid, elevatorid)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    for(new doors; doors < MAX_FLOOR_ELEVATOR; doors++)
    {
        if(_ElevatorData[elevatorid][_ElevatorDoorArea][doors] != 0 && IsPlayerInDynamicArea(playerid, _ElevatorData[elevatorid][_ElevatorDoorArea][doors]))
            return doors;
    }   
    return -1;
}
stock GetElevatorPos(elevatorid, &Float:x, &Float:y, &Float:z)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    if(!IsValidElevator(elevatorid)) return 0;
    return GetDynamicObjectPos(_ElevatorData[elevatorid][_ElevatorObj], x, y, z);
}
stock GetElevatorOnFloor(elevatorid)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    if(!IsValidElevator(elevatorid)) return 0;
    return _ElevatorData[elevatorid][_ElevatorOnFloor];
}
stock AddElevator(Float:x, Float:y, Float:z, Float:a, const ElevatorName[] = "", Interior = -1, VirtualWorld = -1)
{
    new Obj = CreateDynamicObject(18755, x, y, z, 0.0, 0.0, a, VirtualWorld, Interior), Ports[2], Area, elevid=-1;
    Ports[0] = CreateDynamicObject(18757, x, y, z, 0.0, 0.0, a, VirtualWorld, Interior);
    Ports[1] = CreateDynamicObject(18756, x, y, z, 0.0, 0.0, a, VirtualWorld, Interior);
    Area = CreateDynamicRectangle(-1.79897, -2.13561, 2.04287,  2.02911, VirtualWorld, Interior);
    AttachDynamicAreaToObject(Area, Obj, STREAMER_OBJECT_TYPE_DYNAMIC, INVALID_PLAYER_ID, 0.0021, 0.1012, -1.9275);
    for(elevid=1; elevid < MAX_ELEVATORS; elevid++)
    {
        if(_ElevatorData[elevid][_ElevatorObj] == 0)
        {
            _ElevatorData[elevid][_ElevatorObj] = Obj;
            _ElevatorData[elevid][_ElevatorPortR] = Ports[0];
            _ElevatorData[elevid][_ElevatorPortL] = Ports[1];
            _ElevatorData[elevid][_ElevatorArea] = Area;
            format(_ElevatorData[elevid][_ElevatorName], 32, ElevatorName);
            break;
        }
    }
    OpenPortsElevator(elevid);
    return elevid;
}
stock DestroyElevator(elevatorid)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    if(!IsValidDynamicObject(_ElevatorData[elevatorid][_ElevatorObj])) return 0;
    DestroyDynamicObject(_ElevatorData[elevatorid][_ElevatorObj]);
    DestroyDynamicObject(_ElevatorData[elevatorid][_ElevatorPortR]);
    DestroyDynamicObject(_ElevatorData[elevatorid][_ElevatorPortL]);
    DestroyDynamicArea(_ElevatorData[elevatorid][_ElevatorArea]);
    _ElevatorData[elevatorid][_ElevatorFloor] = 0.0;
    for(new i; i < MAX_FLOOR_ELEVATOR; i++) {
        _ElevatorFloorName[elevatorid][i] = "";
        DestroyDynamicArea(_ElevatorData[elevatorid][_ElevatorDoorArea][i]);
        _ElevatorData[elevatorid][_ElevatorDoorArea][i] = 0;
        DestroyDynamicObject(_ElevatorData[elevatorid][_ElevatorDoorPortR][i]);
        DestroyDynamicObject(_ElevatorData[elevatorid][_ElevatorDoorPortL][i]);
    }
    _ElevatorData[elevatorid][_ElevatorObj] = _ElevatorData[elevatorid][_ElevatorPortR] = _ElevatorData[elevatorid][_ElevatorPortL] = 0;
    return 1;
}
stock GetElevatorName(elevatorid, ElevatorName[], size)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    return format(ElevatorName, size, _ElevatorData[elevatorid][_ElevatorName]);
}
stock AddFloorToElevator(elevatorid, Float:fz, const floorname[], bool:IsOpen = false)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    for(new i; i < MAX_FLOOR_ELEVATOR; i++)
    {
        if(_ElevatorData[elevatorid][_ElevatorFloor][i] == 0.00)
        {
            _ElevatorData[elevatorid][_ElevatorFloor][i] = fz;
            format(_ElevatorFloorName[elevatorid][i], 32, floorname);
            new Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, VirtualWorld, Interior;
            GetDynamicObjectPos(_ElevatorData[elevatorid][_ElevatorObj], x, y, z);
            GetDynamicObjectRot(_ElevatorData[elevatorid][_ElevatorObj], rx, ry, rz);
            VirtualWorld = Streamer_GetIntData(STREAMER_TYPE_OBJECT, _ElevatorData[elevatorid][_ElevatorObj], E_STREAMER_WORLD_ID);
            Interior = Streamer_GetIntData(STREAMER_TYPE_OBJECT, _ElevatorData[elevatorid][_ElevatorObj], E_STREAMER_INTERIOR_ID);
            // -3.8183, 0.1608, -1.9275                     
            _ElevatorData[elevatorid][_ElevatorDoorArea][i] = CreateDynamicSphere(x + (-3.5 * floatsin(-(rz - 90.0), degrees)), y + (-3.5 * floatcos(-(rz - 90.0), degrees)), fz - 1.92, 2.0, VirtualWorld, Interior);         
            _ElevatorData[elevatorid][_ElevatorDoorPortR][i] = CreateDynamicObject(18757, x + (0.26 * floatsin(-(rz + 90.0), degrees)), y + (0.26 * floatcos(-(rz + 90.0), degrees)), fz, 0.0, 0.0, rz, VirtualWorld, Interior);
            _ElevatorData[elevatorid][_ElevatorDoorPortL][i] = CreateDynamicObject(18756, x + (0.26 * floatsin(-(rz + 90.0), degrees)), y + (0.26 * floatcos(-(rz + 90.0), degrees)), fz, 0.0, 0.0, rz, VirtualWorld, Interior);
            if(IsOpen)
            {
                CallElevatorToFloor(elevatorid, i);             
            }
            break;
        }
    }
    return 1;
}
stock OpenDoorForFloor(elevatorid, floorid)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    if(floorid >= MAX_FLOOR_ELEVATOR) return 0;
    if(_ElevatorData[elevatorid][_ElevatorDoorOpened]) return 0;
    new Float:x1, Float:y1, Float:z1, Float:rx1, Float:ry1, Float:rz1, Float:x2, Float:y2, Float:z2, Float:rx2, Float:ry2, Float:rz2;
    GetDynamicObjectPos(_ElevatorData[elevatorid][_ElevatorDoorPortR][floorid], x1, y1, z1);
    GetDynamicObjectRot(_ElevatorData[elevatorid][_ElevatorDoorPortR][floorid], rx1, ry1, rz1);
    GetDynamicObjectPos(_ElevatorData[elevatorid][_ElevatorDoorPortL][floorid], x2, y2, z2);
    GetDynamicObjectRot(_ElevatorData[elevatorid][_ElevatorDoorPortL][floorid], rx2, ry2, rz2);
    MoveDynamicObject(_ElevatorData[elevatorid][_ElevatorDoorPortR][floorid], x1 + (1.75 * floatsin(-(rz1 - 360.0), degrees)), y1 + (1.75 * floatcos(-(rz1 - 360.0), degrees)), z1, _ELEVATOR_MOVE_SPEED);
    MoveDynamicObject(_ElevatorData[elevatorid][_ElevatorDoorPortL][floorid], x2 + (1.75 * floatsin(-(rz2 - 180.0), degrees)), y2 + (1.75 * floatcos(-(rz2 - 180.0), degrees)), z2, _ELEVATOR_MOVE_SPEED);
    _ElevatorData[elevatorid][_ElevatorDoorOpened] = true;
    return 1;
}
stock CloseDoorForFloor(elevatorid, floorid)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    if(floorid >= MAX_FLOOR_ELEVATOR) return 0;
    if(!_ElevatorData[elevatorid][_ElevatorDoorOpened]) return 0;
    new Float:x1, Float:y1, Float:z1, Float:rx1, Float:ry1, Float:rz1, Float:x2, Float:y2, Float:z2, Float:rx2, Float:ry2, Float:rz2;
    GetDynamicObjectPos(_ElevatorData[elevatorid][_ElevatorDoorPortR][floorid], x1, y1, z1);
    GetDynamicObjectRot(_ElevatorData[elevatorid][_ElevatorDoorPortR][floorid], rx1, ry1, rz1);
    GetDynamicObjectPos(_ElevatorData[elevatorid][_ElevatorDoorPortL][floorid], x2, y2, z2);
    GetDynamicObjectRot(_ElevatorData[elevatorid][_ElevatorDoorPortL][floorid], rx2, ry2, rz2);
    MoveDynamicObject(_ElevatorData[elevatorid][_ElevatorDoorPortR][floorid], x1 - (1.75 * floatsin(-(rz1 - 360.0), degrees)), y1 - (1.75 * floatcos(-(rz1 - 360.0), degrees)), z1, _ELEVATOR_MOVE_SPEED);
    MoveDynamicObject(_ElevatorData[elevatorid][_ElevatorDoorPortL][floorid], x2 - (1.75 * floatsin(-(rz2 - 180.0), degrees)), y2 - (1.75 * floatcos(-(rz2 - 180.0), degrees)), z2, _ELEVATOR_MOVE_SPEED);
    _ElevatorData[elevatorid][_ElevatorDoorOpened] = false;
    return 1;
}
stock CallElevatorToFloor(elevatorid, floorid)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    if(!IsValidElevator(elevatorid)) return 0;
    if(IsDynamicObjectMoving(_ElevatorData[elevatorid][_ElevatorObj])) return 0;
    ClosePortsElevator(elevatorid);
    CloseDoorForFloor(elevatorid, _ElevatorData[elevatorid][_ElevatorOnFloor]);
    return SetTimerEx("Timer_CallElevator", 1000, false, "dd", elevatorid, floorid);
}
forward Timer_CallElevator(elevatorid, floorid);
public Timer_CallElevator(elevatorid, floorid)
{
    new Float:x, Float:y, Float:z;
    GetDynamicObjectPos(_ElevatorData[elevatorid][_ElevatorObj], x, y, z);
    MoveDynamicObject(_ElevatorData[elevatorid][_ElevatorObj], x, y, _ElevatorData[elevatorid][_ElevatorFloor][floorid], _ELEVATOR_MOVE_SPEED);
    MoveDynamicObject(_ElevatorData[elevatorid][_ElevatorPortR], x, y, _ElevatorData[elevatorid][_ElevatorFloor][floorid] - 0.04, _ELEVATOR_MOVE_SPEED);
    MoveDynamicObject(_ElevatorData[elevatorid][_ElevatorPortL], x, y, _ElevatorData[elevatorid][_ElevatorFloor][floorid] - 0.04, _ELEVATOR_MOVE_SPEED);
    _ElevatorData[elevatorid][_ElevatorOnFloor] = floorid;
    return CallLocalFunction("OnElevatorCalled", "dd", elevatorid, floorid);
}
stock OpenPortsElevator(elevatorid)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    new Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz;
    GetDynamicObjectPos(_ElevatorData[elevatorid][_ElevatorObj], x, y, z);
    GetDynamicObjectRot(_ElevatorData[elevatorid][_ElevatorObj], rx, ry, rz);
    MoveDynamicObject(_ElevatorData[elevatorid][_ElevatorPortR], x + (1.75 * floatsin(-(rz - 360.0), degrees)), y + (1.75 * floatcos(-(rz - 360.0), degrees)), z - 0.0001, _ELEVATOR_MOVE_SPEED);
    MoveDynamicObject(_ElevatorData[elevatorid][_ElevatorPortL], x + (1.75 * floatsin(-(rz - 180.0), degrees)), y + (1.75 * floatcos(-(rz - 180.0), degrees)), z - 0.0001, _ELEVATOR_MOVE_SPEED);
    return 1;
}
stock ClosePortsElevator(elevatorid)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    new Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz;
    GetDynamicObjectPos(_ElevatorData[elevatorid][_ElevatorObj], x, y, z);
    GetDynamicObjectRot(_ElevatorData[elevatorid][_ElevatorObj], rx, ry, rz);
    MoveDynamicObject(_ElevatorData[elevatorid][_ElevatorPortR], x, y, z, _ELEVATOR_MOVE_SPEED);
    MoveDynamicObject(_ElevatorData[elevatorid][_ElevatorPortL], x, y, z, _ELEVATOR_MOVE_SPEED);
    return 1;
}
stock GetMaxFloorElevator(elevatorid)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    new Counter;
    for(new i; i < MAX_FLOOR_ELEVATOR; i++)
        if(_ElevatorData[elevatorid][_ElevatorFloor][i] != 0.00)
            Counter++;
    return Counter;
}
stock GetFloorNameForElevator(floorid, elevatorid, floorname[], size)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    if(floorid >= MAX_FLOOR_ELEVATOR) return 0;
    format(floorname, size, _ElevatorFloorName[elevatorid][floorid]);
    return 1;
}
stock SelectFloorOnElevator(elevatorid, floorid)
{
    if(elevatorid >= MAX_ELEVATORS) return 0;
    if(floorid >= MAX_FLOOR_ELEVATOR) return 0;
    if(!IsValidElevator(elevatorid)) return 0;
    if(IsDynamicObjectMoving(_ElevatorData[elevatorid][_ElevatorObj])) return 0;
    if(IsDynamicObjectMoving(_ElevatorData[elevatorid][_ElevatorPortR])) return 0;
    if(IsDynamicObjectMoving(_ElevatorData[elevatorid][_ElevatorPortL])) return 0;
    if(IsDynamicObjectMoving(_ElevatorData[elevatorid][_ElevatorDoorPortL][floorid])) return 0;
    if(IsDynamicObjectMoving(_ElevatorData[elevatorid][_ElevatorDoorPortR][floorid])) return 0;
    CloseDoorForFloor(elevatorid, _ElevatorData[elevatorid][_ElevatorOnFloor]);
    CallElevatorToFloor(elevatorid, floorid);
    ClosePortsElevator(elevatorid);
    return 1;
}

// hook
public OnDynamicObjectMoved(objectid)
{
    for(new elevatorid; elevatorid < MAX_ELEVATORS; elevatorid++)
    {
        if(objectid == _ElevatorData[elevatorid][_ElevatorObj])
        {
            OpenPortsElevator(elevatorid);
            OpenDoorForFloor(elevatorid, _ElevatorData[elevatorid][_ElevatorOnFloor]);
            return CallLocalFunction("OnElevatorStoped", "d", elevatorid);
        }
    }
    return CallLocalFunction("_elevator_OnDynObjMoved", "d", objectid);
}
forward _elevator_OnDynObjMoved(objectid);
#if defined _ALS_OnDynamicObjectMoved
    #undef OnDynamicObjectMoved
#else
    #define _ALS_OnDynamicObjectMoved
#endif
#define OnDynamicObjectMoved _elevator_OnDynObjMoved

public OnPlayerEnterDynamicArea(playerid, areaid)
{
    for(new elevatorid; elevatorid < MAX_ELEVATORS; elevatorid++)
    {
        if(areaid == _ElevatorData[elevatorid][_ElevatorArea])
        {
            return CallLocalFunction("OnPlayerEnterElevator", "dd", playerid, elevatorid);
        }
        for(new floor; floor < MAX_FLOOR_ELEVATOR; floor++)
        {
            if(areaid == _ElevatorData[elevatorid][_ElevatorDoorArea][floor])
            {
                return CallLocalFunction("OnPlayerIsFrontElevator", "ddd", playerid, elevatorid, floor);
            }
        }
    }
    return CallLocalFunction("_elevator_OnPlayerEnterDynArea", "dd", playerid, areaid);
}
forward _elevator_OnPlayerEnterDynArea(playerid, areaid);
#if defined _ALS_OnPlayerEnterDynamicArea
    #undef OnPlayerEnterDynamicArea
#else
    #define _ALS_OnPlayerEnterDynamicArea
#endif
#define OnPlayerEnterDynamicArea _elevator_OnPlayerEnterDynArea

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    for(new elevatorid; elevatorid < MAX_ELEVATORS; elevatorid++)
    {
        if(areaid == _ElevatorData[elevatorid][_ElevatorArea])
        {
            return CallLocalFunction("OnPlayerLeaveElevator", "dd", playerid, elevatorid);
        }
        for(new floor; floor < MAX_FLOOR_ELEVATOR; floor++)
        {
            if(areaid == _ElevatorData[elevatorid][_ElevatorDoorArea][floor])
            {
                return CallLocalFunction("OnPlayerLeaveFrontElevator", "ddd", playerid, elevatorid, floor);
            }
        }
    }
    return CallLocalFunction("_elevator_OnPlayerLeaveDynArea", "dd", playerid, areaid);
}
forward _elevator_OnPlayerLeaveDynArea(playerid, areaid);
#if defined _ALS_OnPlayerLeaveDynamicArea
    #undef OnPlayerLeaveDynamicArea
#else
    #define _ALS_OnPlayerLeaveDynamicArea
#endif
#define OnPlayerLeaveDynamicArea _elevator_OnPlayerLeaveDynArea


forward OnElevatorCalled(elevatorid, floorid);
forward OnElevatorStoped(elevatorid);
forward OnPlayerEnterElevator(playerid, elevatorid);
forward OnPlayerIsFrontElevator(playerid, elevatorid, floor);
forward OnPlayerLeaveElevator(playerid, elevatorid);
forward OnPlayerLeaveFrontElevator(playerid, elevatorid, floor);