Stats OnPlayerClickPlayer problem
#1

This is only returning the player's stats who is clicking it, it is supposed to return the stats of the person being clicked on, what did I do wrong? Thanks in advance.

Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
 new dstring[256];
 new Float:ratio=floatdiv(pInfo[playerid][Kills], pInfo[playerid][Deaths]);
 format(dstring, sizeof(dstring), "Name: %s | ID: %d | Score: %d | Kills: %i | Deaths: %i | KDR: %.2f | Money: %d | Adminlevel: %d | Tester: %d",GetName(playerid), playerid, pInfo[playerid][Scores], pInfo[playerid][Kills], pInfo[playerid][Deaths], ratio, GetPlayerMoney(playerid), pInfo[playerid][Adminlevel], pInfo[playerid][Testerlevel]);
 ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, "Stats", dstring, "Close", "");
 return 1;
}
Reply
#2

PHP код:
public OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    new 
Float:ratio floatdiv(pInfo[clickedplayerid][Kills], pInfo[clickedplayerid][Deaths]);
    new 
dstring[256];
    
format(dstringsizeof(dstring), "Name: %s | ID: %d | Score: %d | Kills: %i | Deaths: %i | KDR: %.2f | Money: %d | Adminlevel: %d | Tester: %d",
        
GetName(clickedplayerid), 
        
clickedplayerid
        
pInfo[clickedplayerid][Scores], 
        
pInfo[clickedplayerid][Kills], 
        
pInfo[clickedplayerid][Deaths], 
        
ratio
        
GetPlayerMoney(clickedplayerid), 
        
pInfo[clickedplayerid][Adminlevel], 
        
pInfo[clickedplayerid][Testerlevel]
    );
    
ShowPlayerDialog(playeridDIALOG_STATSDIALOG_STYLE_MSGBOX"Stats"dstring"Close""");
    return 
1;

Reply
#3

Take care not to divide by zero or you will get nasty glitches.
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
Take care not to divide by zero or you will get nasty glitches.
Won't dividing by zero crash the script?

Well, it crashes a C++ program.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)