MySQL Overlapping ID's
#1

Not too sure how to go about this, but I use a couple different databases with door entrance ID's that are overlapping,
my current /enter command is working, BUT my exit CMD is not, I am wondering if there is a much simpler way than this, less stress for the server....

pawn Code:
CMD:enter(playerid, params[])
{
    new rows;
    mysql_query(g_SQL, "SELECT * FROM `dynamicdoors` ORDER BY `id` ASC");
    if(cache_get_row_count(rows))
    {
        for(new r = 0; r < rows && r < MAX_DYNAMICDOORS; r++)
        {
            cache_get_value_name_int(r, "locked", DynamicDoors[r][Locked]);
            cache_get_value_name_float(r, "pos_x", DynamicDoors[r][PosX]);
            cache_get_value_name_float(r, "pos_y", DynamicDoors[r][PosY]);
            cache_get_value_name_float(r, "pos_z", DynamicDoors[r][PosZ]);

            cache_get_value_name_float(r, "int_x", DynamicDoors[r][IntX]);
            cache_get_value_name_float(r, "int_y", DynamicDoors[r][IntY]);
            cache_get_value_name_float(r, "int_z", DynamicDoors[r][IntZ]);
            cache_get_value_name_float(r, "int_a", DynamicDoors[r][IntA]);

            cache_get_value_name_int(r, "insideinteriorid", DynamicDoors[r][InsideInteriorID]);
            cache_get_value_name_int(r, "insidevwid", DynamicDoors[r][InsideVWID]);
            cache_get_value_name_int(r, "outsideinteriorid", DynamicDoors[r][OutsideInteriorID]);
            cache_get_value_name_int(r, "outsidevwid", DynamicDoors[r][OutsideVWID]);
            if(IsPlayerInRangeOfPoint(playerid, 1.0, DynamicDoors[r][PosX],DynamicDoors[r][PosY],DynamicDoors[r][PosZ]))
            {
                if(DynamicDoors[r][Locked])
                {
                    GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                    return 1;
                }
                else
                {
                    SetPlayerPos(playerid, DynamicDoors[r][IntX], DynamicDoors[r][IntY], DynamicDoors[r][IntZ]);
                    SetPlayerFacingAngle(playerid, DynamicDoors[r][IntA]);
                    SetPlayerInterior(playerid, DynamicDoors[r][InsideInteriorID]);
                    SetPlayerVirtualWorld(playerid, DynamicDoors[r][InsideVWID]);
                    SetCameraBehindPlayer(playerid);
                    return 1;
                }
            }
        }
    }
    mysql_query(g_SQL, "SELECT * FROM `dynamichouses` ORDER BY `id` ASC");
    if(cache_get_row_count(rows))
    {
        for(new r = 0; r < rows && r < MAX_DYNAMICHOUSES; r++)
        {
            cache_get_value_name_int(r, "locked", DynamicHouses[r][Locked]);
            cache_get_value_name_float(r, "pos_x", DynamicHouses[r][PosX]);
            cache_get_value_name_float(r, "pos_y", DynamicHouses[r][PosY]);
            cache_get_value_name_float(r, "pos_z", DynamicHouses[r][PosZ]);

            cache_get_value_name_float(r, "int_x", DynamicHouses[r][IntX]);
            cache_get_value_name_float(r, "int_y", DynamicHouses[r][IntY]);
            cache_get_value_name_float(r, "int_z", DynamicHouses[r][IntZ]);
            cache_get_value_name_float(r, "int_a", DynamicHouses[r][IntA]);

            cache_get_value_name_int(r, "insideinteriorid", DynamicHouses[r][InsideInteriorID]);
            cache_get_value_name_int(r, "insidevwid", DynamicHouses[r][InsideVWID]);
            cache_get_value_name_int(r, "outsideinteriorid", DynamicHouses[r][OutsideInteriorID]);
            cache_get_value_name_int(r, "outsidevwid", DynamicHouses[r][OutsideVWID]);
            if(IsPlayerInRangeOfPoint(playerid, 1.0, DynamicHouses[r][PosX], DynamicHouses[r][PosY], DynamicHouses[r][PosZ]))
            {
                if(DynamicHouses[r][Locked])
                {
                    GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                    return 1;
                }
                else
                {
                    SetPlayerPos(playerid, DynamicHouses[r][IntX], DynamicHouses[r][IntY], DynamicHouses[r][IntZ]);
                    SetPlayerFacingAngle(playerid, DynamicHouses[r][IntA]);
                    SetPlayerInterior(playerid, DynamicHouses[r][InsideInteriorID]);
                    SetPlayerVirtualWorld(playerid, DynamicHouses[r][InsideVWID]);
                    SetCameraBehindPlayer(playerid);
                    return 1;
                }
            }
        }
    }
    mysql_query(g_SQL, "SELECT * FROM `families` ORDER BY `id` ASC");
    if(cache_get_row_count(rows))
    {
        for(new r = 0; r < rows && r < MAX_FAMILIES; r++)
        {
            cache_get_value_name_int(r, "familyexists", Families[r][Exists]);
            cache_get_value_name_int(r, "id", Families[r][ID]);
            cache_get_value_name(r, "familyname", Families[r][FamilyName],72);

            cache_get_value_name_float(r, "hqx", Families[r][FamHQX]);
            cache_get_value_name_float(r, "hqy", Families[r][FamHQY]);
            cache_get_value_name_float(r, "hqz", Families[r][FamHQZ]);
            cache_get_value_name_float(r, "hqintx", Families[r][FamHQIntX]);
            cache_get_value_name_float(r, "hqinty", Families[r][FamHQIntY]);
            cache_get_value_name_float(r, "hqintz", Families[r][FamHQIntZ]);
            cache_get_value_name_float(r, "hqinta", Families[r][FamHQIntA]);
            cache_get_value_name_int(r, "hqvw", Families[r][FamHQVW]);
            cache_get_value_name_int(r, "hqintid", Families[r][FamHQIntID]);
            cache_get_value_name_int(r, "hqintvw", Families[r][FamHQIntVW]);
            cache_get_value_name_int(r, "hqintintid", Families[r][FamHQIntIntID]);
            if(IsPlayerInRangeOfPoint(playerid, 1.0, Families[r][FamHQX], Families[r][FamHQY], Families[r][FamHQZ]))
            {
                if(Player[playerid][FamilyID] != Families[r][ID])
                {
                    GameTextForPlayer(playerid, "~r~Restricted Access", 5000, 1);
                    return 1;
                }
                else if(Families[r][FamHQIntIntID] == 999)
                {
                    SendClientMessage(playerid, -1, "SERVER: This HQ is not setup correctly.");
                    return 1;
                }
                else
                {
                    SetPlayerPos(playerid, Families[r][FamHQIntX], Families[r][FamHQIntY], Families[r][FamHQIntZ]);
                    SetPlayerFacingAngle(playerid, Families[r][FamHQIntA]);
                    SetPlayerInterior(playerid, Families[r][FamHQIntIntID]);
                    SetPlayerVirtualWorld(playerid, Families[r][FamHQIntVW]);
                    SetCameraBehindPlayer(playerid);
                    return 1;
                }
            }
        }
    }
    mysql_query(g_SQL, "SELECT * FROM `factions` ORDER BY `id` ASC");
    if(cache_get_row_count(rows))
    {
        for(new r = 0; r < rows && r < MAX_FACTIONS; r++)//Finish this as Factions not Families
        {
            cache_get_value_name_int(r, "factionexists", Factions[r][Exists]);
            cache_get_value_name_int(r, "id", Factions[r][ID]);
            cache_get_value_name(r, "factionname", Factions[r][FactionName],72);

            cache_get_value_name_float(r, "hqx", Factions[r][FacHQX]);
            cache_get_value_name_float(r, "hqy", Factions[r][FacHQY]);
            cache_get_value_name_float(r, "hqz", Factions[r][FacHQZ]);
            cache_get_value_name_float(r, "hqintx", Factions[r][FacHQIntX]);
            cache_get_value_name_float(r, "hqinty", Factions[r][FacHQIntY]);
            cache_get_value_name_float(r, "hqintz", Factions[r][FacHQIntZ]);
            cache_get_value_name_float(r, "hqinta", Factions[r][FacHQIntA]);
            cache_get_value_name_int(r, "hqvw", Factions[r][FacHQVW]);
            cache_get_value_name_int(r, "hqintid", Factions[r][FacHQIntID]);
            cache_get_value_name_int(r, "hqintvw", Factions[r][FacHQIntVW]);
            cache_get_value_name_int(r, "hqintintid", Factions[r][FacHQIntIntID]);
            if(IsPlayerInRangeOfPoint(playerid, 1.0, Factions[r][FacHQX], Factions[r][FacHQY], Factions[r][FacHQZ]))
            {
                if(Player[playerid][FactionID] != Factions[r][ID])
                {
                    GameTextForPlayer(playerid, "~r~Restricted Access", 5000, 1);
                    return 1;
                }
                else if(Factions[r][FacHQIntIntID] == 999)
                {
                    SendClientMessage(playerid, -1, "SERVER: This HQ is not setup correctly.");
                    return 1;
                }
                else
                {
                    SetPlayerPos(playerid, Factions[r][FacHQIntX], Factions[r][FacHQIntY], Factions[r][FacHQIntZ]);
                    SetPlayerFacingAngle(playerid, Factions[r][FacHQIntA]);
                    SetPlayerInterior(playerid, Factions[r][FacHQIntIntID]);
                    SetPlayerVirtualWorld(playerid, Factions[r][FacHQIntVW]);
                    SetCameraBehindPlayer(playerid);
                    return 1;
                }
            }
        }
    }
    #if DEBUG_COMMANDS == true
        print("DEBUG: CMD:enter Called");
    #endif
    return 1;
}

CMD:exit(playerid, params[])
{
    new rows;
    mysql_query(g_SQL, "SELECT * FROM `dynamicdoors` ORDER BY `id` ASC");
    if(cache_get_row_count(rows))
    {
        for(new r = 0; r < rows && r < MAX_DYNAMICDOORS; r++)
        {
            cache_get_value_name_int(r, "locked", DynamicDoors[r][Locked]);
            cache_get_value_name_float(r, "pos_x", DynamicDoors[r][PosX]);
            cache_get_value_name_float(r, "pos_y", DynamicDoors[r][PosY]);
            cache_get_value_name_float(r, "pos_z", DynamicDoors[r][PosZ]);

            cache_get_value_name_float(r, "int_x", DynamicDoors[r][IntX]);
            cache_get_value_name_float(r, "int_y", DynamicDoors[r][IntY]);
            cache_get_value_name_float(r, "int_z", DynamicDoors[r][IntZ]);
            cache_get_value_name_float(r, "int_a", DynamicDoors[r][IntA]);

            cache_get_value_name_int(r, "insideinteriorid", DynamicDoors[r][InsideInteriorID]);
            cache_get_value_name_int(r, "insidevwid", DynamicDoors[r][InsideVWID]);
            cache_get_value_name_int(r, "outsideinteriorid", DynamicDoors[r][OutsideInteriorID]);
            cache_get_value_name_int(r, "outsidevwid", DynamicDoors[r][OutsideVWID]);
            if(IsPlayerInRangeOfPoint(playerid, 1.0, DynamicDoors[r][PosX],DynamicDoors[r][PosY],DynamicDoors[r][PosZ]))
            {
                if(DynamicDoors[r][Locked])
                {
                    GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                    return 1;
                }
                else
                {
                    SetPlayerPos(playerid, DynamicDoors[r][PosX], DynamicDoors[r][PosY], DynamicDoors[r][PosZ]);
                    SetPlayerFacingAngle(playerid, DynamicDoors[r][PosA]);
                    SetPlayerInterior(playerid, DynamicDoors[r][OutsideInteriorID]);
                    SetPlayerVirtualWorld(playerid, DynamicDoors[r][OutsideVWID]);
                    SetCameraBehindPlayer(playerid);
                    return 1;
                }
            }
        }
    }
    mysql_query(g_SQL, "SELECT * FROM `dynamichouses` ORDER BY `id` ASC");
    if(cache_get_row_count(rows))
    {
        for(new r = 0; r < rows && r < MAX_DYNAMICHOUSES; r++)
        {
            cache_get_value_name_int(r, "locked", DynamicHouses[r][Locked]);
            cache_get_value_name_float(r, "pos_x", DynamicHouses[r][PosX]);
            cache_get_value_name_float(r, "pos_y", DynamicHouses[r][PosY]);
            cache_get_value_name_float(r, "pos_z", DynamicHouses[r][PosZ]);

            cache_get_value_name_float(r, "int_x", DynamicHouses[r][IntX]);
            cache_get_value_name_float(r, "int_y", DynamicHouses[r][IntY]);
            cache_get_value_name_float(r, "int_z", DynamicHouses[r][IntZ]);
            cache_get_value_name_float(r, "int_a", DynamicHouses[r][IntA]);

            cache_get_value_name_int(r, "insideinteriorid", DynamicHouses[r][InsideInteriorID]);
            cache_get_value_name_int(r, "insidevwid", DynamicHouses[r][InsideVWID]);
            cache_get_value_name_int(r, "outsideinteriorid", DynamicHouses[r][OutsideInteriorID]);
            cache_get_value_name_int(r, "outsidevwid", DynamicHouses[r][OutsideVWID]);
            if(IsPlayerInRangeOfPoint(playerid, 1.0, DynamicHouses[r][PosX], DynamicHouses[r][PosY], DynamicHouses[r][PosZ]))
            {
                if(DynamicHouses[r][Locked])
                {
                    GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                    return 1;
                }
                else
                {
                    SetPlayerPos(playerid, DynamicHouses[r][PosX], DynamicHouses[r][PosY], DynamicHouses[r][PosZ]);
                    SetPlayerFacingAngle(playerid, DynamicHouses[r][PosA]);
                    SetPlayerInterior(playerid, DynamicHouses[r][OutsideInteriorID]);
                    SetPlayerVirtualWorld(playerid, DynamicHouses[r][OutsideVWID]);
                    SetCameraBehindPlayer(playerid);
                    return 1;
                }
            }
        }
    }
    mysql_query(g_SQL, "SELECT * FROM `families` ORDER BY `id` ASC");
    if(cache_get_row_count(rows))
    {
        for(new r = 0; r < rows && r < MAX_FAMILIES; r++)
        {
            cache_get_value_name_int(r, "familyexists", Families[r][Exists]);
            cache_get_value_name_int(r, "id", Families[r][ID]);
            cache_get_value_name(r, "familyname", Families[r][FamilyName],72);

            cache_get_value_name_float(r, "hqx", Families[r][FamHQX]);
            cache_get_value_name_float(r, "hqy", Families[r][FamHQY]);
            cache_get_value_name_float(r, "hqz", Families[r][FamHQZ]);
            cache_get_value_name_float(r, "hqintx", Families[r][FamHQIntX]);
            cache_get_value_name_float(r, "hqinty", Families[r][FamHQIntY]);
            cache_get_value_name_float(r, "hqintz", Families[r][FamHQIntZ]);
            cache_get_value_name_float(r, "hqinta", Families[r][FamHQIntA]);
            cache_get_value_name_int(r, "hqvw", Families[r][FamHQVW]);
            cache_get_value_name_int(r, "hqintid", Families[r][FamHQIntID]);
            cache_get_value_name_int(r, "hqintvw", Families[r][FamHQIntVW]);
            cache_get_value_name_int(r, "hqintintid", Families[r][FamHQIntIntID]);
            if(IsPlayerInRangeOfPoint(playerid, 1.0, Families[r][FamHQX], Families[r][FamHQY], Families[r][FamHQZ]))
            {
                if(Player[playerid][FamilyID] != Families[r][ID])
                {
                    GameTextForPlayer(playerid, "~r~Restricted Access", 5000, 1);
                    return 1;
                }
                else if(Families[r][FamHQIntIntID] == 999)
                {
                    SendClientMessage(playerid, -1, "SERVER: This HQ is not setup correctly.");
                    return 1;
                }
                else
                {
                    SetPlayerPos(playerid, Families[r][FamHQX], Families[r][FamHQY], Families[r][FamHQZ]);
                    SetPlayerFacingAngle(playerid, Families[r][FamHQA]);
                    SetPlayerInterior(playerid, Families[r][FamHQIntID]);
                    SetPlayerVirtualWorld(playerid, Families[r][FamHQIntVW]);
                    SetCameraBehindPlayer(playerid);
                    return 1;
                }
            }
        }
    }
    mysql_query(g_SQL, "SELECT * FROM `factions` ORDER BY `id` ASC");
    if(cache_get_row_count(rows))
    {
        for(new r = 0; r < rows && r < MAX_FACTIONS; r++)//Finish this as Factions not Families
        {
            cache_get_value_name_int(r, "factionexists", Factions[r][Exists]);
            cache_get_value_name_int(r, "id", Factions[r][ID]);
            cache_get_value_name(r, "factionname", Factions[r][FactionName],72);

            cache_get_value_name_float(r, "hqx", Factions[r][FacHQX]);
            cache_get_value_name_float(r, "hqy", Factions[r][FacHQY]);
            cache_get_value_name_float(r, "hqz", Factions[r][FacHQZ]);
            cache_get_value_name_float(r, "hqintx", Factions[r][FacHQIntX]);
            cache_get_value_name_float(r, "hqinty", Factions[r][FacHQIntY]);
            cache_get_value_name_float(r, "hqintz", Factions[r][FacHQIntZ]);
            cache_get_value_name_float(r, "hqinta", Factions[r][FacHQIntA]);
            cache_get_value_name_int(r, "hqvw", Factions[r][FacHQVW]);
            cache_get_value_name_int(r, "hqintid", Factions[r][FacHQIntID]);
            cache_get_value_name_int(r, "hqintvw", Factions[r][FacHQIntVW]);
            cache_get_value_name_int(r, "hqintintid", Factions[r][FacHQIntIntID]);
            if(IsPlayerInRangeOfPoint(playerid, 1.0, Factions[r][FacHQX], Factions[r][FacHQY], Factions[r][FacHQZ]))
            {
                if(Player[playerid][FactionID] != Factions[r][ID])
                {
                    GameTextForPlayer(playerid, "~r~Restricted Access", 5000, 1);
                    return 1;
                }
                else if(Factions[r][FacHQIntIntID] == 999)
                {
                    SendClientMessage(playerid, -1, "SERVER: This HQ is not setup correctly.");
                    return 1;
                }
                else
                {
                    SetPlayerPos(playerid, Factions[r][FacHQX], Factions[r][FacHQY], Factions[r][FacHQZ]);
                    SetPlayerFacingAngle(playerid, Factions[r][FacHQA]);
                    SetPlayerInterior(playerid, Factions[r][FacHQIntID]);
                    SetPlayerVirtualWorld(playerid, Factions[r][FacHQIntVW]);
                    SetCameraBehindPlayer(playerid);
                    return 1;
                }
            }
        }
    }
    #if DEBUG_COMMANDS == true
        print("DEBUG: CMD:exit Called");
    #endif
    return 1;
}
It's actually doing my head in just seeing this mess lol
Reply
#2

Why in the world are you running a query every time? Just iterate through DynamicDoors and et cetera.
Reply
#3

Load Doors when the Gamemode loads, assign the values to the array, then just loop through your array, and check if he's near the coordinates of the door.. No need to send queries every time a player types one of the most used commands in-game...
Reply
#4

Quote:
Originally Posted by Kane_
View Post
Why in the world are you running a query every time? Just iterate through DynamicDoors and et cetera.
I cant seem to get Iterate to work, I have tried, I just have opted to use Id's in MySQL, and this is the nasty backlash im getting now, I cant for the life of me understand y_iterate enough else id of made player vehicles system already too
Reply
#5

Quote:
Originally Posted by TheToretto
View Post
Load Doors when the Gamemode loads, assign the values to the array, then just loop through your array, and check if he's near the coordinates of the door.. No need to send queries every time a player types one of the most used commands in-game...
You mean like so?
pawn Code:
CMD:enter(playerid, params[])
{
    for(new r = 0; r < MAX_DYNAMICDOORS; r++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, DynamicDoors[r][PosX],DynamicDoors[r][PosY],DynamicDoors[r][PosZ]))
        {
            if(DynamicDoors[r][Locked])
            {
                GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                return 1;
            }
            else
            {
                SetPlayerPos(playerid, DynamicDoors[r][IntX], DynamicDoors[r][IntY], DynamicDoors[r][IntZ]);
                SetPlayerFacingAngle(playerid, DynamicDoors[r][IntA]);
                SetPlayerInterior(playerid, DynamicDoors[r][InsideInteriorID]);
                SetPlayerVirtualWorld(playerid, DynamicDoors[r][InsideVWID]);
                SetCameraBehindPlayer(playerid);
                return 1;
            }
        }
    }
    for(new r = 0; r < MAX_DYNAMICHOUSES; r++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, DynamicHouses[r][PosX], DynamicHouses[r][PosY], DynamicHouses[r][PosZ]))
        {
            if(DynamicHouses[r][Locked])
            {
                GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                return 1;
            }
            else
            {
                SetPlayerPos(playerid, DynamicHouses[r][IntX], DynamicHouses[r][IntY], DynamicHouses[r][IntZ]);
                SetPlayerFacingAngle(playerid, DynamicHouses[r][IntA]);
                SetPlayerInterior(playerid, DynamicHouses[r][InsideInteriorID]);
                SetPlayerVirtualWorld(playerid, DynamicHouses[r][InsideVWID]);
                SetCameraBehindPlayer(playerid);
                return 1;
            }
        }
    }
    for(new r = 0; r < MAX_FAMILIES; r++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, Families[r][FamHQX], Families[r][FamHQY], Families[r][FamHQZ]))
        {
            if(Player[playerid][FamilyID] != Families[r][ID])
            {
                GameTextForPlayer(playerid, "~r~Restricted Access", 5000, 1);
                return 1;
            }
            else if(Families[r][FamHQIntIntID] == 999)
            {
                SendClientMessage(playerid, -1, "SERVER: This HQ is not setup correctly.");
                return 1;
            }
            else
            {
                SetPlayerPos(playerid, Families[r][FamHQIntX], Families[r][FamHQIntY], Families[r][FamHQIntZ]);
                SetPlayerFacingAngle(playerid, Families[r][FamHQIntA]);
                SetPlayerInterior(playerid, Families[r][FamHQIntIntID]);
                SetPlayerVirtualWorld(playerid, Families[r][FamHQIntVW]);
                SetCameraBehindPlayer(playerid);
                return 1;
            }
        }
    }
    for(new r = 0; r < MAX_FACTIONS; r++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, Factions[r][FacHQX], Factions[r][FacHQY], Factions[r][FacHQZ]))
        {
            if(Player[playerid][FactionID] != Factions[r][ID])
            {
                GameTextForPlayer(playerid, "~r~Restricted Access", 5000, 1);
                return 1;
            }
            else if(Factions[r][FacHQIntIntID] == 999)
            {
                SendClientMessage(playerid, -1, "SERVER: This HQ is not setup correctly.");
                return 1;
            }
            else
            {
                SetPlayerPos(playerid, Factions[r][FacHQIntX], Factions[r][FacHQIntY], Factions[r][FacHQIntZ]);
                SetPlayerFacingAngle(playerid, Factions[r][FacHQIntA]);
                SetPlayerInterior(playerid, Factions[r][FacHQIntIntID]);
                SetPlayerVirtualWorld(playerid, Factions[r][FacHQIntVW]);
                SetCameraBehindPlayer(playerid);
                return 1;
            }
        }
    }
    #if DEBUG_COMMANDS == true
        print("DEBUG: CMD:enter Called");
    #endif
    return 1;
}

CMD:exit(playerid, params[])
{
    for(new r = 0; r < MAX_DYNAMICDOORS; r++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, DynamicDoors[r][PosX],DynamicDoors[r][PosY],DynamicDoors[r][PosZ]))
        {
            if(DynamicDoors[r][Locked])
            {
                GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                return 1;
            }
            else
            {
                SetPlayerPos(playerid, DynamicDoors[r][PosX], DynamicDoors[r][PosY], DynamicDoors[r][PosZ]);
                SetPlayerFacingAngle(playerid, DynamicDoors[r][PosA]);
                SetPlayerInterior(playerid, DynamicDoors[r][OutsideInteriorID]);
                SetPlayerVirtualWorld(playerid, DynamicDoors[r][OutsideVWID]);
                SetCameraBehindPlayer(playerid);
                return 1;
            }
        }
    }
    for(new r = 0; r < MAX_DYNAMICHOUSES; r++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, DynamicHouses[r][PosX], DynamicHouses[r][PosY], DynamicHouses[r][PosZ]))
        {
            if(DynamicHouses[r][Locked])
            {
                GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                return 1;
            }
            else
            {
                SetPlayerPos(playerid, DynamicHouses[r][PosX], DynamicHouses[r][PosY], DynamicHouses[r][PosZ]);
                SetPlayerFacingAngle(playerid, DynamicHouses[r][PosA]);
                SetPlayerInterior(playerid, DynamicHouses[r][OutsideInteriorID]);
                SetPlayerVirtualWorld(playerid, DynamicHouses[r][OutsideVWID]);
                SetCameraBehindPlayer(playerid);
                return 1;
            }
        }
    }
    for(new r = 0; r < MAX_FAMILIES; r++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, Families[r][FamHQX], Families[r][FamHQY], Families[r][FamHQZ]))
        {
            if(Player[playerid][FamilyID] != Families[r][ID])
            {
                GameTextForPlayer(playerid, "~r~Restricted Access", 5000, 1);
                return 1;
            }
            else if(Families[r][FamHQIntIntID] == 999)
            {
                SendClientMessage(playerid, -1, "SERVER: This HQ is not setup correctly.");
                return 1;
            }
            else
            {
                SetPlayerPos(playerid, Families[r][FamHQX], Families[r][FamHQY], Families[r][FamHQZ]);
                SetPlayerFacingAngle(playerid, Families[r][FamHQA]);
                SetPlayerInterior(playerid, Families[r][FamHQIntID]);
                SetPlayerVirtualWorld(playerid, Families[r][FamHQIntVW]);
                SetCameraBehindPlayer(playerid);
                return 1;
            }
        }
    }
    for(new r = 0; r < MAX_FACTIONS; r++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, Factions[r][FacHQX], Factions[r][FacHQY], Factions[r][FacHQZ]))
        {
            if(Player[playerid][FactionID] != Factions[r][ID])
            {
                GameTextForPlayer(playerid, "~r~Restricted Access", 5000, 1);
                return 1;
            }
            else if(Factions[r][FacHQIntIntID] == 999)
            {
                SendClientMessage(playerid, -1, "SERVER: This HQ is not setup correctly.");
                return 1;
            }
            else
            {
                SetPlayerPos(playerid, Factions[r][FacHQX], Factions[r][FacHQY], Factions[r][FacHQZ]);
                SetPlayerFacingAngle(playerid, Factions[r][FacHQA]);
                SetPlayerInterior(playerid, Factions[r][FacHQIntID]);
                SetPlayerVirtualWorld(playerid, Factions[r][FacHQIntVW]);
                SetCameraBehindPlayer(playerid);
                return 1;
            }
        }
    }
    #if DEBUG_COMMANDS == true
        print("DEBUG: CMD:exit Called");
    #endif
    return 1;
}
Reply
#6

Yes, don't forget the query and assigning values to the variables at the gamemode init.
Reply
#7

Btw, mysql_query (non-threaded query) will freeze your server until the query has been executed.

Try mysql_tquery or mysql_pquery (threaded query) to avoid this.

https://sampwiki.blast.hk/wiki/MySQL
Reply
#8

appreciate the help guys
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)