SA-MP Forums Archive
top 3 players - 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: top 3 players (/showthread.php?tid=658162)



top 3 players - severance - 25.08.2018

So I've got 4 errors in one line :

PHP код:
C:\Users\fomina.janett1919\Desktop\test\gamemodes\test.pwn(7060) : error 012invalid function callnot a valid address
C
:\Users\fomina.janett1919\Desktop\test\gamemodes\test.pwn(7060) : warning 215expression has no effect
C
:\Users\fomina.janett1919\Desktop\test\gamemodes\test.pwn(7060) : error 001expected token";"but found ")"
C:\Users\fomina.janett1919\Desktop\test\gamemodes\test.pwn(7060) : error 029invalid expressionassumed zero
C
:\Users\fomina.janett1919\Desktop\test\gamemodes\test.pwn(7060) : fatal error 107too many error messages on one line 
PHP код:
if(id1 != -&& PlayerDamage[id1] != 0){ SendClientMessageToAll(-1"*** 1st: %s with %d damage"PlayerName(id1), PlayerDamage[id1]);} 
Full script:

PHP код:
stock top3players(playerid){
new 
id1 = -1id2 = -1id3 = -1pPlayerDamage = -100string[115];
    for(new 
iMAX_PLAYERSi++) if(PlayerDamage[i] > pPlayerDamage && PlayerDamage[i] != 0id1 i;
    
pPlayerDamage = -100;
    for(new 
iMAX_PLAYERSi++) if(PlayerDamage[i] > pPlayerDamage && != id1 && PlayerDamage[i] != 0id2 i;
    
pPlayerDamage = -100;
    for(new 
iMAX_PLAYERSi++) if(PlayerDamage[i] > pPlayerDamage && != id2 && != id1 && PlayerDamage[i] != 0id3i;
    
SendClientMessageToAll(-1"{e6b3ff}*** Top 3 Players by damage");
    if(
id1 != -&& PlayerDamage[id1] != 0){ SendClientMessageToAll(-1"*** 1st: %s with %d damage"PlayerName(id1), PlayerDamage[id1]);}
    else if(
id2 != -&& PlayerDamage[id2] != 0){ SendClientMessageToAll(-1"*** 2dn: %s with %d damage"PlayerName(id1), PlayerDamage[id2]);}
    else if(
id3 != -&& PlayerDamage[id3] != 0){ SendClientMessageToAll(-1"*** 3rd: %s with %d damage"PlayerName(id1), PlayerDamage[id3]);}
    return 
1;




Re: top 3 players - NeXTGoD - 25.08.2018

Use format bro

new str[128];
format(str, sizeof str,"*** 1st: %s with %d damage", PlayerName(id1), PlayerDamage[id1]);
SendClientMessageToAll(-1, str);


Re: top 3 players - severance - 25.08.2018

code fucked up now no errors but it doesn't give the player names and damage aswell


Re: top 3 players - NeXTGoD - 25.08.2018

Check your PlayerName stock maybe its wrong it should be like this:

stock PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}