Timers into "OnPlayerConnect" repeating too much.
#1

Hi again lol. Look at this timers, I dont know why, they repeat the texts that are on callback:

Код:
forward ConnectionText(playerid);
public ConnectionText(playerid)
{
	SendClientMessage(playerid, COLOR_LITEGREEN2, " - Welcome to servername -");
	SendClientMessage(playerid, COLOR_LITEGREEN, "Register by using /register command");
	SendClientMessage(playerid, COLOR_LITEGREEN, "Or login with /login");
	SendClientMessage(playerid, COLOR_LITEGREEN2, "-                   -");
	return 1;
}
forward DatabaseConnection(playerid);
public DatabaseConnection(playerid)
{
	SendClientMessage(playerid, COLOR_PURPLE, "Successfully connected to database");
	SendClientMessage(playerid, COLOR_PURPLE, "Connecting to game...");
	SetTimer("ConnectionText",800,1);
	return 0;
}
OnPlayerConnect:
Код:
public OnPlayerConnect(playerid)
{
	LoadAntiCheat(playerid);
	LoadTextDraws(playerid);
	LoadTimers(playerid);
	LoadMapIcons(playerid);
	SetVarsToZero(playerid);

	new pName[MAX_PLAYER_NAME];
	new string[128];
	GetPlayerName(playerid, pName, sizeof(pName));
	format(string, sizeof(string), "%s has joined the server.", pName);
	SendClientMessageToAll(COLOR_GREY, string);
	ClearScreen(playerid);
	SendClientMessage(playerid, COLOR_PURPLE, "Loading database...");
	SetTimerEx("DatabaseConnection",900,1);
  return 1;
}
So when I load the game, I receive a lot of this messages that dont stop coming:
Код:
	SendClientMessage(playerid, COLOR_LITEGREEN2, " - Welcome to servername -");
	SendClientMessage(playerid, COLOR_LITEGREEN, "Register by using /register command");
	SendClientMessage(playerid, COLOR_LITEGREEN, "Or login with /login");
	SendClientMessage(playerid, COLOR_LITEGREEN2, "-                   -");
I think it's a little thing that I forgot, like the last one...
Reply
#2

pawn Код:
SetTimerEx("DatabaseConnection",900,false, "d", playerid);
SetTimerEx("ConnectionText",800,false, "d", playerid);
https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#3

Quote:
Originally Posted by dice7
pawn Код:
SetTimerEx("DatabaseConnection",900,false, "d", playerid);
SetTimerEx("ConnectionText",800,false, "d", playerid);
https://sampwiki.blast.hk/wiki/SetTimerEx
Thanks . You all make this forum alive lol. I hope this replys will help someone else too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)