Rank system help. -
SpikY_ - 29.06.2015
Hi, I've been working on Rank system. i need some help. when a player reaches his score on which he will get ranked up; the message of ranked up getting spammed. i think it is because of the score. it remains 250 so it would spam it.
Anyone got idea, kindly post reply below.
Код:
if(GetPlayerScore(playerid) >= 250)
{
rank[ playerid ] = 1;
SendClientMessageToAll(-1, "{00FF00}New rank.");
}
================================================
Screenshot:
================================================
Respuesta: Rank system help. -
[DOG]irinel1996 - 29.06.2015
Are you using that code in OnPlayerUpdate or in any callback which is being repeated by a timer? That would explain the problem.
When does the player gain score, when he kills someone? Then you might add your level-up system to OnPlayerDeath.
Re: Rank system help. -
SpikY_ - 29.06.2015
@irinel1996, its under onplayerupdate and there is no timer for it.
and player gain score by killing.
Re: Rank system help. -
Darkwood17 - 29.06.2015
Quote:
Originally Posted by SpikY_
@irinel1996, its under onplayerupdate and there is no timer for it.
and player gain score by killing.
|
OnPlayerUpdate gets called multiple times a second, that's the reason of spam.
Re: Rank system help. -
Sawalha - 29.06.2015
i advice you to check player's rank within score check , so it would be like this
pawn Код:
if(rank[playerid] == 0 && GetPlayerScore(playerid, >= 250)
Re: Rank system help. -
kyriakos587 - 29.06.2015
if(GetPlayerScore(playerid) >= 250 && rank[playerid] == 0)
{
rank[ playerid ] = 1;
SendClientMessageToAll(-1, "{00FF00}New rank.");
}
Re: Rank system help. -
MohammedZ - 30.06.2015
Or maybe i prefer to use this in my server to avoid spamming you can increase his score by one
if(GetPlayerScore(playerid) >= 250)
{
rank[ playerid ] = 1;
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
SendClientMessageToAll(-1, "{00FF00}New rank.");
}
Re: Rank system help. -
kyriakos587 - 30.06.2015
No, is not good to give free score because of rank system.
My opinion: Test mine and after
Re: Rank system help. -
SpikY_ - 30.06.2015
i test both of the codes and i think @MohammadZ code is right cause its not spamming, what will happen if we provide just 1 Score.
it was spamming with the codes of @Sawalha.
Anyways thx to you both for helping. +rep
Re: Rank system help. -
SpikY_ - 30.06.2015
ah wait wait, When i re-try the codes of @MohammadZ, it was spamming because my score was 250+. now its spamming if i had 250+ score.