top 3 players
#1

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;

Reply
#2

Use format bro

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

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

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)