PDA

View Full Version : Keeps showing in Login screen


gotwarzone
15/04/2014, 12:47 PM
'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;
}

IceBilizard
15/04/2014, 01:08 PM
because you added


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

gotwarzone
15/04/2014, 01:09 PM
under ongamemodeinit I saw this. SetTimer("ZoneBonouses", 30000, true);

where should I place this then?

If will remove "SetTimer("ZoneBonouses", 30000, true);" then when I captured a base it will not show.

IceBilizard
15/04/2014, 01:10 PM
SetTimer("ZoneBonouses", 30000, true);

it means keep timer run and time is 30 seconds

EDIT:

try

SetTimerEx("ZoneBonouses", 30000, false, "i", playerid);

gotwarzone
15/04/2014, 01:16 PM
SetTimer("ZoneBonouses", 30000, true);

it means keep timer run and time is 30 seconds

EDIT:

try

SetTimerEx("ZoneBonouses", 30000, false, "i", playerid);


hi. it shows "undefined symbol playerid" after compiling.

IceBilizard
15/04/2014, 01:17 PM
then remove this timer and put your old one and just change true to false then check


SetTimer("ZoneBonouses", 30000, true);


to

SetTimer("ZoneBonouses", 30000, false);

iBanner
15/04/2014, 01:24 PM
then remove this timer and put your old one and just change true to false then check


SetTimer("ZoneBonouses", 30000, true);


to

SetTimer("ZoneBonouses", 30000, false);

So it will stop the timer even I captured the snake farms and there will no bonus?

gotwarzone
15/04/2014, 01:25 PM
So it will stop the timer even I captured the snake farms and there will no bonus?

I think you're right tho. false = disable?

IceBilizard
15/04/2014, 01:28 PM
wait i am trying to rewrite this code then i will give to you and try


EDIT:

now try it i hope it will works


SetTimer("ZoneBonouses", 30000, true);

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

gotwarzone
15/04/2014, 01:35 PM
wait i am trying to rewrite this code then i will give to you and try


EDIT:

now try it i hope it will works


SetTimer("ZoneBonouses", 30000, true);

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


omg! the "+10 ammu for your current weapon" is not showing anymore but the +5 health still showing.

gotwarzone
15/04/2014, 01:50 PM
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 :D

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

Konstantinos
15/04/2014, 01:56 PM
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.

// 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:

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.

gotwarzone
15/04/2014, 02:05 PM
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.

// 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:

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.

Konstantinos
15/04/2014, 02:25 PM
if a different team captured the snake or army base then timer will stop and they will not receive bonus.

That's the problem - you never kill the timer and it's being called every 30 seconds.