SA-MP Forums Archive
Keeps showing in Login screen - 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: Keeps showing in Login screen (/showthread.php?tid=506955)



Keeps showing in Login screen - gotwarzone - 15.04.2014

'This text "+ 5 Health supplie from the snake farms captured by your team and the other one" keeps showing in login screen. every 2-3 seconds.

How do I remove it from login screen? and when I spawned it's not showing again.


Код:
forward ZoneBonouses();
public ZoneBonouses()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
    	if(tCP[SNAKE] == Team[i])
    	{
			SendClientMessage(i, -1, ""COL_GREEN">> "COL_WHITE"+ 5 Health supplie from the snake farms captured by your team.");
			new Float:hp;
			GetPlayerHealth(i, hp);
			SetPlayerHealth(i, hp+5);
		}
		if(tCP[ARMY] == Team[i])
    	{
			SendClientMessage(i, -1, ""COL_GREEN">> "COL_WHITE"+ 10 Ammu for your current weapon supplie from the snake farms captured by your team.");
			switch(GetPlayerWeapon(i))
			{
			    case 16, 17, 18, 35, 36, 37, 38, 39, 42: return false;
			}
			GivePlayerWeapon(i, GetPlayerWeapon(i), 10);
		}
	}
	return 1;
}



Re: Keeps showing in Login screen - IceBilizard - 15.04.2014

because you added

pawn Код:
SendClientMessage(i, -1, ""COL_GREEN">> "COL_WHITE"+ 5 Health supplie from the snake farms captured by your team.");
in timer so if timer running and set on seconds so its showing at 2 or 3 seconds


Re: Keeps showing in Login screen - gotwarzone - 15.04.2014

under ongamemodeinit I saw this.
Quote:

SetTimer("ZoneBonouses", 30000, true);

where should I place this then?

If will remove
Quote:

"SetTimer("ZoneBonouses", 30000, true);"

then when I captured a base it will not show.


Re: Keeps showing in Login screen - IceBilizard - 15.04.2014

SetTimer("ZoneBonouses", 30000, true);

it means keep timer run and time is 30 seconds

EDIT:

try
pawn Код:
SetTimerEx("ZoneBonouses", 30000, false, "i", playerid);



Re: Keeps showing in Login screen - gotwarzone - 15.04.2014

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
SetTimer("ZoneBonouses", 30000, true);

it means keep timer run and time is 30 seconds

EDIT:

try
pawn Код:
SetTimerEx("ZoneBonouses", 30000, false, "i", playerid);
hi. it shows "undefined symbol playerid" after compiling.


Re: Keeps showing in Login screen - IceBilizard - 15.04.2014

then remove this timer and put your old one and just change true to false then check


pawn Код:
SetTimer("ZoneBonouses", 30000, true);

to

pawn Код:
SetTimer("ZoneBonouses", 30000, false);



Re: Keeps showing in Login screen - iBanner - 15.04.2014

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
then remove this timer and put your old one and just change true to false then check


pawn Код:
SetTimer("ZoneBonouses", 30000, true);

to

pawn Код:
SetTimer("ZoneBonouses", 30000, false);
So it will stop the timer even I captured the snake farms and there will no bonus?


Re: Keeps showing in Login screen - gotwarzone - 15.04.2014

LOL man. After I captured the snake farm. the +10 ammu for your current weapon didn't show anymore, but the +5 health supplie shows.


a little bit fail

EDIT: Nvm i'm just going to remove the bonus


Re: Keeps showing in Login screen - Konstantinos - 15.04.2014

Using return will stop the loop and the second message will not be sent.

The timer will be called every 30 seconds and the messages will be sent. If you want to prevent from being displayed when you're spawned, the use a variable to check it.
pawn Код:
// global:
new bool: Player_Spawned[MAX_PLAYERS char];

// OnPlayerConnect:
Player_Spawned{playerid} = false;

// OnPlayerSpawn:
Player_Spawned{playerid} = true;

// OnPlayerDeath:
Player_Spawned{playerid} = false;
and in the loop:
pawn Код:
if (Player_Spawned{i}) continue; // If the player is spawned, skip and don't send the message
You may need to check if the player is not in spectating mode.


Re: Keeps showing in Login screen - gotwarzone - 15.04.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Using return will stop the loop and the second message will not be sent.

The timer will be called every 30 seconds and the messages will be sent. If you want to prevent from being displayed when you're spawned, the use a variable to check it.
pawn Код:
// global:
new bool: Player_Spawned[MAX_PLAYERS char];

// OnPlayerConnect:
Player_Spawned{playerid} = false;

// OnPlayerSpawn:
Player_Spawned{playerid} = true;

// OnPlayerDeath:
Player_Spawned{playerid} = false;
and in the loop:
pawn Код:
if (Player_Spawned{i}) continue; // If the player is spawned, skip and don't send the message
You may need to check if the player is not in spectating mode.
what you mean in the loop? where?
Код:
forward ZoneBonouses();
public ZoneBonouses()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
    	if(tCP[SNAKE] == Team[i])
    	{
			SendClientMessage(i, -1, ""COL_GREEN">> "COL_WHITE"+ 5 Health supplie from the snake farms captured by your team.");
			new Float:hp;
			GetPlayerHealth(i, hp);
			SetPlayerHealth(i, hp+5);
		}
		if(tCP[ARMY] == Team[i])
    	{
			SendClientMessage(i, -1, ""COL_GREEN">> "COL_WHITE"+ 10 Ammu for your current weapon supplie from the snake farms captured by your team.");
			switch(GetPlayerWeapon(i))
			{
			    case 16, 17, 18, 35, 36, 37, 38, 39, 42: return false;
			}
			GivePlayerWeapon(i, GetPlayerWeapon(i), 10);
		}
	}
	return 1;
}
Basically the code above is a capture bonus. If a player captured the snake base and the army base they will receive +10 ammu or +5 (depends on which base they'd captured) then every 30 seconds they will receive the bonus. if a different team captured the snake or army base then timer will stop and they will not receive bonus.