SA-MP Forums Archive
OnPlayerClick Bug? - 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)
+--- Thread: OnPlayerClick Bug? (/showthread.php?tid=598632)



OnPlayerClick Bug? - dh240473 - 15.01.2016

Hello Guys I Want This Show When I Clicked Player But It Not Working Pls Help Me
PHP код:
public ShowStatistics(playeridplayerid2)
{
    if(
playerid2 == INVALID_PLAYER_ID) return 1;
    new 
string[1000], string2[556], hms;
    
TotalGameTime(playerid2hms);
    
format(string2556"{%06x}%s[%d] Stats!\n\n", (GetPlayerColor(playerid2) >>> 8), IsPlayerName(playerid2), playerid2);
    
strcat(stringstring2);
    
strcat(string""COL_RED"");
    
format(string2556""COL_RED"Admin: "COL_YELLOW"%d\n"PInfo[playerid2][Admin]); strcat(stringstring2);
    
format(string2556""COL_RED"Online Time: "COL_YELLOW"%d:%d:%d\n"h,m,s); strcat(stringstring2);
    
format(string2556""COL_RED"VIP: "COL_YELLOW"%d\n"PInfo[playerid2][VIP]); strcat(stringstring2);
    
format(string2556""COL_RED"Score: "COL_YELLOW"%d\n"GetPlayerScore(playerid2)); strcat(stringstring2);
    
format(string2556""COL_RED"Cash: "COL_YELLOW"$%d\n"PInfo[playerid2][Money]); strcat(stringstring2);
    
format(string2556""COL_RED"Kills: "COL_YELLOW"%d\n"PInfo[playerid2][Kill]); strcat(stringstring2);
    
format(string2556""COL_RED"Deaths: "COL_YELLOW"%d\n"PInfo[playerid2][Death]); strcat(stringstring2);
    new 
Float:ratio = (float(PInfo[playerid2][Kill])/float(PInfo[playerid2][Death]));
    
format(string2556""COL_RED"[K/D]: "COL_YELLOW"%.3f\n"ratio); strcat(stringstring2);
    
format(string2556"%s[%d] Stats!"GetPlayerColor(playerid2) >>> 8IsPlayerName(playerid2),playerid2);
    return 
1;
}
public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    
ShowStatistics(playeridclickedplayerid);
     return 
1;

When I Clicked Player Nothing Happen I Put This On My Admin FS How To Fix It?


Re: OnPlayerClick Bug? - radiobizza - 15.01.2016

try to replace this code:
PHP код:
public ShowStatistics(playeridplayerid2

    if(
playerid2 == INVALID_PLAYER_ID) return 1
    new 
string[1000], string2[556], hms
    
TotalGameTime(playerid2hms); 
    
format(string2556"{%06x}%s[%d] Stats!\n\n", (GetPlayerColor(playerid2) >>> 8), IsPlayerName(playerid2), playerid2); 
    
strcat(stringstring2); 
    
strcat(string""COL_RED""); 
    
format(string2556""COL_RED"Admin: "COL_YELLOW"%d\n"PInfo[playerid2][Admin]); strcat(stringstring2); 
    
format(string2556""COL_RED"Online Time: "COL_YELLOW"%d:%d:%d\n"h,m,s); strcat(stringstring2); 
    
format(string2556""COL_RED"VIP: "COL_YELLOW"%d\n"PInfo[playerid2][VIP]); strcat(stringstring2); 
    
format(string2556""COL_RED"Score: "COL_YELLOW"%d\n"GetPlayerScore(playerid2)); strcat(stringstring2); 
    
format(string2556""COL_RED"Cash: "COL_YELLOW"$%d\n"PInfo[playerid2][Money]); strcat(stringstring2); 
    
format(string2556""COL_RED"Kills: "COL_YELLOW"%d\n"PInfo[playerid2][Kill]); strcat(stringstring2); 
    
format(string2556""COL_RED"Deaths: "COL_YELLOW"%d\n"PInfo[playerid2][Death]); strcat(stringstring2); 
    new 
Float:ratio = (float(PInfo[playerid2][Kill])/float(PInfo[playerid2][Death])); 
    
format(string2556""COL_RED"[K/D]: "COL_YELLOW"%.3f\n"ratio); strcat(stringstring2); 
    
format(string2556"%s[%d] Stats!"GetPlayerColor(playerid2) >>> 8IsPlayerName(playerid2),playerid2); 
    return 
1

with this:
PHP код:
public ShowStatistics(playeridplayerid2)
{
    if(
playerid2 == INVALID_PLAYER_ID) return 1;
    new 
string[1000], string2[556], hms;
    
TotalGameTime(playerid2hms);
    
format(string2sizeof(string2), "{%06x}%s[%d] Stats!\n\n", (GetPlayerColor(playerid2) >>> 8), IsPlayerName(playerid2), playerid2);
    
SendClientMessage(playerid0xFFFFFFAAstring2);
    
format(string2556""COL_RED"Admin: "COL_YELLOW"%d\n"PInfo[playerid2][Admin]);
    
SendClientMessage(playerid0xFFFFFFAAstring2);
    
format(string2556""COL_RED"Online Time: "COL_YELLOW"%d:%d:%d\n"h,m,s);
    
SendClientMessage(playerid0xFFFFFFAAstring2);
    
format(string2556""COL_RED"VIP: "COL_YELLOW"%d\n"PInfo[playerid2][VIP]);
    
SendClientMessage(playerid0xFFFFFFAAstring2);
    
format(string2556""COL_RED"Score: "COL_YELLOW"%d\n"GetPlayerScore(playerid2));
    
SendClientMessage(playerid0xFFFFFFAAstring2);
    
format(string2556""COL_RED"Cash: "COL_YELLOW"$%d\n"PInfo[playerid2][Money]);
    
SendClientMessage(playerid0xFFFFFFAAstring2);
    
format(string2556""COL_RED"Kills: "COL_YELLOW"%d\n"PInfo[playerid2][Kill]);
    
SendClientMessage(playerid0xFFFFFFAAstring2);
    
format(string2556""COL_RED"Deaths: "COL_YELLOW"%d\n"PInfo[playerid2][Death]);
    
SendClientMessage(playerid0xFFFFFFAAstring2);
    new 
Float:ratio = (float(PInfo[playerid2][Kill])/float(PInfo[playerid2][Death]));
    
format(string2556""COL_RED"[K/D]: "COL_YELLOW"%.3f\n"ratio);
    
SendClientMessage(playerid0xFFFFFFAAstring2);
    
format(string2556"%s[%d] Stats!"GetPlayerColor(playerid2) >>> 8IsPlayerName(playerid2),playerid2);
    
SendClientMessage(playerid0xFFFFFFAAstring2);
    return 
1;