SA-MP Forums Archive
Getting player with most kills - 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: Getting player with most kills (/showthread.php?tid=493084)



SOLVED - Samjoc18 - 06.02.2014

SOLVED


Re: Getting player with most kills - CuervO - 07.02.2014

Instead of storing the player kills at MostKills I would store the playerid who has them:

pawn Код:
if(RoundKills[playerid] > RoundKills[MostKills] || MostKills == INVALID_PLAYER_ID)
      MostKills = playerid;
This way you don't need a second loop the determine who was the player that has had most kills.


Make sure you're correctly resetting the variable RoundKills for every player after every round; You need to reset it at onplayerconnect / onplayerdisconnect too.

Set MostKills as INVALID_PLAYER_ID at the end of every round.


Re: Getting player with most kills - Samjoc18 - 07.02.2014

Doesnt work :\ now it doesnt say any message at all when the round ends.


Re: Getting player with most kills - CuervO - 07.02.2014

Are you setting the MostKills variable to every player in a loop or just playerid? I know it sounds silly but

"RoundKills[playerid] = 0; ( at each round)"

Makes it sound like it... unless of course the loop variables are playerid..


Re: EEE - Samjoc18 - 07.02.2014

SOLVED