SA-MP Forums Archive
OnPlayerSpawn() doesnt be called in a FS. - 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: OnPlayerSpawn() doesnt be called in a FS. (/showthread.php?tid=602219)



OnPlayerSpawn() doesnt be called in a FS. - iLuXing - 04.03.2016

Hi, Im just written a gangzone filterscrpit and complie it correctly.
But callback OnPlayerSpawn() doesnt work when I was spwaned.
So I decide to test it with print("test");

OnPlayerSpawn() in GameMode give me a response but not in FS.

I also put SetSpawnInfo() in gamemode, and it still not work..

I will show you the code.

Код:
#include <a_samp>
#include "../includes/colors.inc"

enum E_ZONE {
	Float:MINX,
	Float:MINY,
	Float:MAXX,
	Float:MAXY,
	COLOR
}

static const zones[][E_ZONE] = {
	{151.0,	-2536.0,	861.0,	-2136.0,	COLOR_BLUE }, // "Deep Ocean"
	{1065.0,	-1392.0,	1265.0,	-1282.0,	COLOR_LIGHT_RED}, // "All saint Hospital"
	{1992.0,	-1449.0,	2057.0,	-1350.0,	COLOR_LIGHT_RED}, // "Couty(big)"
	{2056.0,	-1450.0,	2102.0,	-1390.0,	COLOR_LIGHT_RED} // "Couty(small)"
};

static zoneid[sizeof zones];

public OnFilterScriptInit() {
	for(new i; i< sizeof zones; i ++) {
		zoneid[i] = GangZoneCreate(
			zones[i][MINX],
			zones[i][MINY],
			zones[i][MAXX],
			zones[i][MAXY]
		);
	}
	printf("** [SETUP] Zones system has been setup, load %d zones.", sizeof zones);
	return 1;
}

public OnPlayerConnect(playerid) {
	return 1;
}

public OnPlayerSpawn(playerid) {
	for(new i; i< sizeof zones; i ++) {
		GangZoneShowForPlayer(playerid, zoneid[i], zones[i][COLOR]);
	}
	return 1;
}



Re: OnPlayerSpawn() doesnt be called in a FS. - iKarim - 04.03.2016

Are you pretty sure that gamemode's OnPlayerSpawn doesn't returning 0 instead of 1?


Re: OnPlayerSpawn() doesnt be called in a FS. - iLuXing - 04.03.2016

Quote:
Originally Posted by PawnHunter
Посмотреть сообщение
Are you pretty sure that gamemode's OnPlayerSpawn doesn't returning 0 instead of 1?
Yes!

Код:
public OnPlayerSpawn(playerid) {
	if(!isPlayerConnected(playerid)) {
		Kick(playerid);
		return 1;
	}
	return 1;
}



Re: OnPlayerSpawn() doesnt be called in a FS. - MicroKyrr - 04.03.2016

double return 1? maybe the last return should be 0?


Re: OnPlayerSpawn() doesnt be called in a FS. - iLuXing - 04.03.2016

Quote:
Originally Posted by MicroKyrr
Посмотреть сообщение
double return 1? maybe the last return should be 0?
two return deponds on different event and its all return 1;
why not?


Re: OnPlayerSpawn() doesnt be called in a FS. - MicroKyrr - 04.03.2016

Ok, i don't have pawno and samp nor gta here.

** ROFL **


Re: OnPlayerSpawn() doesnt be called in a FS. - Threshold - 04.03.2016

I noticed you are using static variables. Did you use #include in your Gamemode or is this a separate filterscript in your filterscripts folder?