OnPlayerSpawn callback message duplicated or even start flood message -
Groc - 19.03.2017
So hi
I tried a lot of tricks to fix it bad nothing helped with flood message.
I use this "sendClassMessage(playerid);" onplayerspawn so this message everytime you spawn start flood or dublicated. So this function look like this.
Код:
stock sendClassMessage(playerid)
{
new string[128];
format(string,sizeof(string),""COL_YELLOW">> You have spawned as a %s, use /class to change this",GetClassName(playerid));
SendClientMessage(playerid,-1,string);
return 1;
}
So it send you class name, bat it look like this if you login
You have spawned as a Policeman, use /class to change this
You have spawned as a Civilian, use /class to change this
So idk how it get two class names. It should send just one. Jump in water is not allowed in my script so if i jump i set him back to spawn and select him to enemy team so it look like this
Код:
public OnPlayerUpdate(playerid)
{
new Float:hp;
GetPlayerHealth(playerid,hp);
if(hp <= 1.0) return SetPlayerHealth(playerid,-1.0);
if(Map[AllowWater] == 0)
{
if(IsPlayerInWater(playerid))
{
UpdateKST();
pInfo[playerid][mostkills] = 0;
pInfo[playerid][Killstreak] = 0;
EnemyTeamSetup(playerid);
SpawnPlayer(playerid);
CurePlayer(playerid);
}
}
return 1;
}
So if play jump in water he get spam about 5 message or more, with example looks like this
You have spawned as a Policeman, use /class to change this
You have spawned as a Policeman, use /class to change this
You have spawned as a Policeman, use /class to change this
You have spawned as a Policeman, use /class to change this
You have spawned as a Policeman, use /class to change this
P.S i tried put checking teams bat same shit.
Re: OnPlayerSpawn callback message duplicated or even start flood message -
Toroi - 19.03.2017
Код:
if(hp <= 1.0) return SetPlayerHealth(playerid,-1.0);
change for
Код:
if(hp <= 1.0 && hp >= 0.1) return SetPlayerHealth(playerid,-1.0);
Re: OnPlayerSpawn callback message duplicated or even start flood message -
Pokemon64 - 19.03.2017
Quote:
Originally Posted by Troydere
Код:
if(hp <= 1.0) return SetPlayerHealth(playerid,-1.0);
change for
Код:
if(hp <= 1.0 && hp >= 0.1) return SetPlayerHealth(playerid,-1.0);
|
Whats is the point changing it?
Re: OnPlayerSpawn callback message duplicated or even start flood message -
Groc - 19.03.2017
Quote:
Originally Posted by Troydere
Код:
if(hp <= 1.0) return SetPlayerHealth(playerid,-1.0);
change for
Код:
if(hp <= 1.0 && hp >= 0.1) return SetPlayerHealth(playerid,-1.0);
|
Same stuff. P.S on localhost if i jump in water it send just one message bat if i do it on hosted it send over 4 message at same time.
Re: OnPlayerSpawn callback message duplicated or even start flood message -
Toroi - 19.03.2017
PHP код:
public OnPlayerUpdate(playerid)
{
new Float:hp;
GetPlayerHealth(playerid,hp);
if(hp <= 1.0) return SetPlayerHealth(playerid,-1.0); // you check if the player has less than 1 hp, you set it to -1, then in the next OnPlayerUpdate(in about 33 milliseconds) it'll check for the same and do the same, it'll repeat until the player respawns
if(Map[AllowWater] == 0)
{
if(IsPlayerInWater(playerid))
{
UpdateKST();
pInfo[playerid][mostkills] = 0;
pInfo[playerid][Killstreak] = 0;
EnemyTeamSetup(playerid);
SpawnPlayer(playerid);
CurePlayer(playerid);
}
}
return 1;
}
Also, can I ask you why are you posting with 3 different accounts?
Re: OnPlayerSpawn callback message duplicated or even start flood message -
CXdur - 20.03.2017
I would recommend perhaps using a timer rather than onplayerupdate. Onplayerupdate is called a lot. Also a variable for whether a player is spawned or not could also be added to the if statement, but you'd have to create this yourself.
Re: OnPlayerSpawn callback message duplicated or even start flood message -
Mencent - 20.03.2017
Hello!
Quote:
So it send you class name, bat it look like this if you login
|
When you connect to a server you spawn directly, but your score isn't loaded (you don't logged in). So you need a variable to check if the player is logged in.
Re: OnPlayerSpawn callback message duplicated or even start flood message -
Groc - 21.03.2017
Quote:
Originally Posted by Mencent
Hello!
When you connect to a server you spawn directly, but your score isn't loaded (you don't logged in). So you need a variable to check if the player is logged in.
|
If you talking about IsPlayerConnected(playerid); i tried it already. Nothing change.
Re: OnPlayerSpawn callback message duplicated or even start flood message -
Groc - 13.04.2017
IsPlayerConnected dosent help its just spam message when i spawn
Код:
stock sendClassMessage(playerid)
{
if (IsPlayerConnected(playerid))
{
new string[128];
format(string,sizeof(string),""COL_YELLOW">> You have spawned as a %s, use /class to change this",GetClassName(playerid));
SendClientMessage(playerid,-1,string);
}
return 1;
}
OnPlayerSpawn
sendClassMessage(playerid);
Re: OnPlayerSpawn callback message duplicated or even start flood message -
Bolex_ - 13.04.2017
Problem is because OnPlayerUpdate(playerid) is called 30 times per seconds, any action inside OPU will be called aswell use timer instead. Create variable/array instead and check out thet any message sent isn't inside loop!