#1

Hey guys!
I have few bugs on ma server!

Ok so i have a ranking system on the GM,with 5 ranks ok so at 100 points the player should get the Newbie rank but it doesnt work for everyone,but sometimes when some players join they receive Newbie rank tho they dont have 100 score!

Ow yea and there is another bug! When the player that has a rank connects it sends the message and gives him the Money and the rank again!

Code here

pawn Код:
public score100(playerid)
{
    if(ScoreUpdate[playerid] == 0)
    {
        if(GetPlayerScore(playerid) >= 100)
        {
            SendClientMessage(playerid,lgreen,"Congratulation! You won 100k for achieving 100 points.");
      new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid,name,MAX_PLAYER_NAME);
            format(msg,sizeof(msg),"~~%s has won 10k for achieving 100 points.",name,playerid);
            SendClientMessageToAll(0xFF0000F,msg);
            GivePlayerMoney(playerid, 100000);
            ScoreUpdate[playerid] = 1;
            pRank[playerid] = 1;
            GetPlayerName(playerid,name,MAX_PLAYER_NAME);
            format(msg,sizeof(msg),"~~%s was advanced to Rank *Newbie* for achieving 100 points.",name,playerid);
            SendClientMessageToAll(green,msg);
      Attach3DTextLabelToPlayer(newbie[playerid],playerid, 0.0, 0.0, 0.7);
        }
    }
}
Reply
#2

check timer score100, check if the player wasn't replaced by another (he disconnected and another with his ID connected)
hope it will work
Reply
#3

Put this under OnGameModeInit

Код:
SetTimer("RankUpdate",4000,1);
Then anywhere in the script:
Код:
forward RankUpdate();

public RankUpdate()
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
	if(IsPlayerConnected(i))
       {

		if(GetPlayerScore(i) == 100 && pRank[i] == 0)
		{

		new msg[256]; 
		new name[MAX_PLAYER_NAME];		
		GetPlayerName(i,name,MAX_PLAYER_NAME);

		SendClientMessage(i,lgreen,"Congratulation! You won 100k for achieving 100 points.");
      		
		format(msg,sizeof(msg),"~~%s (ID:%d) has won 10k for achieving 100 points.",name,i);
		SendClientMessageToAll(0xFF0000AA,msg);
		
		GivePlayerMoney(i, 100000);
		pRank[i] = 1;

		format(msg,sizeof(msg),"~~%s (ID:%d) was advanced to Rank *Newbie* for achieving 100 points.",name,i);
		SendClientMessageToAll(green,msg);
      		Attach3DTextLabelToPlayer(newbie[i],i, 0.0, 0.0, 0.7);

		}
      }
    }

		//here you can add other ranks for scores like 200, 300 and more. Same as above.

		return 1;

	
}
And I must say, You really need to learn the basics coz your code sucked :P
Reply
#4

Alright thanks
Reply
#5

Quote:
Originally Posted by DJDhan
Put this under OnGameModeInit

Код:
SetTimer("RankUpdate",4000,1);
Then anywhere in the script:
Код:
forward RankUpdate(playerid);

public RankUpdate(playerid)
{
	

		if(GetPlayerScore(playerid) >= 100 && pRank[playerid] < 1)
		{

		new msg[256]; 
		new name[MAX_PLAYER_NAME];		
		GetPlayerName(playerid,name,MAX_PLAYER_NAME);

		SendClientMessage(playerid,lgreen,"Congratulation! You won 100k for achieving 100 points.");
      		
		format(msg,sizeof(msg),"~~%s (ID:%d) has won 10k for achieving 100 points.",name,playerid);
		SendClientMessageToAll(0xFF0000AA,msg);
		
		GivePlayerMoney(playerid, 100000);
		pRank[playerid] = 1;

		format(msg,sizeof(msg),"~~%s (ID:%d) was advanced to Rank *Newbie* for achieving 100 points.",name,playerid);
		SendClientMessageToAll(green,msg);
      		Attach3DTextLabelToPlayer(newbie[playerid],playerid, 0.0, 0.0, 0.7);

		}

		//here you can add other ranks for scores like 200, 300 and more. Same as above.

		return 1;

	
}
And I must say, You really need to learn the basics coz your code sucked :P
Maybe you shoudl learn because that aint goiung to work
Reply
#6

Quote:
Originally Posted by Joe Torran C
Maybe you shoudl learn because that aint goiung to work
And why is that?

EDIT: I edited my code.
Reply
#7

Quote:
Originally Posted by DJDhan
Quote:
Originally Posted by Joe Torran C
Maybe you shoudl learn because that aint goiung to work
And why is that?

EDIT: I edited my code.
Because using SetTimer and then adding (playerid) it will only work for ID 0
Reply
#8

OOOO XD Sry I forgot to add a for loop. :P

I am editing my post again
Reply
#9

The timer isnt good cause now it tells me each 4 seconds that i won that rank ,and when i relog it also tells me that i won that rank :S
Reply
#10

Try now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)