Ranking system? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Ranking system? (
/showthread.php?tid=68599)
Ranking system? -
harly - 11.03.2009
Well i have a
Код:
#define TEAM_COP 1
and a
if(strcmp("/cop coper", cmdtext, true, 10) == 0)
{
gTeam blah blah blah TEAM_COP
Setplayerpos Blah
Weapons Blah Blah
ect
But i dont know how to add ranks

?
And/or Storage
Re: Ranking system? -
JaYmE - 11.03.2009
At Top:
in OnPlayerCommandText() callback
pawn Код:
if ( strcmp(cmdtext, "/TopPlayer", true) == 0 ) {
new pScore;
for ( new i = 0; i < MAX_PLAYERS; i++ ) {
if ( IsPlayerConnected(i) ) {
pScore = GetPlayerScore(i);
if ( pScore > CurrentTopPlayer ) {
CurrentTopPlayer = i;
}
}
}
new Str[50],
pName[25];
GetPlayerName(CurrentTopPlayer, pName, sizeof pName);
format(Str, sizeof String, "The Top Player Is: %s", pName);
SendClientMessage(playerid, 0x00ff00ff, Str);
return 1;
}
Sorry but it is untested

but should work ?
Re: Ranking system? -
[RP]Rav - 11.03.2009
he wanted ranks, not a top list..
Harly: make a variable that stores an integer value (a number), read it to determine which rank someone has, example:
pawn Код:
if (jobRank[playerid] == 1)
// rank 1, constable
else if (jobRank[playerid] == 2)
// rank 2, inspector
etc..
Re: Ranking system? -
JaYmE - 11.03.2009
A Simple Edit:
At Top:
pawn Код:
new PlayerRank[MAX_PLAYERS];
pawn Код:
if ( strcmp(cmdtext, "/MyRank", true) == 0 ) {
new Rank[25];
for ( new i = 0; i < 2; i++ ) { // 2 being the number of ranks
if ( PlayerRank[playerid] == 1 ) {
Rank = "Commander !";
} else if ( PlayerRank[playerid] == 2 ) {
Rank = "General !";
} else {
Rank = "Nothing !";
}
}
new Str[50];
format(Str, sizeof String, "Your Rank Is: %s", Rank);
SendClientMessage(playerid, 0x00ff00ff, Str);
return 1;
}
Yet again untested
Re: Ranking system? -
Mikep - 11.03.2009
Quote:
if(strcmp("/cop coper", cmdtext, true, 10) == 0)
|
The "10" is the maxcells or whatever its called, this isn't needed unless you have parameters as you could type "/cop coppersdklavfgsdkkbgldfjh" and it still work.
Re: Ranking system? -
matt2127 - 12.03.2009
aka remove the 10