OnPlayerSpawn() doesnt be called in a FS.
#1

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;
}
Reply
#2

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

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;
}
Reply
#4

double return 1? maybe the last return should be 0?
Reply
#5

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?
Reply
#6

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

** ROFL **
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)