code to get player position.
#1

Hi all.Now i very need help to do one thing,it player position of score.I Don't know how to do this code,i try to do that format:

pawn Код:
mysql_query( "SELECT Exp FROM playerdata ORDER BY Exp" );
mysql_store_result();
But what to do next i don't know...
Reply
#2

Click here!
Reply
#3

OMG,i don't have me POS...It's like what is your position in the top like that:

pawn Код:
Your position is %d of %d with %d score.
Reply
#4

Код:
 

// Command to get the position / Score
new Float:X, Float:Y, Float:Z
GetPlayerPos(playerid,Z,Y,Z);

new string[128];
format(string, sizeof(string), "Score: %i Position %f, %f, %f")",GetPlayerScore(playerid), X, Y, Z);
SendClientMessage(playerid, 0xFFFFFFAA, string);
UNTESTED
Reply
#5

No no no.How to explane for you...ok i give examples:

pawn Код:
1.Player 5000XP
2.Player 4000XP
3.Player 2000XP
4.Player 500XP(It's me)
5.Player 250XP

Your position is 4 with 500 XP.
I think now you understand what i want to do.I want with mysql get my place by score like that table who i show.But this 1.Player 555XP i have do this,but how i say i don't know you do this?

pawn Код:
Your position is 4 with 500 XP.
Reply
#6

Код:
new rank[MAX_PLAYERS];
for(new i = 0; i < MAX_PLAYERS; i++)
{
	for(new h = 0; h < 1000; h++) // 1000 = Max Score someone could get to be the #1 on the list.
	{
	    if(GetPlayerScore(i) >= 100) rank[i] = 10;
	    if(GetPlayerScore(i) >= 200) rank[i] = 9;
	    if(GetPlayerScore(i) >= 300) rank[i] = 8;
	    if(GetPlayerScore(i) >= 400) rank[i] = 7;
	    if(GetPlayerScore(i) >= 500) rank[i] = 6;
    }
}
Something like this perhaps?
Reply
#7

no no....Why you all don't understand?first of all i need to do that wil mysql!!!second how much time I say,i want to get player place of all players by score of registered peoples.It's like "Player top".For example register 5 peoples,first player have 5000XP,second player have 4000XP,third player have 2000XP,fourth 1000XP,fiveth 500XP,then first people of this all peoples by score have place "1".Now i think you understand....
Reply
#8

Quote:
Originally Posted by budelis
Посмотреть сообщение
no no....Why you all don't understand?first of all i need to do that wil mysql!!!second how much time I say,i want to get player place of all players by score of registered peoples.It's like "Player top".For example register 5 peoples,first player have 5000XP,second player have 4000XP,third player have 2000XP,fourth 1000XP,fiveth 500XP,then first people of this all peoples by score have place "1".Now i think you understand....
Relax. Lietuviskai supranti?
Reply
#9

Look at this code:

pawn Код:
COMMAND:myplace(playerid,params[])
{
mysql_query( "SELECT * FROM `playerdata` ORDER BY `Exp`" );
mysql_store_result();
new MyPlace = mysql_fetch_int();
printf("Your Place %d: Score: %d", MyPlace, GetPlayerScore(playerid));
mysql_free_result();
return 1;
}
What here is wrong?
Reply
#10

I'am very sorry for double posts,but i very need do this.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)