SA-MP Forums Archive
Problem with entering - 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: Problem with entering (/showthread.php?tid=306319)



Problem with entering - Universal - 26.12.2011

FIXED it by myself. Thanks for help.


Re: Problem with entering - Calgon - 26.12.2011

You probably need to increase the size of the following defines:The problem with your code is that if a player tries to enter a house, business or entrance that has a higher ID than the define, it will just ignore it and they won't be able to enter.

For example, if you create a house and its ID is 504, but if MAX_HOUSES is 503, every house up to 503 will be checked, but anything higher will just be ignored.


Re: Problem with entering - Universal - 26.12.2011

Quote:
Originally Posted by Calgon
Посмотреть сообщение
You probably need to increase the size of the following defines:
  • MAX_HOUSES
  • MAX_BIZZ
  • MAX_ENTRANCES
The problem with your code is that if a player tries to enter a house, business or entrance that has a higher ID than the define, it will just ignore it and they won't be able to enter.

For example, if you create a house and its ID is 504, but if MAX_HOUSES is 503, every house up to 503 will be checked, but anything higher will just be ignored.
Yes, but I defined my MAX_HOUSES and others to the actual size of hosues and bizzes and others that I have in my db... And I added +1 to that define also...

EDIT: I deleted about 50 bizz'es and about 100 hosues from my db, and now its working perfectly. But it cant be that way, because I need more houses and other stuff...


Re: Problem with entering - Calgon - 26.12.2011

Try increase it to a higher amount, as your IDs might exceed the MAX_* defines, but you may have less than the define.


Re: Problem with entering - Universal - 26.12.2011

Quote:
Originally Posted by Calgon
Посмотреть сообщение
Try increase it to a higher amount, as your IDs might exceed the MAX_* defines, but you may have less than the define.
I tried that also. Instead of MAX_BIZZ, MAX_HOSUES... I created two variables: Hosues, Bizzes.
I'll give you an example:


Im loading my stuff from db this way:
pawn Код:
LoadBizzes()
{
    format(Sql, sizeof(Sql), "SELECT * FROM bizz");
   
    mysql_query(Sql);
    mysql_store_result();

    new
        id = 0;

    if(mysql_num_rows())
    {
        while(mysql_retrieve_row())
        {
            ...
Then in the back of this while loop, i do:

pawn Код:
id++;
Also, I use this "id" var, as an id of bizzes and houses I load. (bizzDB[id][owner] = blahblah)
On the end of this Load function I did:

pawn Код:
Bizzes = id;
So now it stores the actual size of bizzes. I tried to use that instead of MAX_BIZZ in the OnPlayerKeyStateChange... But nothing happened. Is there a limit or something?


Re: Problem with entering - Universal - 26.12.2011

Can someone help me? Im need of a help very much.