SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 12/02/2019, 08:24 AM   #1
SkyFlare
Big Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 108
Reputation: 20
Default MySQL Overlapping ID's

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
__________________
pawn Code:
&#127822;--
             (_)                     (_)                  (_)       \(_)/  
             <) )| I have a PEN    &#127822;( (> I have an APPLE   ~) )~   Ughh  ) )   APPLE PEN
              / \                       / \                    / \          / \
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs
SkyFlare is offline   Reply With Quote
Old 12/02/2019, 08:55 AM   #2
Kane_
Beta Tester
 
Kane_'s Avatar
 
Join Date: Sep 2012
Posts: 833
Reputation: 120
Default Re: MySQL Overlapping ID's

Why in the world are you running a query every time? Just iterate through DynamicDoors and et cetera.
__________________
Los Santos Roleplay - Development team
@ls-rp.io
Kane_ is online now   Reply With Quote
Old 12/02/2019, 09:15 AM   #3
TheToretto
Huge Clucker
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 398
Reputation: 31
Default Re: MySQL Overlapping ID's

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...
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 12/02/2019, 09:18 AM   #4
SkyFlare
Big Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 108
Reputation: 20
Default Re: MySQL Overlapping ID's

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
__________________
pawn Code:
&#127822;--
             (_)                     (_)                  (_)       \(_)/  
             <) )| I have a PEN    &#127822;( (> I have an APPLE   ~) )~   Ughh  ) )   APPLE PEN
              / \                       / \                    / \          / \
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs
SkyFlare is offline   Reply With Quote
Old 12/02/2019, 09:35 AM   #5
SkyFlare
Big Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 108
Reputation: 20
Default Re: MySQL Overlapping ID's

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;
}
__________________
pawn Code:
&#127822;--
             (_)                     (_)                  (_)       \(_)/  
             <) )| I have a PEN    &#127822;( (> I have an APPLE   ~) )~   Ughh  ) )   APPLE PEN
              / \                       / \                    / \          / \
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs
SkyFlare is offline   Reply With Quote
Old 12/02/2019, 10:49 AM   #6
TheToretto
Huge Clucker
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 398
Reputation: 31
Default Re: MySQL Overlapping ID's

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






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 12/02/2019, 12:46 PM   #7
Autorojo
Little Clucker
 
Join Date: Mar 2015
Location: Santa Fe, Argentina
Posts: 5
Reputation: 0
Default Re: MySQL Overlapping ID's

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://wiki.sa-mp.com/wiki/MySQL
Autorojo is offline   Reply With Quote
Old 12/02/2019, 05:01 PM   #8
SkyFlare
Big Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 108
Reputation: 20
Default Re: MySQL Overlapping ID's

appreciate the help guys
__________________
pawn Code:
&#127822;--
             (_)                     (_)                  (_)       \(_)/  
             <) )| I have a PEN    &#127822;( (> I have an APPLE   ~) )~   Ughh  ) )   APPLE PEN
              / \                       / \                    / \          / \
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs
SkyFlare is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Overlapping text Jowere Scripting Help 9 22/11/2016 11:36 AM
Playertextdraws overlapping textdraws Zeuto Scripting Help 3 14/08/2015 01:15 PM
Object Overlapping AphexCCFC Scripting Help 0 14/09/2013 10:52 PM
TextDraws Overlapping spd_sahil Scripting Help 6 23/01/2012 12:32 PM
Overlapping TD Kyle Help Archive 1 24/10/2010 12:29 AM


All times are GMT. The time now is 01:30 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.