SA-MP Forums Archive
What's wrong with this code? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What's wrong with this code? (/showthread.php?tid=237358)



What's wrong with this code? - Medal Of Honor team - 09.03.2011

This code does not display the MAX SCORERS properly

pawn Код:
forward checkplayerscore();
public checkplayerscore(){
new /*strx[256],*/string[456],string2[456],tname[256],count;
for(new p;p<MAX_PLAYERS;p++){
if(IsPlayerConnected(p)){
GetPlayerName(p,"tname",sizeof(tname));
string2 = string;
//format(strx,sizeof(strx),"%s with %d Score" ,tname,GetPlayerScore(p));
if(GetPlayerScore(p) < count){ //see
format(string ,sizeof(string),"%s\n%s %d Score",string2,tname,GetPlayerScore(p));
}
else{
count = GetPlayerScore(p);
format(string ,sizeof(string),"%s %d Score\n%s", tname,GetPlayerScore(p),string2);
}
}
}
for(new p2;p2<MAX_PLAYERS;p2++){
ShowPlayerDialog(p2, 706, DIALOG_STYLE_MSGBOX, "HIGHEST SCORE", string, "OK", "ClOSE");
}
}



Re: What's wrong with this code? - Johnson_boy - 09.03.2011

I'd make something like this:

pawn Код:
new Highest = -1, HighestID;
for(new p = 0; p < MAX_PLAYERS; p ++)
{
     if(IsPlayerConnected(p))
     {
          if(GetPlayerScore(p) > Highest)
          {
               Highest = GetPlayerScore(p);
               HighestID = p;
          }
     }
}
new name[MAX_PLAYER_NAME];
GetPlayerName(Highest, name, sizeof(name));
printf("Highest score: %s(%d), %d", name, HighestID, Highest);



Re: What's wrong with this code? - Medal Of Honor team - 09.03.2011

how will i fix my one?


Re: What's wrong with this code? - Mean - 09.03.2011

What is the problem with it


Re: What's wrong with this code? - Medal Of Honor team - 09.03.2011

it does not properly appear on the Dialog. Something like this happens

erper 12312323$$$$$$

where it shud be

Reaper 12312323
Stano 12311111


Re: What's wrong with this code? - Medal Of Honor team - 10.03.2011

bump!!! I need help it's urgent