In the maps/mp/gametypes/_callbacksetup.gsc call the init():
PHP Code:
CodeCallback_StartGameType()
{
// If the gametype has not beed started, run the startup
if(!isDefined(level.gametypestarted) || !level.gametypestarted)
{
[[level.callbackStartGameType]]();
level.gametypestarted = true; // so we know that the gametype has been started up
}
setcvar("scr_testclients" , 2 );
thread maps\mp\gametypes\_teams::addTestClients(); // bots for testing only
maps\mp\gametypes\_scorepopup::init(); // <-------------------------
}
Create a file in maps/mp/gametypes called _scorepopup.gsc and add IzNoGod's code (https://killtube.org/showthread.php?1208-plusscore):
PHP Code:
// See: https://killtube.org/showthread.php?1208-plusscore
init()
{
precachestring(&"");
precachestring(&"+");
game["precached_plusscore_strings"] = true;
}
OnPlayerKilled( attacker , victim , sMeansOfDeath , sHitLoc )
{
score = 10;
if( !isDefined( attacker ) || !isDefined( victim ) )
return;
else if( !isPlayer( attacker ) || !isPlayer( victim ) )
return;
else if( attacker == victim )
return;
if( isDefined( sMeansOfDeath ) && isDefined( sHitLoc ) )
{
if( sHitLoc == "head" && sMeansOfDeath != "MOD_MELEE" )
sMeansOfDeath = "MOD_HEAD_SHOT";
if( sMeansOfDeath == "MOD_HEAD_SHOT" )
score = 50;
else if( sMeansOfDeath == "MOD_MELEE" )
score = 25;
}
if( isDefined( attacker.pers[ "team" ] ) &&
isDefined( victim.pers[ "team" ] ) &&
attacker.pers[ "team" ] == victim.pers[ "team" ] &&
getcvar( "g_gametype" ) != "dm" )
{
score *= -1;
}
if( score < 0 ) score += 1;
else score -= 1;
attacker.score += score;
attacker thread plusscore( score );
}
plusscore(score)
{
if(!isdefined(game["precached_plusscore_strings"]))
{
iprintln("Plusscore strings not precached. Call init() on startgametype...");
return;
}
if(!isplayer(self))
{
iprintln("Plusscore not called on a player. Go fix this before you try anything else!");
return;
}
if(!isdefined(self.izno_plusscore)) //first run
{
self.izno_plusscore = newclienthudelem(self);
self.izno_plusscore.instance = 0;
self.izno_plusscore.score = score;
self.izno_plusscore.horzAlign = "center";
self.izno_plusscore.vertAlign = "middle";
self.izno_plusscore.alignX = "center";
self.izno_plusscore.alignY = "middle";
self.izno_plusscore.x = 0; //middle of screen
self.izno_plusscore.y = -40; //just above middle of screen
self.izno_plusscore.alpha = 0.3;
self.izno_plusscore.fontscale = 0.5;
}
else //not first-run
{
if(self.izno_plusscore.alpha < 0.3 || self.izno_plusscore.score == 0)
self.izno_plusscore.alpha = 0.3;
if(self.izno_plusscore.fontscale < 0.5 || self.izno_plusscore.score == 0)
self.izno_plusscore.fontscale = 0.5;
self.izno_plusscore.instance++;
self.izno_plusscore.score += score;
}
if(self.izno_plusscore.score < 0)
{
self.izno_plusscore.color = (235/255,10/255,10/255); //negative scores are red
self.izno_plusscore.label = &"";
}
else
{
self.izno_plusscore.color = (1,230/255,125/255); //yellow-ish
self.izno_plusscore.label = &"+";
}
self.izno_plusscore setvalue(self.izno_plusscore.score);
current_instance = self.izno_plusscore.instance;
make_bigger = true;
more_opaque = true;
steady_opaque_timer = 0;
alpha_done = false;
size_done = false;
while(isdefined(self) && current_instance == self.izno_plusscore.instance && !(alpha_done && size_done))
{
if(make_bigger && self.izno_plusscore.fontscale < 2)
self.izno_plusscore.fontscale += 0.35;
else if(make_bigger)
make_bigger = false;
else if(self.izno_plusscore.fontscale > 2)
self.izno_plusscore.fontscale -= 0.2;
else
{
size_done = true;
self.izno_plusscore.fontscale = 1.5;
}
if(more_opaque && self.izno_plusscore.alpha <= 0.9) //dont overflow this
self.izno_plusscore.alpha += 0.1;
else if(more_opaque && steady_opaque_timer == 20)
more_opaque = false;
else if(more_opaque)
steady_opaque_timer++;
else if(self.izno_plusscore.alpha >= 0.1) //dont underflow this
self.izno_plusscore.alpha -= 0.1;
else
{
alpha_done = true;
self.izno_plusscore.alpha = 0;
}
wait 0.05;
}
if(!isdefined(self))
return;
if(current_instance == self.izno_plusscore.instance)
{
wait 0.5;
if(isdefined(self) && self.izno_plusscore.instance == current_instance)
self.izno_plusscore.score = 0;
}
}
Call the scorepopup on every kill in the _callbacksetup::CallBack_OnPlayerKilled() (insert this function call as the last line):
PHP Code:
level thread maps\mp\gametypes\_scorepopup::OnPlayerKilled( eAttacker , self , sMeansOfDeath , sHitLoc );
Here is how you setup CoD2 for your own mod: https://youtu.be/9-n75APn81g or just edit the Pam mod yourself