SA-MP Forums Archive
Little Help - 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: Little Help (/showthread.php?tid=571499)



Little Help - Sanady - 19.04.2015

Hello everybody, today I first time using hook from ******. But I have problem, I am hooking OnGameModeInit and when I start GM server is totally bugged, without that script in which I am using hook, server is working fine. Why when I am hooking OnGameModeInit server is bugged? I don`t understand. Can anyone explain me why is hook that doing?

CODE : http://pastebin.com/VFPeWLi5


Re: Little Help - Azula - 19.04.2015

server buged ? the gang zone mix color ?
you have failed on the min x , y max x , y


Re: Little Help - Threshold - 19.04.2015

You only have 1 gangzone, but you are trying to loop through 50 of them... causing a out of bounds error and crashing your server.

You should use 'sizeof' instead.

pawn Код:
#include <YSI\y_hooks>
//==============================================================================
//--->>> Gang Zones
//==============================================================================
enum ZoneInfo
{
    Float:minX,
    Float:minY,
    Float:maxX,
    Float:maxY
}

new GangZone[][ZoneInfo] =
{
    {96.8898,1798.6938,390.6672,2081.8325}
};


hook OnGameModeInit()
{
    CreateGangZones();
    return 1;
}

stock CreateGangZones()
{
    for(new i = 0; i < sizeof(GangZone); i++)
    {
        GangZoneCreate(GangZone[i][minX], GangZone[i][minY], GangZone[i][maxX], GangZone[i][maxY]);
    }
    return 1;
}



Re: Little Help - Ahmad45123 - 19.04.2015

Can you show the main script's OnGameModeInit ?

And also, try including y_hooks there too