MVP plugin

MVP plugin 1.5

No permission to download

XTreme killer

Active member
RIS Admin
Content Writer
XTreme killer submitted a new resource:

MVP plugin - Most Valuable Person

This plugin shows mvp at the round of end.

Requirements :
  • Sourcemod v1.10.6239 or Higher
Code:
sm_mvp_output - Tells how to show mvp 0 - No Text and No Overlay, 1 - Only Text, 2 - Overlay and Text mix.
// Remember that after changing this variable, it will update in next start of round.
Installation :
  • Download MVP.zip file from this post...
Read more about this resource...
 
Last edited by a moderator:

Vertigo

⍥????
Staff member
Administrator
Add translations support.
 

ppibo1

New member
SM 1.11

L 01/28/2021 - 13:14:07: [SM] Exception reported: Client 4 is not connected
L 01/28/2021 - 13:14:07: [SM] Blaming: MVP.smx
L 01/28/2021 - 13:14:07: [SM] Call stack trace:
L 01/28/2021 - 13:14:07: [SM] [0] GetClientUserId
L 01/28/2021 - 13:14:07: [SM] [1] Line 60, C:\Users\Ayush\Downloads\Faltu\Project\scripting\MVP.sp::Round_start
 

Vertigo

⍥????
Staff member
Administrator
@XTreme killer

Check IsClientInGame before calling the timer with client user ID at line number 60.
 

XTreme killer

Active member
RIS Admin
Content Writer
SM 1.11

L 01/28/2021 - 13:14:07: [SM] Exception reported: Client 4 is not connected
L 01/28/2021 - 13:14:07: [SM] Blaming: MVP.smx
L 01/28/2021 - 13:14:07: [SM] Call stack trace:
L 01/28/2021 - 13:14:07: [SM] [0] GetClientUserId
L 01/28/2021 - 13:14:07: [SM] [1] Line 60, C:\Users\Ayush\Downloads\Faltu\Project\scripting\MVP.sp::Round_start
Thanks for reporting

here is the fix.
 

Vertigo

⍥????
Staff member
Administrator
Change
C++:
for(new i = 1; i < MaxClients; i++)
To
C++:
for(new i = 1; i <= MaxClients; i++)
Because it is missing 1 player. Loop should run until MaxClients.

And can you explain what you are doing here :
C++:
if(kills[i] > kills[mostkills] || kills[i] == kills[mostkills] && dmg[i] > dmg[mostkills])
{
    mostkills = i;
}
else
{
    mostknives = i;
}

// And
else if(mostknives == 0)

// And this
if(mostkills == 0)
 

XTreme killer

Active member
RIS Admin
Content Writer
Change
C++:
for(new i = 1; i < MaxClients; i++)
To
C++:
for(new i = 1; i <= MaxClients; i++)
Because it is missing 1 player. Loop should run until MaxClients.

And can you explain what you are doing here :
C++:
if(kills[i] > kills[mostkills] || kills[i] == kills[mostkills] && dmg[i] > dmg[mostkills])
{
    mostkills = i;
}
else
{
    mostknives = i;
}

// And
else if(mostknives == 0)

// And this
if(mostkills == 0)
I have fixed bugs as you said & also added translation file.
 

XTreme killer

Active member
RIS Admin
Content Writer
@Vertigo

C++:
if(kills[i] > kills[mostkills] || kills[i] == kills[mostkills] && dmg[i] > dmg[mostkills]) //Added a condition which checks who has got mostkills.
{
    mostkills = i;
}
if(knives[i] > knives[mostknives]) //Added a condition which checks who got most knife kills
{
    mostknives = i;
}
& Here

C++:
if(mostknives == 0) //Checks if there was no knife kill.
C++:
if(mostkills == 0)//Checks if there was no mostkill player.
 

XTreme killer

Active member
RIS Admin
Content Writer
@Vertigo
Condition 1 :

1. checks if (i) has kills and it is more than kills of mostkills. //mostkills is 0 (client 0 is server), so it can't have any kills. [For client 0, kills = 0]
When he finds that any player connected in server has kills more than 0, then it indexes the client having kills.
After 1st cycle, it checks again for other players whether they have more kills than the previously indexed player.

OR

2.There is a conflict between 2 players with same kills ( Then damage is taken as reference). The player with more damage is being indexed as player having most kills.

Condition 2:
The knife condition is also same as above discussed.

3rd line:

It checks if player having most knife kills is not the server itself. If it is server, it will run those commands.

4 th line:

It checks if player having most kills is not the server itself. If it is server, it will run those commands.
 

Vertigo

⍥????
Staff member
Administrator
Ok understood. You can simplify this condition
C++:
if(kills[i] > kills[mostkills] || kills[i] == kills[mostkills] && dmg[i] > dmg[mostkills])
// To
if((kills[i] >= kills[mostkills]) && (dmg[i] > dmg[mostkills]))
And in this, first 2 lines are enough.
C++:
new mostkills = 0;
new mostknives = 0;
mostkills = 0;
mostknives = 0;
I have added more comments in the source. You can check, modify and update the plugin.;)

Note: Also I would recommend to learn the new syntax of sourcepawn. Currently you are mixing both new and old syntax. It's more easier to code and understand. I am attaching the code with some improvements and new syntax here. You can update the plugin.
 

Attachments

Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock