SA-MP Forums Archive
Problem With OnGameModeInit - 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 OnGameModeInit (/showthread.php?tid=550570)



Problem With OnGameModeInit - FullCircle - 13.12.2014

When I run the server, OnGameModeInit stop working...
I have this:
pawn Код:
LoadAllVehicles();
    DeleteAllInvalidVehicles();
    LoadAllConcesionarias();
    LoadAllCasas();
    LoadAllDoors();
    LoadAllATMs();
pawn Код:
stock LoadAllDoors()
{
    new indexx = 0;
    for(new index = 1; index < MAX_CASAS; index ++)
    {
        if(fexist(DoorPath(index)))
        {
            DoorLoad(index, DoorPath(index));
            indexx++;
        }
        else
        {
            DestroyDoor(index);
        } // The for do all the loops, but in the last one, this is the final point
    }
    printf("====== DOORS CARGADAS: %d", indexx);
}
Help...
Thanks


Re: Problem With OnGameModeInit - Schneider - 13.12.2014

Try to disable each function one by one (just put // in front of it) to find out which function is causing the crash.


Re: Problem With OnGameModeInit - FullCircle - 13.12.2014

Quote:
Originally Posted by Schneider
Посмотреть сообщение
Try to disable each function one by one (just put // in front of it) to find out which function is causing the crash.
Doesn't crash, only stop loading files and everything what is under "LoadAllDoors"


Re: Problem With OnGameModeInit - Ox1gEN - 13.12.2014

I am not sure.

1. You are either flooding the start-up of the server when performing many functions at once which cause it to stop.
2. LoadAllDoors probably has a fuck-up or something like that, even though it doesn't give any errors, it still may be an issue, try commenting it and see if it'll continue doing the last one.

One suggestion which I believe will work, try setting a timer on start-up that'll wait untill the gamemode would load fully then load everything else, 5 second timer would do it I think.
You can also try to set a timer within each function to call the function that comes after it, that way you'll be less flooded and I believe will solve your issue.


Re: Problem With OnGameModeInit - FullCircle - 13.12.2014

Quote:
Originally Posted by Ox1gEN
Посмотреть сообщение
I am not sure.

1. You are either flooding the start-up of the server when performing many functions at once which cause it to stop.
2. LoadAllDoors probably has a fuck-up or something like that, even though it doesn't give any errors, it still may be an issue, try commenting it and see if it'll continue doing the last one.

One suggestion which I believe will work, try setting a timer on start-up that'll wait untill the gamemode would load fully then load everything else, 5 second timer would do it I think.
You can also try to set a timer within each function to call the function that comes after it, that way you'll be less flooded and I believe will solve your issue.
1. I removed useless functions, and still happens...
2. LoadAllDoors before works... but now not... And I don't edit it.
3. I tried the timer, but I get a lot of errors with no sense...
I thought it was YSI, but I update the plugins and includes and still happens...


Re: Problem With OnGameModeInit - PowerPC603 - 13.12.2014

Place printf statements everywhere in the code, you should be able to figure out where and why it stops working.
After each line of code, just print something to the server console.
When it suddenly stops printing, you've found the issue.


Re: Problem With OnGameModeInit - FullCircle - 13.12.2014

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
Place printf statements everywhere in the code, you should be able to figure out where and why it stops working.
After each line of code, just print something to the server console.
When it suddenly stops printing, you've found the issue.
pawn Код:
stock LoadAllDoors()
{
    new indexx = 0;
    for(new index = 1; index < MAX_CASAS; index ++)
    {
        if(fexist(DoorPath(index)))
        {
            DoorLoad(index, DoorPath(index));
            indexx++;
        }
        else
        {
            DestroyDoor(index);
        } // There stops...
    }
    printf("====== DOORS CARGADAS: %d", indexx);
}
But I don't know why...

Edit:
pawn Код:
forward DestroyDoor(doorid);
public DestroyDoor(doorid)
{ // When doorid = 50, here finish :/
    dInformacion[doorid][dEntradaX] = 0.000000;
    dInformacion[doorid][dEntradaY] = 0.000000;
    dInformacion[doorid][dEntradaZ] = 0.000000;
    dInformacion[doorid][dSalidaX] = 0.000000;
    dInformacion[doorid][dSalidaY] = 0.000000;
    dInformacion[doorid][dSalidaZ] = 0.000000;
    dInformacion[doorid][dInInterior] = 0;
    ...
}



Re: Problem With OnGameModeInit - FullCircle - 14.12.2014

Quote:
Originally Posted by FullCircle
Посмотреть сообщение
pawn Код:
stock LoadAllDoors()
{
    new indexx = 0;
    for(new index = 1; index < MAX_CASAS; index ++)
    {
        if(fexist(DoorPath(index)))
        {
            DoorLoad(index, DoorPath(index));
            indexx++;
        }
        else
        {
            DestroyDoor(index);
        } // There stops...
    }
    printf("====== DOORS CARGADAS: %d", indexx);
}
But I don't know why...

Edit:
pawn Код:
forward DestroyDoor(doorid);
public DestroyDoor(doorid)
{ // When doorid = 50, here finish :/
    dInformacion[doorid][dEntradaX] = 0.000000;
    dInformacion[doorid][dEntradaY] = 0.000000;
    dInformacion[doorid][dEntradaZ] = 0.000000;
    dInformacion[doorid][dSalidaX] = 0.000000;
    dInformacion[doorid][dSalidaY] = 0.000000;
    dInformacion[doorid][dSalidaZ] = 0.000000;
    dInformacion[doorid][dInInterior] = 0;
    ...
}
pawn Код:
stock LoadAllDoors()
{
    new indexx = 0;
    for(new index = 1; index < MAX_CASAS; index ++) // MAX_DOORS, no MAX_CASAS...
    {
        if(fexist(DoorPath(index)))
        {
            DoorLoad(index, DoorPath(index));
            indexx++;
        }
        else
        {
            DestroyDoor(index);
        } // There stops...
    }
    printf("====== DOORS CARGADAS: %d", indexx);
}
I'm Idiot lol...
Solved...