ParseFile_INI No longer working?
#2

Here's the code just in case:
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#undef MAX_PLAYERS
#define MAX_PLAYERS 101
#include <foreach>
#include <YSI\y_ini>
#include <sscanf2>
#include <zcmd>

#define WHITE 0xFFFFFFAA
#define RED 0xFF0000FF
#define LIGHTGREEN 0x24FF0AB9
#define YELLOW 0xFFFF00FF

#define MAX_GATES 100

#define GATE_FILE "NV/Gates/%d.ini" //EDIT

#define DEFAULT_GATE_DRAW_DIST 50.0

#define GATE_TYPE_1 971
#define GATE_TYPE_2 975
#define GATE_TYPE_3 980

#define GATE_PANEL 0
#define GATE_KEYS_DIALOG 1
#define GATE_NAME_DIALOG 2
#define GATE_NAME_DIALOG2 3
#define GATE_KEY_1_DIALOG 4
#define GATE_KEY_2_DIALOG 5
#define GATE_KEY_3_DIALOG 6
#define GATE_KEY_4_DIALOG 7
#define GATE_KEY_5_DIALOG 8
#define GATE_KEY_6_DIALOG 9
#define GATE_KEY_7_DIALOG 10
#define GATE_KEY_8_DIALOG 11
#define GATE_KEY_9_DIALOG 12
#define GATE_KEY_10_DIALOG 13
#define GATE_CMDS_DIALOG 14

forward LoadGate_file(gateid,name[],value[]);

new gateobject[MAX_GATES];
new Text3D:gatelabel[MAX_GATES];

new GetPlayerLastGateID[MAX_PLAYERS char];

enum NV_gate_system //EDIT
{
    gOwner[24],
    gName[50],
    gModelID,
    Float:gDrawDist,
    Float:gClosed_X,
    Float:gClosed_Y,
    Float:gClosed_Z,
    Float:gClosed_RotX,
    Float:gClosed_RotY,
    Float:gClosed_RotZ,
    Float:gOpen_X,
    Float:gOpen_Y,
    Float:gOpen_Z,
    Float:gOpen_RotX,
    Float:gOpen_RotY,
    Float:gOpen_RotZ,
    gKeyOwner1[24],
    gKeyOwner2[24],
    gKeyOwner3[24],
    gKeyOwner4[24],
    gKeyOwner5[24],
    gKeyOwner6[24],
    gKeyOwner7[24],
    gKeyOwner8[24],
    gKeyOwner9[24],
    gKeyOwner10[24]
}
new GateInfo[MAX_GATES][NV_gate_system]; //EDIT

stock GetName(playerid)
{
    new pName[24];
    GetPlayerName(playerid, (pName), sizeof(pName));
    return pName;
}

stock GetID(username[])
{
    foreach(Player, i)
    {
        if(strcmp(GetName(i), username, false, strlen(username)) == 0)
        {
            return i;
        }
    }
    return INVALID_PLAYER_ID;
}

stock GetGateFile(gateid)
{
    new file[20];
    format(file, sizeof(file), GATE_FILE, gateid);
    return file;
}

stock GetFreeGateSlot()
{
    for(new g = 0; g < MAX_GATES; g++)
    {
        if(!fexist(GetGateFile(g)))
        {
            return g;
        }
    }
    return -1;
}

stock SaveGateStats(gateid)
{
    if(fexist(GetGateFile(gateid)))
    {
        print("SaveGateStats > start");
        new INI:file = INI_Open(GetGateFile(gateid));
        INI_SetTag(file, "Gate_Data");
        INI_WriteString(file, "gOwner", GateInfo[gateid][gOwner]);
        INI_WriteString(file, "gName", GateInfo[gateid][gName]);
        INI_WriteInt(file, "gModelID", GateInfo[gateid][gModelID]);
        INI_WriteFloat(file, "gDrawDist", GateInfo[gateid][gDrawDist]);
        INI_WriteFloat(file, "gClosed_X", GateInfo[gateid][gClosed_X]);
        INI_WriteFloat(file, "gClosed_Y", GateInfo[gateid][gClosed_Y]);
        INI_WriteFloat(file, "gClosed_Z", GateInfo[gateid][gClosed_Z]);
        INI_WriteFloat(file, "gClosed_RotX", GateInfo[gateid][gClosed_RotX]);
        INI_WriteFloat(file, "gClosed_RotY", GateInfo[gateid][gClosed_RotY]);
        INI_WriteFloat(file, "gClosed_RotZ", GateInfo[gateid][gClosed_RotZ]);
        INI_WriteFloat(file, "gOpen_X", GateInfo[gateid][gOpen_X]);
        INI_WriteFloat(file, "gOpen_Y", GateInfo[gateid][gOpen_Y]);
        INI_WriteFloat(file, "gOpen_Z", GateInfo[gateid][gOpen_Z]);
        INI_WriteFloat(file, "gOpen_RotX", GateInfo[gateid][gOpen_RotX]);
        INI_WriteFloat(file, "gOpen_RotY", GateInfo[gateid][gOpen_RotY]);
        INI_WriteFloat(file, "gOpen_RotZ", GateInfo[gateid][gOpen_RotZ]);
        INI_WriteString(file, "gKeyOwner1", GateInfo[gateid][gKeyOwner1]);
        INI_WriteString(file, "gKeyOwner2", GateInfo[gateid][gKeyOwner2]);
        INI_WriteString(file, "gKeyOwner3", GateInfo[gateid][gKeyOwner3]);
        INI_WriteString(file, "gKeyOwner4", GateInfo[gateid][gKeyOwner4]);
        INI_WriteString(file, "gKeyOwner5", GateInfo[gateid][gKeyOwner5]);
        INI_WriteString(file, "gKeyOwner6", GateInfo[gateid][gKeyOwner6]);
        INI_WriteString(file, "gKeyOwner7", GateInfo[gateid][gKeyOwner7]);
        INI_WriteString(file, "gKeyOwner8", GateInfo[gateid][gKeyOwner8]);
        INI_WriteString(file, "gKeyOwner9", GateInfo[gateid][gKeyOwner9]);
        INI_WriteString(file, "gKeyOwner10", GateInfo[gateid][gKeyOwner10]);
        INI_Close(file);
        print("SaveGateStats > finish");
    }
    return 1;
}

stock IsPlayerNearExistingGate(playerid)
{
    for(new g = 0; g < MAX_GATES; g++)
    {
        if(fexist(GetGateFile(g)))
        {
            if(IsPlayerInRangeOfPoint(playerid, 8.0, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]) || IsPlayerInRangeOfPoint(playerid, 8.0, GateInfo[g][gOpen_X], GateInfo[g][gOpen_Y], GateInfo[g][gOpen_Z]))
            {
                return true;
            }
        }
    }
    return false;
}

stock IsPlayerInRangeOfGate(playerid)
{
    for(new g = 0; g < MAX_GATES; g++)
    {
        if(fexist(GetGateFile(g)))
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]) || IsPlayerInRangeOfPoint(playerid, 5.0, GateInfo[g][gOpen_X], GateInfo[g][gOpen_Y], GateInfo[g][gOpen_Z]))
            {
                return true;
            }
        }
    }
    return false;
}

stock DeleteNearestGate(playerid)
{
    for(new g = 0; g < MAX_GATES; g++)
    {
        if(fexist(GetGateFile(g)))
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]) || IsPlayerInRangeOfPoint(playerid, 5.0, GateInfo[g][gOpen_X], GateInfo[g][gOpen_Y], GateInfo[g][gOpen_Z]))
            {
                DestroyObject(gateobject[g]);
                Delete3DTextLabel(gatelabel[g]);
                fremove(GetGateFile(g));
                new string[128];
                format(string, sizeof(string), "Gate id %d owned by %s has been successfully deleted.", g, GateInfo[g][gOwner]);
                SendClientMessage(playerid, WHITE, string);
                break;
            }
        }
    }
    return 1;
}

stock GetNearestGateID(playerid)
{
    for(new g = 0; g < MAX_GATES; g++)
    {
        if(fexist(GetGateFile(g)))
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]) || IsPlayerInRangeOfPoint(playerid, 5.0, GateInfo[g][gOpen_X], GateInfo[g][gOpen_Y], GateInfo[g][gOpen_Z]))
            {
                return g;
            }
        }
    }
    return -1;
}

stock IsPlayerGateOwner(playerid)
{
    for(new g = 0; g < MAX_GATES; g++)
    {
        if(fexist(GetGateFile(g)))
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]) || IsPlayerInRangeOfPoint(playerid, 5.0, GateInfo[g][gOpen_X], GateInfo[g][gOpen_Y], GateInfo[g][gOpen_Z]))
            {
                if(!strcmp(GetName(playerid), GateInfo[g][gOwner], false))
                {
                    return true;
                }
            }
        }
    }
    return false;
}

stock IsPlayerGateKeyHolder(playerid)
{
    for(new g = 0; g < MAX_GATES; g++)
    {
        if(fexist(GetGateFile(g)))
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]) || IsPlayerInRangeOfPoint(playerid, 5.0, GateInfo[g][gOpen_X], GateInfo[g][gOpen_Y], GateInfo[g][gOpen_Z]))
            {
                if(!strcmp(GetName(playerid), GateInfo[g][gKeyOwner1], false)
                || !strcmp(GetName(playerid), GateInfo[g][gKeyOwner2], false)
                || !strcmp(GetName(playerid), GateInfo[g][gKeyOwner3], false)
                || !strcmp(GetName(playerid), GateInfo[g][gKeyOwner4], false)
                || !strcmp(GetName(playerid), GateInfo[g][gKeyOwner5], false)
                || !strcmp(GetName(playerid), GateInfo[g][gKeyOwner6], false)
                || !strcmp(GetName(playerid), GateInfo[g][gKeyOwner7], false)
                || !strcmp(GetName(playerid), GateInfo[g][gKeyOwner8], false)
                || !strcmp(GetName(playerid), GateInfo[g][gKeyOwner9], false)
                || !strcmp(GetName(playerid), GateInfo[g][gKeyOwner10], false))
                {
                    return true;
                }
            }
        }
    }
    return false;
}

public OnFilterScriptInit()
{
    print("OnFilterScriptInit > start");
    for(new g = 0; g < MAX_GATES; g++)
    {
        if(fexist(GetGateFile(g)))
        {
            print("OnFilterScriptInit> if(fexist()) >");
            INI_ParseFile(GetGateFile(g), "LoadGate_%s", .bExtra = true, .extra = g);
            print("OnFilterScriptInit> if(fexist()) > LoadGate");

            gateobject[g] = CreateObject(GateInfo[g][gModelID], GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], GateInfo[g][gClosed_RotX], GateInfo[g][gClosed_RotY], GateInfo[g][gClosed_RotZ], GateInfo[g][gDrawDist]);
            gatelabel[g] = Create3DTextLabel(GateInfo[g][gName], LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);
            print("OnFilterScriptInit> if(fexist()) > LoadGate > End");
        }
    }
    print("OnFilterScriptInit > finish");
    return 1;
}

public OnFilterScriptExit()
{
    for(new g = 0; g < MAX_GATES; g++)
    {
        if(fexist(GetGateFile(g)))
        {
            DestroyObject(gateobject[g]);
            Delete3DTextLabel(gatelabel[g]);
            SaveGateStats(g);
        }
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == GATE_PANEL)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    MoveObject(gateobject[GetPlayerLastGateID{playerid}], GateInfo[GetPlayerLastGateID{playerid}][gOpen_X], GateInfo[GetPlayerLastGateID{playerid}][gOpen_Y], GateInfo[GetPlayerLastGateID{playerid}][gOpen_Z], 2.0);
                    return 1;
                }
                case 1:
                {
                    MoveObject(gateobject[GetPlayerLastGateID{playerid}], GateInfo[GetPlayerLastGateID{playerid}][gClosed_X], GateInfo[GetPlayerLastGateID{playerid}][gClosed_Y], GateInfo[GetPlayerLastGateID{playerid}][gClosed_Z], 2.0);
                    return 1;
                }
                case 2:
                {
                    new string[200];
                    format(string, sizeof(string), "{FFFFFF}Slot 1: %s\nSlot 2: %s\nSlot 3: %s\nSlot 4: %s\nSlot 5: %s\nSlot 6: %s\nSlot 7: %s\nSlot 8: %s\nSlot 9: %s\nSlot 10: %s",
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner1], GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner2], GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner3], GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner4], GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner5],
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner6], GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner7], GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner8], GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner9], GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner10]);
                    ShowPlayerDialog(playerid, GATE_KEYS_DIALOG, DIALOG_STYLE_LIST, "{FFFFFF}Gate Panel - Gate Keys", string, "Select", "Cancel");
                    return 1;
                }
                case 3:
                {
                    ShowPlayerDialog(playerid, GATE_NAME_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Gate Panel - Gate Name", "{FFFFFF}Please enter your new gate name below:", "Submit", "Cancel");
                    return 1;
                }
            }
        }
        return 1;
    }
    if(dialogid == GATE_KEYS_DIALOG)
    {
        if(response)
        switch(listitem)
        {
            case 0:
            {
                if(strcmp("Empty", GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner1], false) == 0)
                {
                    ShowPlayerDialog(playerid, GATE_KEY_1_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Gate Panel - Gate Name", "{FFFFFF}Please enter the name of the player you want to give keys to:", "Set", "Cancel");
                    return 1;
                }
                else
                {
                    new slot[24];
                    format(slot, sizeof(slot), "Empty");
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner1] = slot;
                    SaveGateStats(GetPlayerLastGateID{playerid});
                    SendClientMessage(playerid, YELLOW, "You have successfully emptied gate key slot (1)");
                    return 1;
                }
            }
            case 1:
            {
                if(strcmp("Empty", GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner2], false) == 0)
                {
                    ShowPlayerDialog(playerid, GATE_KEY_2_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Gate Panel - Gate Name", "{FFFFFF}Please enter the name of the player you want to give keys to:", "Set", "Cancel");
                    return 1;
                }
                else
                {
                    new slot[24];
                    format(slot, sizeof(slot), "Empty");
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner2] = slot;
                    SaveGateStats(GetPlayerLastGateID{playerid});
                    SendClientMessage(playerid, YELLOW, "You have successfully emptied gate key slot (2)");
                    return 1;
                }
            }
            case 2:
            {
                if(strcmp("Empty", GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner3], false) == 0)
                {
                    ShowPlayerDialog(playerid, GATE_KEY_3_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Gate Panel - Gate Name", "{FFFFFF}Please enter the name of the player you want to give keys to:", "Set", "Cancel");
                    return 1;
                }
                else
                {
                    new slot[24];
                    format(slot, sizeof(slot), "Empty");
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner3] = slot;
                    SaveGateStats(GetPlayerLastGateID{playerid});
                    SendClientMessage(playerid, YELLOW, "You have successfully emptied gate key slot (3)");
                    return 1;
                }
            }
            case 3:
            {
                if(strcmp("Empty", GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner4], false) == 0)
                {
                    ShowPlayerDialog(playerid, GATE_KEY_4_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Gate Panel - Gate Name", "{FFFFFF}Please enter the name of the player you want to give keys to:", "Set", "Cancel");
                    return 1;
                }
                else
                {
                    new slot[24];
                    format(slot, sizeof(slot), "Empty");
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner4] = slot;
                    SaveGateStats(GetPlayerLastGateID{playerid});
                    SendClientMessage(playerid, YELLOW, "You have successfully emptied gate key slot (4)");
                    return 1;
                }
            }
            case 4:
            {
                if(strcmp("Empty", GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner5], false) == 0)
                {
                    ShowPlayerDialog(playerid, GATE_KEY_5_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Gate Panel - Gate Name", "{FFFFFF}Please enter the name of the player you want to give keys to:", "Set", "Cancel");
                    return 1;
                }
                else
                {
                    new slot[24];
                    format(slot, sizeof(slot), "Empty");
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner5] = slot;
                    SaveGateStats(GetPlayerLastGateID{playerid});
                    SendClientMessage(playerid, YELLOW, "You have successfully emptied gate key slot (5)");
                    return 1;
                }
            }
            case 5:
            {
                if(strcmp("Empty", GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner6], false) == 0)
                {
                    ShowPlayerDialog(playerid, GATE_KEY_6_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Gate Panel - Gate Name", "{FFFFFF}Please enter the name of the player you want to give keys to:", "Set", "Cancel");
                    return 1;
                }
                else
                {
                    new slot[24];
                    format(slot, sizeof(slot), "Empty");
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner6] = slot;
                    SaveGateStats(GetPlayerLastGateID{playerid});
                    SendClientMessage(playerid, YELLOW, "You have successfully emptied gate key slot (6)");
                    return 1;
                }
            }
            case 6:
            {
                if(strcmp("Empty", GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner7], false) == 0)
                {
                    ShowPlayerDialog(playerid, GATE_KEY_7_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Gate Panel - Gate Name", "{FFFFFF}Please enter the name of the player you want to give keys to:", "Set", "Cancel");
                    return 1;
                }
                else
                {
                    new slot[24];
                    format(slot, sizeof(slot), "Empty");
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner7] = slot;
                    SaveGateStats(GetPlayerLastGateID{playerid});
                    SendClientMessage(playerid, YELLOW, "You have successfully emptied gate key slot (7)");
                    return 1;
                }
            }
            case 7:
            {
                if(strcmp("Empty", GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner8], false) == 0)
                {
                    ShowPlayerDialog(playerid, GATE_KEY_8_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Gate Panel - Gate Name", "{FFFFFF}Please enter the name of the player you want to give keys to:", "Set", "Cancel");
                    return 1;
                }
                else
                {
                    new slot[24];
                    format(slot, sizeof(slot), "Empty");
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner8] = slot;
                    SaveGateStats(GetPlayerLastGateID{playerid});
                    SendClientMessage(playerid, YELLOW, "You have successfully emptied gate key slot (8)");
                    return 1;
                }
            }
            case 8:
            {
                if(strcmp("Empty", GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner9], false) == 0)
                {
                    ShowPlayerDialog(playerid, GATE_KEY_9_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Gate Panel - Gate Name", "{FFFFFF}Please enter the name of the player you want to give keys to:", "Set", "Cancel");
                    return 1;
                }
                else
                {
                    new slot[24];
                    format(slot, sizeof(slot), "Empty");
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner9] = slot;
                    SaveGateStats(GetPlayerLastGateID{playerid});
                    SendClientMessage(playerid, YELLOW, "You have successfully emptied gate key slot (9)");
                    return 1;
                }
            }
            case 9:
            {
                if(strcmp("Empty", GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner10], false) == 0)
                {
                    ShowPlayerDialog(playerid, GATE_KEY_10_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Gate Panel - Gate Name", "{FFFFFF}Please enter the name of the player you want to give keys to:", "Set", "Cancel");
                    return 1;
                }
                else
                {
                    new slot[24];
                    format(slot, sizeof(slot), "Empty");
                    GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner10] = slot;
                    SaveGateStats(GetPlayerLastGateID{playerid});
                    SendClientMessage(playerid, YELLOW, "You have successfully emptied gate key slot (10)");
                    return 1;
                }
            }
        }
        return 1;
    }
    if(dialogid == GATE_KEY_1_DIALOG)
    {
        if(response)
        if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You failed to input a name.");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 50) return SendClientMessage(playerid, RED, "The player name can only contain 3-50 charactors.");
        //new ufile[40];
        //format(ufile, sizeof(ufile), USER_FILE, inputtext);
        //if(!fexist(ufile)) return SendClientMessage(playerid, RED, "That username does not exist in the NV user database.");
        new update[24], string[128];
        format(update, sizeof(update), "%s", inputtext);
        GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner1] = update;
        format(string, sizeof(string), "You have given %s a set of gate keys, re-click the slot to remove the keys.", inputtext);
        SendClientMessage(playerid, YELLOW, string);
        if(IsPlayerConnected(GetID(inputtext)))
        {
            format(string, sizeof(string), "%s [%d] has just given you a set of keys to their personal gate.", GetName(playerid), playerid);
            SendClientMessage(GetID(inputtext), LIGHTGREEN, string);
        }
        SaveGateStats(GetPlayerLastGateID{playerid});
        return 1;
    }
    if(dialogid == GATE_KEY_2_DIALOG)
    {
        if(response)
        if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You failed to input a name.");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 50) return SendClientMessage(playerid, RED, "The player name can only contain 3-50 charactors.");
        //new ufile[40];
        //format(ufile, sizeof(ufile), USER_FILE, inputtext);
        //if(!fexist(ufile)) return SendClientMessage(playerid, RED, "That username does not exist in the NV user database.");
        new update[24], string[128];
        format(update, sizeof(update), "%s", inputtext);
        GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner2] = update;
        format(string, sizeof(string), "You have given %s a set of gate keys, re-click the slot to remove the keys.", inputtext);
        SendClientMessage(playerid, YELLOW, string);
        if(IsPlayerConnected(GetID(inputtext)))
        {
            format(string, sizeof(string), "%s [%d] has just given you a set of keys to their personal gate.", GetName(playerid), playerid);
            SendClientMessage(GetID(inputtext), LIGHTGREEN, string);
        }
        SaveGateStats(GetPlayerLastGateID{playerid});
        return 1;
    }
    if(dialogid == GATE_KEY_3_DIALOG)
    {
        if(response)
        if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You failed to input a name.");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 50) return SendClientMessage(playerid, RED, "The player name can only contain 3-50 charactors.");
        //new ufile[40];
        //format(ufile, sizeof(ufile), USER_FILE, inputtext);
        //if(!fexist(ufile)) return SendClientMessage(playerid, RED, "That username does not exist in the NV user database.");
        new update[24], string[128];
        format(update, sizeof(update), "%s", inputtext);
        GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner3] = update;
        format(string, sizeof(string), "You have given %s a set of gate keys, re-click the slot to remove the keys.", inputtext);
        SendClientMessage(playerid, YELLOW, string);
        if(IsPlayerConnected(GetID(inputtext)))
        {
            format(string, sizeof(string), "%s [%d] has just given you a set of keys to their personal gate.", GetName(playerid), playerid);
            SendClientMessage(GetID(inputtext), LIGHTGREEN, string);
        }
        SaveGateStats(GetPlayerLastGateID{playerid});
        return 1;
    }
    if(dialogid == GATE_KEY_4_DIALOG)
    {
        if(response)
        if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You failed to input a name.");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 50) return SendClientMessage(playerid, RED, "The player name can only contain 3-50 charactors.");
        //new ufile[40];
        //format(ufile, sizeof(ufile), USER_FILE, inputtext);
        //if(!fexist(ufile)) return SendClientMessage(playerid, RED, "That username does not exist in the NV user database.");
        new update[24], string[128];
        format(update, sizeof(update), "%s", inputtext);
        GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner4] = update;
        format(string, sizeof(string), "You have given %s a set of gate keys, re-click the slot to remove the keys.", inputtext);
        SendClientMessage(playerid, YELLOW, string);
        if(IsPlayerConnected(GetID(inputtext)))
        {
            format(string, sizeof(string), "%s [%d] has just given you a set of keys to their personal gate.", GetName(playerid), playerid);
            SendClientMessage(GetID(inputtext), LIGHTGREEN, string);
        }
        SaveGateStats(GetPlayerLastGateID{playerid});
        return 1;
    }
    if(dialogid == GATE_KEY_5_DIALOG)
    {
        if(response)
        if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You failed to input a name.");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 50) return SendClientMessage(playerid, RED, "The player name can only contain 3-50 charactors.");
        //new ufile[40];
        //format(ufile, sizeof(ufile), USER_FILE, inputtext);
        //if(!fexist(ufile)) return SendClientMessage(playerid, RED, "That username does not exist in the NV user database.");
        new update[24], string[128];
        format(update, sizeof(update), "%s", inputtext);
        GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner5] = update;
        format(string, sizeof(string), "You have given %s a set of gate keys, re-click the slot to remove the keys.", inputtext);
        SendClientMessage(playerid, YELLOW, string);
        if(IsPlayerConnected(GetID(inputtext)))
        {
            format(string, sizeof(string), "%s [%d] has just given you a set of keys to their personal gate.", GetName(playerid), playerid);
            SendClientMessage(GetID(inputtext), LIGHTGREEN, string);
        }
        SaveGateStats(GetPlayerLastGateID{playerid});
        return 1;
    }
    if(dialogid == GATE_KEY_6_DIALOG)
    {
        if(response)
        if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You failed to input a name.");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 50) return SendClientMessage(playerid, RED, "The player name can only contain 3-50 charactors.");
        //new ufile[40];
        //format(ufile, sizeof(ufile), USER_FILE, inputtext);
        //if(!fexist(ufile)) return SendClientMessage(playerid, RED, "That username does not exist in the NV user database.");
        new update[24], string[128];
        format(update, sizeof(update), "%s", inputtext);
        GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner6] = update;
        format(string, sizeof(string), "You have given %s a set of gate keys, re-click the slot to remove the keys.", inputtext);
        SendClientMessage(playerid, YELLOW, string);
        if(IsPlayerConnected(GetID(inputtext)))
        {
            format(string, sizeof(string), "%s [%d] has just given you a set of keys to their personal gate.", GetName(playerid), playerid);
            SendClientMessage(GetID(inputtext), LIGHTGREEN, string);
        }
        SaveGateStats(GetPlayerLastGateID{playerid});
        return 1;
    }
    if(dialogid == GATE_KEY_7_DIALOG)
    {
        if(response)
        if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You failed to input a name.");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 50) return SendClientMessage(playerid, RED, "The player name can only contain 3-50 charactors.");
        //new ufile[40];
        //format(ufile, sizeof(ufile), USER_FILE, inputtext);
        //if(!fexist(ufile)) return SendClientMessage(playerid, RED, "That username does not exist in the NV user database.");
        new update[24], string[128];
        format(update, sizeof(update), "%s", inputtext);
        GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner7] = update;
        format(string, sizeof(string), "You have given %s a set of gate keys, re-click the slot to remove the keys.", inputtext);
        SendClientMessage(playerid, YELLOW, string);
        if(IsPlayerConnected(GetID(inputtext)))
        {
            format(string, sizeof(string), "%s [%d] has just given you a set of keys to their personal gate.", GetName(playerid), playerid);
            SendClientMessage(GetID(inputtext), LIGHTGREEN, string);
        }
        SaveGateStats(GetPlayerLastGateID{playerid});
        return 1;
    }
    if(dialogid == GATE_KEY_8_DIALOG)
    {
        if(response)
        if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You failed to input a name.");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 50) return SendClientMessage(playerid, RED, "The player name can only contain 3-50 charactors.");
        //new ufile[40];
        //format(ufile, sizeof(ufile), USER_FILE, inputtext);
        //if(!fexist(ufile)) return SendClientMessage(playerid, RED, "That username does not exist in the NV user database.");
        new update[24], string[128];
        format(update, sizeof(update), "%s", inputtext);
        GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner8] = update;
        format(string, sizeof(string), "You have given %s a set of gate keys, re-click the slot to remove the keys.", inputtext);
        SendClientMessage(playerid, YELLOW, string);
        if(IsPlayerConnected(GetID(inputtext)))
        {
            format(string, sizeof(string), "%s [%d] has just given you a set of keys to their personal gate.", GetName(playerid), playerid);
            SendClientMessage(GetID(inputtext), LIGHTGREEN, string);
        }
        SaveGateStats(GetPlayerLastGateID{playerid});
        return 1;
    }
    if(dialogid == GATE_KEY_9_DIALOG)
    {
        if(response)
        if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You failed to input a name.");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 50) return SendClientMessage(playerid, RED, "The player name can only contain 3-50 charactors.");
        //new ufile[40];
        //format(ufile, sizeof(ufile), USER_FILE, inputtext);
        //if(!fexist(ufile)) return SendClientMessage(playerid, RED, "That username does not exist in the NV user database.");
        new update[24], string[128];
        format(update, sizeof(update), "%s", inputtext);
        GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner9] = update;
        format(string, sizeof(string), "You have given %s a set of gate keys, re-click the slot to remove the keys.", inputtext);
        SendClientMessage(playerid, YELLOW, string);
        if(IsPlayerConnected(GetID(inputtext)))
        {
            format(string, sizeof(string), "%s [%d] has just given you a set of keys to their personal gate.", GetName(playerid), playerid);
            SendClientMessage(GetID(inputtext), LIGHTGREEN, string);
        }
        SaveGateStats(GetPlayerLastGateID{playerid});
        return 1;
    }
    if(dialogid == GATE_KEY_10_DIALOG)
    {
        if(response)
        if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You failed to input a name.");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 50) return SendClientMessage(playerid, RED, "The player name can only contain 3-50 charactors.");
        //new ufile[40];
        //format(ufile, sizeof(ufile), USER_FILE, inputtext);
        //if(!fexist(ufile)) return SendClientMessage(playerid, RED, "That username does not exist in the NV user database.");
        new update[24], string[128];
        format(update, sizeof(update), "%s", inputtext);
        GateInfo[GetPlayerLastGateID{playerid}][gKeyOwner10] = update;
        format(string, sizeof(string), "You have given %s a set of gate keys, re-click the slot to remove the keys.", inputtext);
        SendClientMessage(playerid, YELLOW, string);
        if(IsPlayerConnected(GetID(inputtext)))
        {
            format(string, sizeof(string), "%s [%d] has just given you a set of keys to their personal gate.", GetName(playerid), playerid);
            SendClientMessage(GetID(inputtext), LIGHTGREEN, string);
        }
        SaveGateStats(GetPlayerLastGateID{playerid});
        return 1;
    }
    if(dialogid == GATE_NAME_DIALOG)
    {
        if(response)
        if(strfind(inputtext, "%", true) != -1 || strfind(inputtext, "~", true) != -1) return SendClientMessage(playerid, RED, "Your gate name can't contain some symbols.");
        if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You must input a new name to change your current gate name.");
        if(strlen(inputtext) < 1 || strlen(inputtext) > 50) return SendClientMessage(playerid, RED, "Your gate name can only contain 1-50 characters.");
        new text[50], string[128];
        format(text, sizeof(text), "%s", inputtext);
        GateInfo[GetPlayerLastGateID{playerid}][gName] = text;
        format(string, sizeof(string), "You have successfully changed your gate name to %s", text);
        SendClientMessage(playerid, WHITE, string);
        Update3DTextLabelText(gatelabel[GetPlayerLastGateID{playerid}], LIGHTGREEN, text);
        SaveGateStats(GetPlayerLastGateID{playerid});
        return 1;
    }
    return 0;
}

public LoadGate_file(gateid,name[],value[])
{
    print("LoadGate_data > start");
    INI_String("gOwner", GateInfo[gateid][gOwner], 24);
    INI_String("gName", GateInfo[gateid][gName], 50);
    INI_Int("gModelID", GateInfo[gateid][gModelID]);
    INI_Float("gDrawDist", GateInfo[gateid][gDrawDist]);
    INI_Float("gClosed_X", GateInfo[gateid][gClosed_X]);
    INI_Float("gClosed_Y", GateInfo[gateid][gClosed_Y]);
    INI_Float("gClosed_Z", GateInfo[gateid][gClosed_Z]);
    INI_Float("gClosed_RotX", GateInfo[gateid][gClosed_RotX]);
    INI_Float("gClosed_RotY", GateInfo[gateid][gClosed_RotY]);
    INI_Float("gClosed_RotZ", GateInfo[gateid][gClosed_RotZ]);
    INI_Float("gOpen_X", GateInfo[gateid][gClosed_X]);
    INI_Float("gOpen_Y", GateInfo[gateid][gClosed_Y]);
    INI_Float("gOpen_Z", GateInfo[gateid][gClosed_Z]);
    INI_Float("gOpen_RotX", GateInfo[gateid][gClosed_RotX]);
    INI_Float("gOpen_RotY", GateInfo[gateid][gClosed_RotY]);
    INI_Float("gOpen_RotZ", GateInfo[gateid][gClosed_RotZ]);
    INI_String("gKeyOwner1", GateInfo[gateid][gKeyOwner1], 24);
    INI_String("gKeyOwner2", GateInfo[gateid][gKeyOwner2], 24);
    INI_String("gKeyOwner3", GateInfo[gateid][gKeyOwner3], 24);
    INI_String("gKeyOwner4", GateInfo[gateid][gKeyOwner4], 24);
    INI_String("gKeyOwner5", GateInfo[gateid][gKeyOwner5], 24);
    INI_String("gKeyOwner6", GateInfo[gateid][gKeyOwner6], 24);
    INI_String("gKeyOwner7", GateInfo[gateid][gKeyOwner7], 24);
    INI_String("gKeyOwner8", GateInfo[gateid][gKeyOwner8], 24);
    INI_String("gKeyOwner9", GateInfo[gateid][gKeyOwner9], 24);
    INI_String("gKeyOwner10", GateInfo[gateid][gKeyOwner10], 24);
    print("LoadGate_data > finish");
    return 1;
}

CMD:creategate(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, WHITE, "SERVER: Invalid command.");
    if(IsPlayerNearExistingGate(playerid) == 1) return SendClientMessage(playerid, RED, "Your too close to an existing gate.");
    new owner, type, g = GetFreeGateSlot(), Float:x, Float:y, Float:z, slot[24], name[50];
    if(sscanf(params, "ud", owner, type)) return SendClientMessage(playerid, RED, "[USAGE]: /creategate [owner] [type]") && SendClientMessage(playerid, WHITE, "Types: 1-3");
    if(!IsPlayerConnected(owner)) return SendClientMessage(playerid, RED, "Player not found.");
    if(g == -1)
    {
        new string[128];
        format(string, sizeof(string), "The server has reached a maximum of %d gates.", MAX_GATES);
        SendClientMessage(playerid, RED, string);
        return true;
    }
    if(type == 1)
    {
        GetPlayerPos(playerid, x, y, z);
        format(slot, sizeof(slot), "Empty");
        format(name, sizeof(name), "%s's personal gate", GetName(owner));

        GateInfo[g][gOwner] = GetName(owner);
        GateInfo[g][gName] = name;
        GateInfo[g][gModelID] = GATE_TYPE_1;
        GateInfo[g][gDrawDist] = DEFAULT_GATE_DRAW_DIST;
        GateInfo[g][gClosed_X] = x + 2.0;
        GateInfo[g][gClosed_Y] = y + 2.0;
        GateInfo[g][gClosed_Z] = z;
        GateInfo[g][gClosed_RotX] = 0.0;
        GateInfo[g][gClosed_RotY] = 0.0;
        GateInfo[g][gClosed_RotZ] = 0.0;
        GateInfo[g][gOpen_X] = x + 2.0;
        GateInfo[g][gOpen_Y] = y + 2.0;
        GateInfo[g][gOpen_Z] = z - 7.0;
        GateInfo[g][gOpen_RotX] = 0.0;
        GateInfo[g][gOpen_RotY] = 0.0;
        GateInfo[g][gOpen_RotZ] = 0.0;
        GateInfo[g][gKeyOwner1] = slot;
        GateInfo[g][gKeyOwner2] = slot;
        GateInfo[g][gKeyOwner3] = slot;
        GateInfo[g][gKeyOwner4] = slot;
        GateInfo[g][gKeyOwner5] = slot;
        GateInfo[g][gKeyOwner6] = slot;
        GateInfo[g][gKeyOwner7] = slot;
        GateInfo[g][gKeyOwner8] = slot;
        GateInfo[g][gKeyOwner9] = slot;
        GateInfo[g][gKeyOwner10] = slot;

        gateobject[g] = CreateObject(GateInfo[g][gModelID], GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], GateInfo[g][gClosed_RotX], GateInfo[g][gClosed_RotY], GateInfo[g][gClosed_RotZ], GateInfo[g][gDrawDist]);
        gatelabel[g] = Create3DTextLabel(name, LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);

        new File:fcreate = fopen(GetGateFile(g), io_write);
        fclose(fcreate);

        SaveGateStats(g);

        SendClientMessage(playerid, WHITE, "Gate type (1) created.");
        return true;
    }
    else if(type == 2)
    {
        GetPlayerPos(playerid, x, y, z);
        format(slot, sizeof(slot), "Empty");
        format(name, sizeof(name), "%s's personal gate", GetName(owner));

        GateInfo[g][gOwner] = GetName(owner);
        GateInfo[g][gName] = name;
        GateInfo[g][gModelID] = GATE_TYPE_2;
        GateInfo[g][gDrawDist] = DEFAULT_GATE_DRAW_DIST;
        GateInfo[g][gClosed_X] = x + 2.0;
        GateInfo[g][gClosed_Y] = y + 2.0;
        GateInfo[g][gClosed_Z] = z;
        GateInfo[g][gClosed_RotX] = 0.0;
        GateInfo[g][gClosed_RotY] = 0.0;
        GateInfo[g][gClosed_RotZ] = 0.0;
        GateInfo[g][gOpen_X] = x + 2.0;
        GateInfo[g][gOpen_Y] = y + 2.0;
        GateInfo[g][gOpen_Z] = z - 7.0;
        GateInfo[g][gOpen_RotX] = 0.0;
        GateInfo[g][gOpen_RotY] = 0.0;
        GateInfo[g][gOpen_RotZ] = 0.0;
        GateInfo[g][gKeyOwner1] = slot;
        GateInfo[g][gKeyOwner2] = slot;
        GateInfo[g][gKeyOwner3] = slot;
        GateInfo[g][gKeyOwner4] = slot;
        GateInfo[g][gKeyOwner5] = slot;
        GateInfo[g][gKeyOwner6] = slot;
        GateInfo[g][gKeyOwner7] = slot;
        GateInfo[g][gKeyOwner8] = slot;
        GateInfo[g][gKeyOwner9] = slot;
        GateInfo[g][gKeyOwner10] = slot;

        gateobject[g] = CreateObject(GateInfo[g][gModelID], GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], GateInfo[g][gClosed_RotX], GateInfo[g][gClosed_RotY], GateInfo[g][gClosed_RotZ], GateInfo[g][gDrawDist]);
        gatelabel[g] = Create3DTextLabel(name, LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);

        new File:fcreate = fopen(GetGateFile(g), io_write);
        fclose(fcreate);

        SaveGateStats(g);

        SendClientMessage(playerid, WHITE, "Gate type (2) created.");
        return true;
    }
    else if(type == 3)
    {
        GetPlayerPos(playerid, x, y, z);
        format(slot, sizeof(slot), "Empty");
        format(name, sizeof(name), "%s's personal gate", GetName(owner));

        GateInfo[g][gOwner] = GetName(owner);
        GateInfo[g][gName] = name;
        GateInfo[g][gModelID] = GATE_TYPE_3;
        GateInfo[g][gDrawDist] = DEFAULT_GATE_DRAW_DIST;
        GateInfo[g][gClosed_X] = x + 2.0;
        GateInfo[g][gClosed_Y] = y + 2.0;
        GateInfo[g][gClosed_Z] = z;
        GateInfo[g][gClosed_RotX] = 0.0;
        GateInfo[g][gClosed_RotY] = 0.0;
        GateInfo[g][gClosed_RotZ] = 0.0;
        GateInfo[g][gOpen_X] = x + 2.0;
        GateInfo[g][gOpen_Y] = y + 2.0;
        GateInfo[g][gOpen_Z] = z - 7.0;
        GateInfo[g][gOpen_RotX] = 0.0;
        GateInfo[g][gOpen_RotY] = 0.0;
        GateInfo[g][gOpen_RotZ] = 0.0;
        GateInfo[g][gKeyOwner1] = slot;
        GateInfo[g][gKeyOwner2] = slot;
        GateInfo[g][gKeyOwner3] = slot;
        GateInfo[g][gKeyOwner4] = slot;
        GateInfo[g][gKeyOwner5] = slot;
        GateInfo[g][gKeyOwner6] = slot;
        GateInfo[g][gKeyOwner7] = slot;
        GateInfo[g][gKeyOwner8] = slot;
        GateInfo[g][gKeyOwner9] = slot;
        GateInfo[g][gKeyOwner10] = slot;

        gateobject[g] = CreateObject(GateInfo[g][gModelID], GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], GateInfo[g][gClosed_RotX], GateInfo[g][gClosed_RotY], GateInfo[g][gClosed_RotZ], GateInfo[g][gDrawDist]);
        gatelabel[g] = Create3DTextLabel(name, LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);

        new File:fcreate = fopen(GetGateFile(g), io_write);
        fclose(fcreate);

        SaveGateStats(g);

        SendClientMessage(playerid, WHITE, "Gate type (3) created.");
        return true;
    }
    else
    {
        SendClientMessage(playerid, RED, "Invalid type id.") && SendClientMessage(playerid, WHITE, "Types: 1-3");
    }
    return true;
}


CMD:deletegate(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, WHITE, "SERVER: Invalid command.");
    if(IsPlayerInRangeOfGate(playerid) == 0) return SendClientMessage(playerid, RED, "You need to be within range of a personal gate to delete it.");
    DeleteNearestGate(playerid);
    return true;
}

CMD:movegate(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, WHITE, "SERVER: Invalid command.");
    if(IsPlayerInRangeOfGate(playerid) == 0) return SendClientMessage(playerid, RED, "You need to be within range of a personal gate to move it.");
    new param[10], Float:coord, g = GetNearestGateID(playerid);
    if(sscanf(params, "s[10]f", param, coord)) return SendClientMessage(playerid, RED, "[USAGE]: /movegate [up/down/north/south/east/west] [coord]");
    if(strfind(param, "up", false) != -1)
    {
        GateInfo[g][gClosed_Z] = GateInfo[g][gClosed_Z] + coord;
        GateInfo[g][gOpen_Z] = GateInfo[g][gOpen_Z] + coord;
        Delete3DTextLabel(gatelabel[g]);
        SetObjectPos(gateobject[g], GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]);
        gatelabel[g] = Create3DTextLabel(GateInfo[g][gName], LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);
        SaveGateStats(g);
        SendClientMessage(playerid, WHITE, "Gate moved UP");
        return true;
    }
    else if(strfind(param, "down", false) != -1)
    {
        GateInfo[g][gClosed_Z] = GateInfo[g][gClosed_Z] - coord;
        GateInfo[g][gOpen_Z] = GateInfo[g][gOpen_Z] - coord;
        Delete3DTextLabel(gatelabel[g]);
        SetObjectPos(gateobject[g], GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]);
        gatelabel[g] = Create3DTextLabel(GateInfo[g][gName], LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);
        SaveGateStats(g);
        SendClientMessage(playerid, WHITE, "Gate moved DOWN");
        return true;
    }
    else if(strfind(param, "north", false) != -1)
    {
        GateInfo[g][gClosed_Y] = GateInfo[g][gClosed_Y] + coord;
        GateInfo[g][gOpen_Y] = GateInfo[g][gOpen_Y] + coord;
        Delete3DTextLabel(gatelabel[g]);
        SetObjectPos(gateobject[g], GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]);
        gatelabel[g] = Create3DTextLabel(GateInfo[g][gName], LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);
        SaveGateStats(g);
        SendClientMessage(playerid, WHITE, "Gate moved NORTH");
        return true;
    }
    else if(strfind(param, "south", false) != -1)
    {
        GateInfo[g][gClosed_Y] = GateInfo[g][gClosed_Y] - coord;
        GateInfo[g][gOpen_Y] = GateInfo[g][gOpen_Y] - coord;
        Delete3DTextLabel(gatelabel[g]);
        SetObjectPos(gateobject[g], GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]);
        gatelabel[g] = Create3DTextLabel(GateInfo[g][gName], LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);
        SaveGateStats(g);
        SendClientMessage(playerid, WHITE, "Gate moved SOUTH");
        return true;
    }
    else if(strfind(param, "east", false) != -1)
    {
        GateInfo[g][gClosed_X] = GateInfo[g][gClosed_X] + coord;
        GateInfo[g][gOpen_X] = GateInfo[g][gOpen_X] + coord;
        Delete3DTextLabel(gatelabel[g]);
        SetObjectPos(gateobject[g], GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]);
        gatelabel[g] = Create3DTextLabel(GateInfo[g][gName], LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);
        SaveGateStats(g);
        SendClientMessage(playerid, WHITE, "Gate moved EAST");
        return true;
    }
    else if(strfind(param, "west", false) != -1)
    {
        GateInfo[g][gClosed_X] = GateInfo[g][gClosed_X] - coord;
        GateInfo[g][gOpen_X] = GateInfo[g][gOpen_X] - coord;
        Delete3DTextLabel(gatelabel[g]);
        SetObjectPos(gateobject[g], GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z]);
        gatelabel[g] = Create3DTextLabel(GateInfo[g][gName], LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);
        SaveGateStats(g);
        SendClientMessage(playerid, WHITE, "Gate moved WEST");
        return true;
    }
    else
    {
        SendClientMessage(playerid, RED, "You can only move the gate up/down/north/south/east/west.");
    }
    return true;
}

CMD:rotategate(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, WHITE, "SERVER: Invalid command.");
    if(IsPlayerInRangeOfGate(playerid) == 0) return SendClientMessage(playerid, RED, "You need to be within range of a personal gate to move it.");
    new param[10], Float:coord, g = GetNearestGateID(playerid);
    if(sscanf(params, "s[10]f", param, coord)) return SendClientMessage(playerid, RED, "[USAGE]: /rotategate [x/y/z] [coord]");
    if(strfind(param, "x", false) != -1)
    {
        GateInfo[g][gClosed_RotX] = GateInfo[g][gClosed_RotX] + coord;
        GateInfo[g][gOpen_RotX] = GateInfo[g][gOpen_RotX] + coord;
        Delete3DTextLabel(gatelabel[g]);
        SetObjectRot(gateobject[g], GateInfo[g][gClosed_RotX], GateInfo[g][gClosed_RotY], GateInfo[g][gClosed_RotZ]);
        gatelabel[g] = Create3DTextLabel(GateInfo[g][gName], LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);
        SaveGateStats(g);
        SendClientMessage(playerid, WHITE, "Gates X coordinate rotated.");
        return true;
    }
    else if(strfind(param, "y", false) != -1)
    {
        GateInfo[g][gClosed_RotY] = GateInfo[g][gClosed_RotY] + coord;
        GateInfo[g][gOpen_RotY] = GateInfo[g][gOpen_RotY] + coord;
        Delete3DTextLabel(gatelabel[g]);
        SetObjectRot(gateobject[g], GateInfo[g][gClosed_RotX], GateInfo[g][gClosed_RotY], GateInfo[g][gClosed_RotZ]);
        gatelabel[g] = Create3DTextLabel(GateInfo[g][gName], LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);
        SaveGateStats(g);
        SendClientMessage(playerid, WHITE, "Gates Y coordinate rotated.");
        return true;
    }
    else if(strfind(param, "z", false) != -1)
    {
        GateInfo[g][gClosed_RotZ] = GateInfo[g][gClosed_RotZ] + coord;
        GateInfo[g][gOpen_RotZ] = GateInfo[g][gOpen_RotZ] + coord;
        Delete3DTextLabel(gatelabel[g]);
        SetObjectRot(gateobject[g], GateInfo[g][gClosed_RotX], GateInfo[g][gClosed_RotY], GateInfo[g][gClosed_RotZ]);
        gatelabel[g] = Create3DTextLabel(GateInfo[g][gName], LIGHTGREEN, GateInfo[g][gClosed_X], GateInfo[g][gClosed_Y], GateInfo[g][gClosed_Z], 30.0, 0, 1);
        SaveGateStats(g);
        SendClientMessage(playerid, WHITE, "Gates Z coordinate rotated.");
        return true;
    }
    else
    {
        SendClientMessage(playerid, RED, "You can only rotate x/y/z coordinate of the gate.");
    }
    return true;
}

CMD:gp(playerid, params[])
{
    if(IsPlayerInRangeOfGate(playerid) == 0) return SendClientMessage(playerid, RED, "You need to be within range of a personal gate to use this command.");
    new g = GetNearestGateID(playerid);
    GetPlayerLastGateID{playerid} = g;
    if(IsPlayerGateOwner(playerid) == 1)
    {
        ShowPlayerDialog(playerid, GATE_PANEL, DIALOG_STYLE_LIST, "{FFFFFF}Gate Panel", "{FFFFFF}Open Gate\nClose Gate\nGive/Take Gate Keys\nSet Gate Name", "Select", "Cancel");
        return true;
    }
    else if(IsPlayerGateKeyHolder(playerid) == 1)
    {
        ShowPlayerDialog(playerid, GATE_PANEL, DIALOG_STYLE_LIST, "{FFFFFF}Gate Panel", "{FFFFFF}Open Gate\nClose Gate", "Select", "Cancel");
        return true;
    }
    else
    {
        new string[128];
        format(string, sizeof(string), "This gate is owned by %s, you do not have access to it.", GateInfo[g][gOwner]);
        SendClientMessage(playerid, RED, string);
    }
    return true;
}

CMD:gatecmds(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, WHITE, "SERVER: Invalid command.");
    ShowPlayerDialog(playerid, GATE_CMDS_DIALOG, DIALOG_STYLE_MSGBOX ,"{FFFFFF}Admin Gate Commands","{FFFFFF}Commands: /(create/delete/move/rotate)gate", "Ok", "");
    return true;
}
Reply


Messages In This Thread
ParseFile_INI No longer working? - by clarencecuzz - 05.07.2012, 14:52
Re: ParseFile_INI No longer working? - by clarencecuzz - 05.07.2012, 14:56
Re: ParseFile_INI No longer working? - by clarencecuzz - 05.07.2012, 14:59
Re: ParseFile_INI No longer working? - by clarencecuzz - 12.07.2012, 07:40

Forum Jump:


Users browsing this thread: 1 Guest(s)