SA-MP Forums Archive
MySQL AI Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL AI Problem (/showthread.php?tid=658014)



MySQL AI Problem - IdonTmiss - 20.08.2018

I have a house system in MySQL, and when I create a house it loops thorught out all houses and checks the next loop

PHP код:
stock House_Next() {
       new 
number= -1;
    for(new 
1sizeof(HouseInfo); i++) {
        if(
HouseInfo[i][h_Created] == false) {
            
numberi;
            break;
        }
    }
    return 
broj;

But If i delete a house using the standard query "DELETE * FROM `houses` WHERE `sqlid` blbal" the next house will be ID: 5 ingame but ID 6 in sql can i fix that somehow or?


Re: MySQL AI Problem - KinderClans - 20.08.2018

Check the ID table in your phpmyadmin if has AUTOINCREMENT=6, probably because you added a house (+1 ID) and removed and ID hasn't been updated.


Re: MySQL AI Problem - IdonTmiss - 20.08.2018

Quote:
Originally Posted by KinderClans
Посмотреть сообщение
Check the ID table in your phpmyadmin if has AUTOINCREMENT=6, probably because you added a house (+1 ID) and removed and ID hasn't been updated.
So every time I delete a house I need to modify AI?


Re: MySQL AI Problem - CodeStyle175 - 20.08.2018

wtf are you doing?
when you are inserting house or loading them you also save houses auto increcment id.


Re: MySQL AI Problem - KinderClans - 20.08.2018

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
wtf are you doing?
when you are inserting house or loading them you also save houses auto increcment id.
Yes but if he has 5 houses (so max ID: 5), then he adds 1, becomes ID: 6, but if he remove previously created house, ID will still be 6.

I know this because i have 3 dynamic systems which uses ID as autoincrement, and i have this problem too.

@IdonTmiss no you don't need, maybe you need just when migrating database because when u export the .sql file, query will be AUTOINCREMENT = 6 (even if u have max 5 houses).


Re: MySQL AI Problem - Banditul18 - 20.08.2018

http://forum.sa-mp.com/showpost.php?...67&postcount=3
This post its actually pretty good. You dont really need to to use AI especially in a house system which gonna contain deleting