SA-MP Forums Archive
Hooked callback won't get called - 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: Hooked callback won't get called (/showthread.php?tid=319469)



Hooked callback won't get called - Danny - 19.02.2012

Hey, since yesterday, i'm using y_hooks for easy callback hooking. Now i've got a problem:

Code:
Hook:DM_OnGameModeInIt()
{
	print("Called");
	for(new i=0; i<MAX_ZONES; i++){dmInfo[i][ZoneID]=-1;}
	for(new i=0; i<MAX_PLAYERS; i++){pDMinfo[i][0]=-1;}
	//The creating of the DM zones
	CreateDMZone("World War 2 DM","USA","Germany",-971.3320,1020.9902,1345.0673, -1135.7421,1095.4961,1345.8173, 10, 0, 24, 25, 30);
	return 1;
}
This won't get called. (based on the missing of the 'Called' print in my samp-server.exe) Can anybody tell me why's that?

Greetz,
Danny

EDIT: I'm also getting this message after some time: 'Error: Could not connect to the YSI update server.'
Maybe these two things has something to do with eachother?


Re: Hooked callback won't get called - aRoach - 19.02.2012

pawn Code:
Hook:DM_OnScriptInit( )
{
    print("Called");
    for(new i=0; i<MAX_ZONES; i++){dmInfo[i][ZoneID]=-1;}
    for(new i=0; i<MAX_PLAYERS; i++){pDMinfo[i][0]=-1;}
    //The creating of the DM zones
    CreateDMZone("World War 2 DM","USA","Germany",-971.3320,1020.9902,1345.0673, -1135.7421,1095.4961,1345.8173, 10, 0, 24, 25, 30);
    return 1;
}
Try it..


Re: Hooked callback won't get called - Danny - 19.02.2012

I tried, buy it still doesn't work.


Re: Hooked callback won't get called - aRoach - 19.02.2012

Are you sure that you have the last Version of the YSI Library ?


Re: Hooked callback won't get called - Danny - 19.02.2012

Now I've installed YSI 3.0 RC2, but the problem stays.


Re: Hooked callback won't get called - aRoach - 19.02.2012

Is an Include or a Gamemode / Filterscript ?


Re: Hooked callback won't get called - Danny - 19.02.2012

Quote:
Originally Posted by aRoach
View Post
Is an Include or a Gamemode / Filterscript ?
It's in an include, i included it in my gamemode.


AW: Hooked callback won't get called - Tigerkiller - 19.02.2012

you have included it after samp ?
anyways delete the yhook include and use this:
pawn Code:
stock My_OnGameModeInit()
{
// My Functions
print(" i was called ");
return CallRemoteFunction("OnGameModeInit","");

#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#endif

#define My_OnGameModeInit OnGameModeInit
writen with phone so there can be errors
post it and i can help

// works ?


Re: Hooked callback won't get called - aRoach - 19.02.2012

Maybe... :
pawn Code:
public DM_OnGameModeInit( )
{
    print("Called");
    for( new slots = MAX_ZONES, i; i < slots; i++ ) dmInfo[ i ][ ZoneID ]=-1;
    for( new slots = GetMaxPlayers( ), i; i < slots; i++ ) pDMinfo[ i ][ 0 ]=-1;
    //The creating of the DM zones
    CreateDMZone("World War 2 DM","USA","Germany",-971.3320,1020.9902,1345.0673, -1135.7421,1095.4961,1345.8173, 10, 0, 24, 25, 30);
    return 1;
}
#if defined _ALS_OnGameModeInit
    #undef OnGameModeInit
#else
    #define _ALS_OnGameModeInit
#endif
#define OnGameModeInit DM_OnGameModeInit
forward DM_OnGameModeInit( );



AW: Hooked callback won't get called - Tigerkiller - 19.02.2012

yep ! i wasnt sure but Roach code works 100% i use the same way, but i use stocks instead of public