Rank system help.
#1

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:

================================================
Reply
#2

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.
Reply
#3

@irinel1996, its under onplayerupdate and there is no timer for it.
and player gain score by killing.
Reply
#4

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.
Reply
#5

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)
Reply
#6

if(GetPlayerScore(playerid) >= 250 && rank[playerid] == 0)
{
rank[ playerid ] = 1;
SendClientMessageToAll(-1, "{00FF00}New rank.");
}
Reply
#7

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.");
}
Reply
#8

No, is not good to give free score because of rank system.

My opinion: Test mine and after
Reply
#9

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)