CMD:getcash(playerid, params[])
{
new name[MAX_PLAYER_NAME+1];
new playerb, string[128];
GetPlayerName(playerb, name, sizeof(name));
if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /getcash [playerid]");
format(string, sizeof(string), " Administrator %s has given you $%d",name, GetPlayerCash(playerb));
SendClientMessage(playerb, COLOR_WHITE, string);
return 1;
}
CMD:getplayerwithhighestcash(playerid,params[])
{
new name[MAX_PLAYER_NAME],highest,chighests,scores;
for(players=0;players<=MAX_PLAYERS;players++)
{
GetPlayerCash(players,chighests);
if(chighest>score)
{
score=players;
}
GetPlayerName(score,name,sizeof(name));
format(string, sizeof(string), "Highest cash is with %s(%d)",name, GetPlayerCash(playerb));
SendClientMessage(playerb, COLOR_WHITE, string);
return 1;
}
stock ReturnRichest()
{
new
tmp,
richest = -1,
amount;
for(new i; i<MAX_PLAYERS; i++)
{
tmp = GetPlayerMoney(i);
if(tmp > amount)
richest = i;
}
return richest;
}
pawn Код:
|
for(new i; i < MAX_PLAYERS; i ++){ if(GetPlayerMoney(i) > GetPlayerMoney(i)){ new msg[128]; format(msg, sizeof(msg), "Player %s | Max money: $%d",PlayerName(i), GetPlayerMoney(i)); SendClientMessageToAll(-1, msg); }}
CMD:richest( playerid, params[ ] )
{
new
amount = 0,
Richest[ MAX_PLAYER_NAME ],
string[ 128 ]
;
for( new x = 0; x < MAX_PLAYERS; x++ )
{
if( IsPlayerConnected( x ) && x != INVALID_PLAYER_ID && !IsPlayerNPC( x ) )
{
if( GetPlayerMoney( x ) > amount )
{
amount = GetPlayerMoney( x );
GetPlayerName( x, Richest, MAX_PLAYER_NAME );
}
}
}
format( string, sizeof( string ), "The richest player is %s with $%d!", Richest, amount );
SendClientMessage( playerid, 0xFFFF00FF, string );
return 1;
}
I tried to do this in spite of the way but still I can not. you do not know what's wrong?
Код:
for(new i; i < MAX_PLAYERS; i ++){ if(GetPlayerMoney(i) > GetPlayerMoney(i)){ new msg[128]; format(msg, sizeof(msg), "Player %s | Max money: $%d",PlayerName(i), GetPlayerMoney(i)); SendClientMessageToAll(-1, msg); }} |