Move Object
#1

This include should prompt for a password, then if entered correctly, move the object, if it's open, it should close the object. When you walk up to a closed object and do /gate, it moves it down (it should rotate 90 degrees), without asking for a pass. Then it asks you for a password if you enter /gate again, though the object does not return.

pawn Код:
#include <a_samp>
#include <zcmd>

new gate,
Float:closed[MAX_OBJECTS],
Float:closedX[MAX_OBJECTS],
Float:closedY[MAX_OBJECTS],
Float:closedZ[MAX_OBJECTS],
Float:closedRX[MAX_OBJECTS],
Float:closedRY[MAX_OBJECTS],
Float:closedRZ[MAX_OBJECTS],
Float:openX[MAX_OBJECTS],
Float:openY[MAX_OBJECTS],
Float:openZ[MAX_OBJECTS],
Float:openRX[MAX_OBJECTS],
Float:openRY[MAX_OBJECTS],
Float:openRZ[MAX_OBJECTS],
code[6][MAX_OBJECTS];
#define DIALOG_GATE 30424245

CMD:gate(playerid, params[])
    {
    for (new i = 0; i <MAX_OBJECTS; i++)
        {
        if(IsPlayerInRangeOfPoint(playerid, 5.5, closedX[i], closedY[i], closedZ[i]))
            {
            if(closed[i] == 1)
                {
                ShowPlayerDialog(playerid, DIALOG_GATE, DIALOG_STYLE_INPUT, "Password", "Please enter your password\nto open the door", "Enter", "");
                }
            else
                {
                MoveObject(gate, closedX[i], closedY[i], closed[i], 5.0, closedRX[i], closedRY[i], closedRZ[i]);
                closed[i] = 1;
                }
            }
        }
    return 1;
    }

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid == DIALOG_GATE)
        {
        if(response)
            {
            for (new i = 0; i <MAX_OBJECTS; i++)
                {
                if(strcmp(inputtext, code[i]))
                    {
                    MoveObject(gate, openX[i], openY[i], openZ[i], 5.0, openRX[i], openRY[i], openRZ[i]);
                    closed[i] = 0;
                    }
                else return SendClientMessage(playerid, 0xFF0000AA, "Incorrect code");
                }
            }
        }
    return 1;
    }
stock CreateMovingObject(modelid, Float:closed_X, Float:closed_Y, Float:closed_Z, Float:closed_RX, Float:closed_RY, Float:closed_RZ, Float:open_X, Float:open_Y, Float:open_Z, Float:open_RX, Float:open_RY, Float:open_RZ, gcode[6])
    {
    gate = CreateObject(modelid, closed_X, closed_Y, closed_Z, closed_RX, closed_RY, closed_RZ);
    closedX[gate] = closed_X;
    closedY[gate] = closed_Y;
    closedZ[gate] = closed_Z;
    closedRX[gate] = closed_RX;
    closedRY[gate] = closed_RY;
    closedRZ[gate] = closed_RZ;
    openX[gate] = open_X;
    openY[gate] = open_Y;
    openZ[gate] = open_Z;
    openRX[gate] = open_RX;
    openRY[gate] = open_RY;
    openRZ[gate] = open_RZ;
    code[gate] = gcode;
    closed[gate] = 1;
    return 1;
    }
Reply
#2

anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)