Jump to content

problema filescript


Mihai94TDI

Recommended Posts

salut, tot incerc sa compilez acest script dar nu reusesc imi da erori:

sursa:

Spoiler

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Example Filterscript for the new LS BeachSide Building with Elevator
// --------------------------------------------------------------------
// Original elevator code by Zamaroht in 2010
//
// Updated by Kye in 2011
// * Added a sound effect for the elevator starting/stopping
//
// Edited by Matite in January 2015
// * Added code to remove the existing building, add the new building and
//   adapted the elevator code so it works in this new building
//
//
// This script creates the new LS BeachSide 1 building object, removes the
// existing GTASA LS BeachSide building object and creates an elevator that
// can be used to travel between the building foyer and all levels.
//
// You can un-comment the OnPlayerCommandText callback below to enable a simple
// teleport command (/lsb) that teleports you to the LS BeachSide building.
//
// Warning...
// This script uses a total of:
// * 30 objects = 1 for the elevator, 2 for the elevator doors, 26 for the elevator
//   floor doors and 1 for the building (replacement LS BeachSide building)
// * 14 3D Text Labels = 13 on the floors and 1 in the elevator
// * 1 dialog (for the elevator)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------


// -----------------------------------------------------------------------------
// Includes
// --------

// SA-MP include
#include <a_samp>

// For PlaySoundForPlayersInRange()
#include "../include/gl_common.inc"

// -----------------------------------------------------------------------------
// Defines
// -------

// Movement speed of the elevator
#define ELEVATOR_SPEED      (5.0)

// Movement speed of the doors
#define DOORS_SPEED         (5.0)

// Time in ms that the elevator will wait in each floor before continuing with the queue...
// be sure to give enough time for doors to open
#define ELEVATOR_WAIT_TIME  (5000)  

// Dialog ID for the LS BeachSide elevator dialog
#define DIALOG_ID           (877)

// Position defines
#define X_DOOR_R_OPENED     (289.542419)
#define X_DOOR_L_OPENED     (286.342407)
#define Y_DOOR_R_OPENED     (-1609.640991)
#define Y_DOOR_L_OPENED     (-1609.076049)

#define X_FDOOR_R_OPENED    (289.492431)
#define X_FDOOR_L_OPENED    (286.292419)
#define Y_FDOOR_R_OPENED    (-1609.870971)
#define Y_FDOOR_L_OPENED    (-1609.306030)

#define GROUND_Z_COORD      (33.825077)
#define X_ELEVATOR_POS      (287.942413)
#define Y_ELEVATOR_POS      (-1609.341064)

// Elevator state defines
#define ELEVATOR_STATE_IDLE     (0)
#define ELEVATOR_STATE_WAITING  (1)
#define ELEVATOR_STATE_MOVING   (2)

// Invalid floor define
#define INVALID_FLOOR           (-1)

// Used for chat text messages
#define COLOR_MESSAGE_YELLOW        0xFFDD00AA

// -----------------------------------------------------------------------------
// Constants
// ---------

// Elevator floor names for the 3D text labels
static FloorNames[13][] =
{
    "Ground Floor",
    "First Floor",
    "Second Floor",
    "Third Floor",
    "Fourth Floor",
    "Fifth Floor",
    "Sixth Floor",
    "Seventh Floor",
    "Eighth Floor",
    "Ninth Floor",
    "Tenth Floor",
    "Eleventh Floor",
    "Twelfth Floor"
};

// Elevator floor Z heights
static Float:FloorZOffsets[13] =
{
    0.0,        // 0.0,
    14.061004,  // Distance from ground floor to 1st floor is more than all other floors
    18.561004,  // 14.061004 + (4.5 * 1.0)
    23.061004,  // 14.061004 + (4.5 * 2.0)
    27.561004,  // 14.061004 + (4.5 * 3.0)
    32.061004,  // 14.061004 + (4.5 * 4.0)
    36.561004,  // 14.061004 + (4.5 * 5.0)
    41.061004,  // 14.061004 + (4.5 * 1.0)
    45.561004,  // 14.061004 + (4.5 * 1.0)
    50.061004,  // 14.061004 + (4.5 * 8.0)
    54.561004,  // 14.061004 + (4.5 * 9.0)
    59.061004,  // 14.061004 + (4.5 * 10.0)
    63.561004,  // 14.061004 + (4.5 * 11.0)
};

// -----------------------------------------------------------------------------
// Variables
// ---------

// Stores the created object numbers of the replacement building and interior
// parts so they can be destroyed when the filterscript is unloaded
new LSBeachSide1Object;
new LSBeachSide1InteriorObject;

// Stores the created object numbers of the elevator, the elevator doors and
// the elevator floor doors so they can be destroyed when the filterscript
// is unloaded
new Obj_Elevator, Obj_ElevatorDoors[2], Obj_FloorDoors[13][2];
    
// Stores a reference to the 3D text labels used on each floor and inside the
// elevator itself so they can be detroyed when the filterscript is unloaded
new Text3D:Label_Elevator, Text3D:Label_Floors[13];

// Stores the current state of the elevator (ie ELEVATOR_STATE_IDLE,
// ELEVATOR_STATE_WAITING or ELEVATOR_STATE_MOVING)
new ElevatorState;

// Stores the current floor the elevator is on or heading to... if the value is
// ELEVATOR_STATE_IDLE or ELEVATOR_STATE_WAITING this is the current floor. If
// the value is ELEVATOR_STATE_MOVING then it is the floor it's moving to
new ElevatorFloor;  

// Stores the elevator queue for each floor
new ElevatorQueue[13];

// Stores who requested the floor for the elevator queue...
// FloorRequestedBy[floor_id] = playerid;  (stores who requested which floor)
new FloorRequestedBy[13];

// Used for a timer that makes the elevator move faster after players start
// surfing the object
new ElevatorBoostTimer;

// -----------------------------------------------------------------------------
// Function Forwards
// -----------------

// Public:
forward CallElevator(playerid, floorid);    // You can use INVALID_PLAYER_ID too.
forward ShowElevatorDialog(playerid);

// Private:
forward Elevator_Initialize();
forward Elevator_Destroy();

forward Elevator_OpenDoors();
forward Elevator_CloseDoors();
forward Floor_OpenDoors(floorid);
forward Floor_CloseDoors(floorid);

forward Elevator_MoveToFloor(floorid);
forward Elevator_Boost(floorid);            // Increases the elevator speed until it reaches 'floorid'.
forward Elevator_TurnToIdle();

forward ReadNextFloorInQueue();
forward RemoveFirstQueueFloor();
forward AddFloorToQueue(floorid);
forward IsFloorInQueue(floorid);
forward ResetElevatorQueue();

forward DidPlayerRequestElevator(playerid);

forward Float:GetElevatorZCoordForFloor(floorid);
forward Float:GetDoorsZCoordForFloor(floorid);

// -----------------------------------------------------------------------------
// Callbacks
// ---------

// Un-comment the OnPlayerCommandText callback below (remove the "/*" and the "*/")
// to enable a simple teleport command (/lsb) which teleports the player to
// outside the LS BeachSide building.

/*
public OnPlayerCommandText(playerid, cmdtext[])
{
    // Check command text
    if (strcmp("/lsb", cmdtext, true, 4) == 0)
    {
        // Set the interior
        SetPlayerInterior(playerid, 0);

        // Set player position and facing angle
        SetPlayerPos(playerid, 289.81 + random(2), -1630.65 + random(2), 34.32);
        SetPlayerFacingAngle(playerid, 10);

        // Fix camera position after teleporting
        SetCameraBehindPlayer(playerid);

        // Send a gametext message to the player
        GameTextForPlayer(playerid, "~b~~h~LS BeachSide!", 3000, 3);

        // Exit here
        return 1;
    }

    // Exit here (return 0 as the command was not handled in this filterscript)
    return 0;
}
*/

public OnFilterScriptInit()
{
    // Display information in the Server Console
    print("\n");
    print("  |---------------------------------------------------");
    print("  |--- LS BeachSide Filterscript");
    print("  |--  Script v1.01");
    print("  |--  12th January 2015");
    print("  |---------------------------------------------------");

    // Create the LS BeachSide Building object
    LSBeachSide1Object = CreateObject(19596, 280.297, -1606.2, 72.3984, 0, 0, 0);
    
    // Create the LS BeachSide Building interior object
    LSBeachSide1InteriorObject = CreateObject(19597, 280.297, -1606.2, 72.3984, 0, 0, 0);

    // Display information in the Server Console
    print("  |--  LS BeachSide Building and Interior objects created");

    // Reset the elevator queue
    ResetElevatorQueue();

    // Create the elevator object, the elevator doors and the floor doors
    Elevator_Initialize();

    // Display information in the Server Console
    print("  |--  LS BeachSide Building Elevator created");
    print("  |---------------------------------------------------");
    
    // Loop
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        // Check if the player is connected and not a NPC
        if (IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            // Remove default GTASA BeachSide map objects and LOD
            // (so any player currently ingame does not have to rejoin for them
            //  to be removed when this filterscript is loaded)
            RemoveBuildingForPlayer(i, 6391, 280.297, -1606.2, 72.3984, 250.0); // Building
            RemoveBuildingForPlayer(i, 6394, 280.297, -1606.2, 72.3984, 250.0); // LOD
            RemoveBuildingForPlayer(i, 6518, 280.297, -1606.2, 72.3984, 250.0); // Night Lights
        }
    }

    // Exit here
    return 1;
}

public OnFilterScriptExit()
{
    // Check for valid object
    if (IsValidObject(LSBeachSide1Object))
    {
        // Destroy the LS BeachSide Building object
        DestroyObject(LSBeachSide1Object);

        // Display information in the Server Console
        print("  |---------------------------------------------------");
        print("  |--  LS BeachSide Building object destroyed");
    }
    
    // Check for valid object
    if (IsValidObject(LSBeachSide1InteriorObject))
    {
        // Destroy the LS BeachSide Building interior object
        DestroyObject(LSBeachSide1InteriorObject);

        // Display information in the Server Console
        print("  |---------------------------------------------------");
        print("  |--  LS BeachSide Building Interior object destroyed");
    }

    // Destroy the elevator, the elevator doors and the elevator floor doors
    Elevator_Destroy();

    // Display information in the Server Console
    print("  |--  LS BeachSide Building Elevator destroyed");
    print("  |---------------------------------------------------");

    // Exit here
    return 1;
}

public OnPlayerConnect(playerid)
{
    // Remove default GTASA BeachSide map objects and LOD
    RemoveBuildingForPlayer(playerid, 6391, 280.297, -1606.2, 72.3984, 250.0); // Building
    RemoveBuildingForPlayer(playerid, 6394, 280.297, -1606.2, 72.3984, 250.0); // LOD
    RemoveBuildingForPlayer(playerid, 6518, 280.297, -1606.2, 72.3984, 250.0); // Night Lights

    // Exit here
    return 1;
}

public OnObjectMoved(objectid)
{
    // Create variables
    new Float:x, Float:y, Float:z;
    
    // Loop
    for(new i; i < sizeof(Obj_FloorDoors); i ++)
    {
        // Check if the object that moved was one of the elevator floor doors
        if(objectid == Obj_FloorDoors[0])
        {
            GetObjectPos(Obj_FloorDoors[0], x, y, z);

            // Some floor doors have shut, move the elevator to next floor in queue:
            if (y < Y_DOOR_L_OPENED - 0.5)
            {
                Elevator_MoveToFloor(ElevatorQueue[0]);
                RemoveFirstQueueFloor();
            }
        }
    }

    if(objectid == Obj_Elevator)   // The elevator reached the specified floor.
    {
        KillTimer(ElevatorBoostTimer);  // Kills the timer, in case the elevator reached the floor before boost.

        FloorRequestedBy[ElevatorFloor] = INVALID_PLAYER_ID;

        Elevator_OpenDoors();
        Floor_OpenDoors(ElevatorFloor);

        GetObjectPos(Obj_Elevator, x, y, z);
        Label_Elevator  = Create3DTextLabel("{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to use elevator", 0xCCCCCCAA, X_ELEVATOR_POS + 1.6, Y_ELEVATOR_POS - 1.85, z - 0.4, 4.0, 0, 1);

        ElevatorState   = ELEVATOR_STATE_WAITING;
        SetTimer("Elevator_TurnToIdle", ELEVATOR_WAIT_TIME, 0);
    }

    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_ID)
    {
        if(!response)
            return 0;

        if(FloorRequestedBy[listitem] != INVALID_PLAYER_ID || IsFloorInQueue(listitem))
            GameTextForPlayer(playerid, "~r~The floor is already in the queue", 3500, 4);
        else if(DidPlayerRequestElevator(playerid))
            GameTextForPlayer(playerid, "~r~You already requested the elevator", 3500, 4);
        else
            CallElevator(playerid, listitem);

        return 1;
    }

    return 0;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(!IsPlayerInAnyVehicle(playerid) && (newkeys & KEY_YES))
    {
        new Float:pos[3];
        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
        
        //printf("X = %0.2f | Y = %0.2f | Z = %0.2f", pos[0], pos[1], pos[2]);

        // Check if the player is using the button inside the elevator
        if(pos[1] > (Y_ELEVATOR_POS - 1.8) && pos[1] < (Y_ELEVATOR_POS + 1.8) && pos[0] < (X_ELEVATOR_POS + 1.8) && pos[0] > (X_ELEVATOR_POS - 1.8))
        {
            // Show the elevator dialog to the player
            ShowElevatorDialog(playerid);
        }
        else
        {
            // Check if the player is using the button on one of the floors
            if(pos[1] < (Y_ELEVATOR_POS - 1.81) && pos[1] > (Y_ELEVATOR_POS - 3.8) && pos[0] > (X_ELEVATOR_POS + 1.21) && pos[0] < (X_ELEVATOR_POS + 3.8))
            {
                // The player is most likely using an elevator floor button, check which floor
                
                // Create variable (number of floors to check)
                new i = 12;

                // Loop
                while(pos[2] < GetDoorsZCoordForFloor(i) + 3.5 && i > 0)
                    i --;

                if(i == 0 && pos[2] < GetDoorsZCoordForFloor(0) + 2.0)
                    i = -1;

                if (i <= 11)
                {
                    // Check if the elevator is not moving (idle or waiting)
                    if (ElevatorState != ELEVATOR_STATE_MOVING)
                    {
                        // Check if the elevator is already on the floor it was called from
                        if (ElevatorFloor == i + 1)
                        {
                            // Display gametext message to the player
                            GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~y~~h~LS BeachSide Elevator Is~n~~y~~h~Already On This Floor...~n~~w~Walk Inside It~n~~w~And Press '~k~~CONVERSATION_YES~'", 3500, 3);

                            // Display chat text message to the player and exit here
                            SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* The LS BeachSide elevator is already on this floor... walk inside it and press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}'");
                            return 1;
                        }
                    }

                    // Call function to call the elevator to the floor
                    CallElevator(playerid, i + 1);

                    // Display gametext message to the player
                    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~g~~h~LS BeachSide Elevator~n~~g~~h~Has Been Called...~n~~w~Please Wait", 3000, 3);

                    // Create variable for formatted message
                    new strTempString[100];
                    
                    // Check if the elevator is moving
                    if (ElevatorState == ELEVATOR_STATE_MOVING)
                    {
                        // Format chat text message
                        format(strTempString, sizeof(strTempString), "* The LS BeachSide elevator has been called... it is currently moving towards the %s.", FloorNames[ElevatorFloor]);
                    }
                    else
                    {
                        // Format chat text message
                        format(strTempString, sizeof(strTempString), "* The LS BeachSide elevator has been called... it is currently on the %s.", FloorNames[ElevatorFloor]);
                    }
                    
                    // Display formatted chat text message to the player
                    SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString);

                    // Exit here
                    return 1;
                }
            }
        }
    }

    return 1;
}

// ------------------------ Functions ------------------------
stock Elevator_Initialize()
{
    // Initializes the elevator.

    Obj_Elevator            = CreateObject(18755, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD, 0.000000, 0.000000, 80.000000);
    Obj_ElevatorDoors[0]    = CreateObject(18757, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD, 0.000000, 0.000000, 80.000000);
    Obj_ElevatorDoors[1]    = CreateObject(18756, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD, 0.000000, 0.000000, 80.000000);

    Label_Elevator          = Create3DTextLabel("{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to use elevator", 0xCCCCCCAA, X_ELEVATOR_POS + 1.6, Y_ELEVATOR_POS - 1.85, GROUND_Z_COORD - 0.4, 4.0, 0, 1);

    new string[128],
        Float:z;

    for(new i; i < sizeof(Obj_FloorDoors); i ++)
    {
        Obj_FloorDoors[0]    = CreateObject(18757, X_ELEVATOR_POS, Y_ELEVATOR_POS - 0.245, GetDoorsZCoordForFloor(i) + 0.05, 0.000000, 0.000000, 80.000000);
        Obj_FloorDoors[1]    = CreateObject(18756, X_ELEVATOR_POS, Y_ELEVATOR_POS - 0.245, GetDoorsZCoordForFloor(i) + 0.05, 0.000000, 0.000000, 80.000000);

        format(string, sizeof(string), "{CCCCCC}[%s]\n{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to call", FloorNames);

        // Calculate label Z position
        if (i == 0)
        {
            z = GROUND_Z_COORD;
        }
        else if (i == 1)
        {
            z = GROUND_Z_COORD + 14.061004;
        }
        else
        {
            z = GROUND_Z_COORD + 14.061004 + ((i - 1) * 4.5);
        }

        Label_Floors         = Create3DTextLabel(string, 0xCCCCCCAA, X_ELEVATOR_POS + 2, Y_ELEVATOR_POS -3, z - 0.2, 10.5, 0, 1);
    }

    // Open ground floor doors:
    Floor_OpenDoors(0);
    Elevator_OpenDoors();

    return 1;
}

stock Elevator_Destroy()
{
    // Destroys the elevator.

    DestroyObject(Obj_Elevator);
    DestroyObject(Obj_ElevatorDoors[0]);
    DestroyObject(Obj_ElevatorDoors[1]);
    Delete3DTextLabel(Label_Elevator);

    for(new i; i < sizeof(Obj_FloorDoors); i ++)
    {
        DestroyObject(Obj_FloorDoors[0]);
        DestroyObject(Obj_FloorDoors[1]);
        Delete3DTextLabel(Label_Floors);
    }

    return 1;
}

stock Elevator_OpenDoors()
{
    // Opens the elevator's doors.

    new Float:x, Float:y, Float:z;

    GetObjectPos(Obj_ElevatorDoors[0], x, y, z);
    MoveObject(Obj_ElevatorDoors[0], X_DOOR_L_OPENED, Y_DOOR_L_OPENED, z, DOORS_SPEED);
    MoveObject(Obj_ElevatorDoors[1], X_DOOR_R_OPENED, Y_DOOR_R_OPENED, z, DOORS_SPEED);

    return 1;
}

stock Elevator_CloseDoors()
{
    // Closes the elevator's doors.

    if(ElevatorState == ELEVATOR_STATE_MOVING)
        return 0;

    new Float:x, Float:y, Float:z;

    GetObjectPos(Obj_ElevatorDoors[0], x, y, z);
    MoveObject(Obj_ElevatorDoors[0], X_ELEVATOR_POS, Y_ELEVATOR_POS, z, DOORS_SPEED);
    MoveObject(Obj_ElevatorDoors[1], X_ELEVATOR_POS, Y_ELEVATOR_POS, z, DOORS_SPEED);

    return 1;
}

stock Floor_OpenDoors(floorid)
{
    // Opens the doors at the specified floor.

    MoveObject(Obj_FloorDoors[floorid][0], X_FDOOR_L_OPENED, Y_FDOOR_L_OPENED, GetDoorsZCoordForFloor(floorid) + 0.05, DOORS_SPEED);
    MoveObject(Obj_FloorDoors[floorid][1], X_FDOOR_R_OPENED, Y_FDOOR_R_OPENED, GetDoorsZCoordForFloor(floorid) + 0.05, DOORS_SPEED);
    
    PlaySoundForPlayersInRange(6401, 50.0, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid) + 5.0);

    return 1;
}

stock Floor_CloseDoors(floorid)
{
    // Closes the doors at the specified floor.

    MoveObject(Obj_FloorDoors[floorid][0], X_ELEVATOR_POS, Y_ELEVATOR_POS - 0.245, GetDoorsZCoordForFloor(floorid) + 0.05, DOORS_SPEED);
    MoveObject(Obj_FloorDoors[floorid][1], X_ELEVATOR_POS, Y_ELEVATOR_POS - 0.245, GetDoorsZCoordForFloor(floorid) + 0.05, DOORS_SPEED);
    
    PlaySoundForPlayersInRange(6401, 50.0, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid) + 5.0);

    return 1;
}

stock Elevator_MoveToFloor(floorid)
{
    // Moves the elevator to specified floor (doors are meant to be already closed).

    ElevatorState = ELEVATOR_STATE_MOVING;
    ElevatorFloor = floorid;

    // Move the elevator slowly, to give time to clients to sync the object surfing. Then, boost it up:
    MoveObject(Obj_Elevator, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetElevatorZCoordForFloor(floorid), 0.25);
    MoveObject(Obj_ElevatorDoors[0], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), 0.25);
    MoveObject(Obj_ElevatorDoors[1], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), 0.25);
    Delete3DTextLabel(Label_Elevator);

    ElevatorBoostTimer = SetTimerEx("Elevator_Boost", 2000, 0, "i", floorid);

    return 1;
}

public Elevator_Boost(floorid)
{
    // Increases the elevator's speed until it reaches 'floorid'
    StopObject(Obj_Elevator);
    StopObject(Obj_ElevatorDoors[0]);
    StopObject(Obj_ElevatorDoors[1]);
    
    MoveObject(Obj_Elevator, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetElevatorZCoordForFloor(floorid), ELEVATOR_SPEED);
    MoveObject(Obj_ElevatorDoors[0], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), ELEVATOR_SPEED);
    MoveObject(Obj_ElevatorDoors[1], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), ELEVATOR_SPEED);

    return 1;
}

public Elevator_TurnToIdle()
{
    ElevatorState = ELEVATOR_STATE_IDLE;
    ReadNextFloorInQueue();

    return 1;
}

stock RemoveFirstQueueFloor()
{
    // Removes the data in ElevatorQueue[0], and reorders the queue accordingly.

    for(new i; i < sizeof(ElevatorQueue) - 1; i ++)
        ElevatorQueue = ElevatorQueue[i + 1];

    ElevatorQueue[sizeof(ElevatorQueue) - 1] = INVALID_FLOOR;

    return 1;
}

stock AddFloorToQueue(floorid)
{
    // Adds 'floorid' at the end of the queue.

    // Scan for the first empty space:
    new slot = -1;
    for(new i; i < sizeof(ElevatorQueue); i ++)
    {
        if(ElevatorQueue == INVALID_FLOOR)
        {
            slot = i;
            break;
        }
    }

    if(slot != -1)
    {
        ElevatorQueue[slot] = floorid;

        // If needed, move the elevator.
        if(ElevatorState == ELEVATOR_STATE_IDLE)
            ReadNextFloorInQueue();

        return 1;
    }

    return 0;
}

stock ResetElevatorQueue()
{
    // Resets the queue.

    for(new i; i < sizeof(ElevatorQueue); i ++)
    {
        ElevatorQueue    = INVALID_FLOOR;
        FloorRequestedBy = INVALID_PLAYER_ID;
    }

    return 1;
}

stock IsFloorInQueue(floorid)
{
    // Checks if the specified floor is currently part of the queue.

    for(new i; i < sizeof(ElevatorQueue); i ++)
        if(ElevatorQueue == floorid)
            return 1;

    return 0;
}

stock ReadNextFloorInQueue()
{
    // Reads the next floor in the queue, closes doors, and goes to it.

    if(ElevatorState != ELEVATOR_STATE_IDLE || ElevatorQueue[0] == INVALID_FLOOR)
        return 0;

    Elevator_CloseDoors();
    Floor_CloseDoors(ElevatorFloor);

    return 1;
}

stock DidPlayerRequestElevator(playerid)
{
    for(new i; i < sizeof(FloorRequestedBy); i ++)
        if(FloorRequestedBy == playerid)
            return 1;

    return 0;
}

stock ShowElevatorDialog(playerid)
{
    new string[512];
    for(new i; i < sizeof(ElevatorQueue); i ++)
    {
        if(FloorRequestedBy != INVALID_PLAYER_ID)
            strcat(string, "{FF0000}");

        strcat(string, FloorNames);
        strcat(string, "\n");
    }

    ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_LIST, "LS BeachSide Elevator...", string, "Accept", "Cancel");

    return 1;
}

stock CallElevator(playerid, floorid)
{
    // Calls the elevator (also used with the elevator dialog).

    if(FloorRequestedBy[floorid] != INVALID_PLAYER_ID || IsFloorInQueue(floorid))
        return 0;

    FloorRequestedBy[floorid] = playerid;
    AddFloorToQueue(floorid);

    return 1;
}

stock Float:GetElevatorZCoordForFloor(floorid)
    return (GROUND_Z_COORD + FloorZOffsets[floorid]);

stock Float:GetDoorsZCoordForFloor(floorid)
    return (GROUND_Z_COORD + FloorZOffsets[floorid]);

 

C:\Users\Mihai\Desktop\ls_beachside.pwn(569) : error 017: undefined symbol "PlaySoundForPlayersInRange"
C:\Users\Mihai\Desktop\ls_beachside.pwn(581) : error 017: undefined symbol "PlaySoundForPlayersInRange"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
 

ca sa pot face liftul functional la acel bloc din LS .

Link to comment
Share on other sites

Acest simbol nu este definit 
 

Citat

stock PlaySoundForPlayersInRange(soundid, Float:range, Float:x, Float:y, Float:z)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i,range,x,y,z))
        {
            PlayerPlaySound(i, soundid, x, y, z);
        }
    }
}

incearca asta sa bagi si tot o sa fie ok

  • Thanks 1
Link to comment
Share on other sites

Acum 6 minute, #Yudin a spus:

Acest simbol nu este definit 
 

incearca asta sa bagi si tot o sa fie ok

 

am pus in sursa ce ai dat tu dar acum imi da astea 3 erori...

 

C:\Users\Mihai\Desktop\ls_beachside.pwn(750) : error 001: expected token: ")", but found "ï"
C:\Users\Mihai\Desktop\ls_beachside.pwn(750) : error 029: invalid expression, assumed zero
C:\Users\Mihai\Desktop\ls_beachside.pwn(750) : error 010: invalid function or declaration
C:\Users\Mihai\Desktop\ls_beachside.pwn(750 -- 752) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

Link to comment
Share on other sites

Acum 56 minute, #Yudin a spus:

copiaza unde este eroare si trimite 

aici  de la linia asta vine eroarea

stock PlaySoundForPlayersInRange(soundid, Float:range, Float:x, Float:y, Float:z)

 am rezolvat era o eroare de copiere nu stiu de unde o aparut aceste heroglife dupa floar:z    ""

Edited by Mihai94TDI
Link to comment
Share on other sites

1 oră în urmă, #Yudin a spus:

copiaza unde este eroare si trimite 

stii de ce apare asa?

https://imgur.com/a/58lj8vo

 

daca scot acel plugin de lift apare blocul normal doar ca nu are lift-ul si daca intra omul in lift pica prin  mapa, iar daca pun sursa apare ca in poze, lift-ul merge numai ca dispare acele zone de jos, exista vreo rezolvare?

Link to comment
Share on other sites

Acum 2 ore, Mihai94TDI a spus:

stii de ce apare asa?

https://imgur.com/a/58lj8vo

 

daca scot acel plugin de lift apare blocul normal doar ca nu are lift-ul si daca intra omul in lift pica prin  mapa, iar daca pun sursa apare ca in poze, lift-ul merge numai ca dispare acele zone de jos, exista vreo rezolvare?

deja problema este in FS nu in functia care ai puso ca aceasta functie care avea eroare nu are nimic cu liftul ea raspunde de audio jucatorului in anumit radius

Link to comment
Share on other sites

Acum 2 ore, #Yudin a spus:

deja problema este in FS nu in functia care ai puso ca aceasta functie care avea eroare nu are nimic cu liftul ea raspunde de audio jucatorului in anumit radius

multumesc pt ajutor, am dat de 2 ori restart la sv si nu a mai facut probleme, multumesc.

inca ceva unde as putea gasi niste scripturi ca sa dea kick la jucatori care sunt afk si nu sunt sleep in casa, si unu-l pt respawn la masinile de pe sv, de ex daca cineva abandoneaza o masina si nu a mai mers nimeni cu ea de 15-20 ninute sa dispara de pe sv.

Link to comment
Share on other sites

Citat

CMD:spcar(playerid, params[])
{
    new radius;
    if(sscanf(params, "d", radius)) return SendClientMessage(playerid, COLOR_FADE1, "Scrie /respv [radius]  ( in radius de la 1 pina la 500, pentru a spawna toate masinile introdu -1");
    else if(!(-1 <= radius <= 500)) return SendClientMessage(playerid, COLOR_FADE1, "Ai incalcat limita radiusului");
    if(radius == -1)
    {
        for(new i = 1, j = GetVehiclePoolSize(); i <= j; i++)
        {
            if(!IsVehicleOccupied(i)) SetVehicleToRespawn(i);
        }
        new string[128];
        format(string, sizeof(string), "[Admin ] %s a spawnat toate masinile", GetName(playerid));
        SendAdminMessage(COLOR_GREY, string);
    }
    else
    {
        new Float:x, Float:y, Float:z, destroyvehs = 0;
        for(new i = 1, j = GetVehiclePoolSize(); i <= j; i++)
        {
            GetPlayerPos(playerid, x, y, z);
            if(IsVehicleInRangeOfPoint(i, radius, x, y, z))
            {
                if(Itter_Contains(adm_vehicles, i))
                {
                    if(IsValidVehicle(i))
                    {
                        DestroyVehicle(i);
                        destroyvehs++;
                    }
                    TotalAdminVehicles -= destroyvehs;
                    SetTimerEx("Itter_OPDCInternal_adm_vehicles", 0, false, "i", i);
                }
                SetVehicleToRespawn(i);
            }
        }
        new string[128];
        format(string, sizeof(string), "[Admin ] %s a spawnat toate masinile in radius de %d ì", GetName(playerid), radius);
        SendAdminMessage(COLOR_GREY, string);
    }
    return 1;
}

uite pentru spawnarea masinilor si in radius si toate in general

  • Like 1
Link to comment
Share on other sites

    #define AFKSeconds 600

    if(PlayerEx[x][VarEx] > AFKSeconds)
    {
    new string[255];
    format(string,sizeof(string),"[AFK]: %s a primit kick pentru AFK.", GetPlayerNameEx(x));
    SendClientMessageToAll(COLOR_YELLOW,string);
    Kick(x);
    PlayerEx[x][VarEx] = 0;
    }

 

uite si kick pentru afk

  • Like 1
Link to comment
Share on other sites

Acum 12 ore, #Yudin a spus:

    #define AFKSeconds 600

    if(PlayerEx[x][VarEx] > AFKSeconds)
    {
    new string[255];
    format(string,sizeof(string),"[AFK]: %s a primit kick pentru AFK.", GetPlayerNameEx(x));
    SendClientMessageToAll(COLOR_YELLOW,string);
    Kick(x);
    PlayerEx[x][VarEx] = 0;
    }

 

uite si kick pentru afk

astea de la kick unde trebuie adugate in gamemode? 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.