Answered GSC Code - Get To Last Code

The Dark Side

Former Staff Member
Messages
1,004
Reaction score
770
Points
993
Anyone Have Or Know Where I Can Where I Can Get The Code That Puts At Last Or Gives You One Point
Try being a little more specific. What gamemode for one? FFA? TDM? SnD? If you wanna know look in the dumps. To get you started look for "giveteamscoreObjective" in tdm.gsc. :wink:
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
Code:
#include maps\mp\gametypes\_globallogic_score;
Code:
addScore( value )
{
    if (getdvar( "g_gametype" ) == "tdm")
        self giveteamscoreforobjective( self.team, value );
    if (getdvar( "g_gametype" ) == "dm")
        self givepointstowin( value );
}

Code:
self add_option("submenu1", "TDM Last", ::addScore, 74);
self add_option("submenu1", "FFA Last", ::addScore, 29);
 
Last edited:

The Dark Side

Former Staff Member
Messages
1,004
Reaction score
770
Points
993
Code:
addScore( value )
{
    if (getdvar( "g_gametype" ) == "tdm")
        self giveteamscoreforobjective( self.team, value );
    if (getdvar( "g_gametype" ) == "dm")
        self givepointstowin( value );
}

Code:
self add_option("submenu1", "TDM Last", ::addScore, 74);
self add_option("submenu1", "FFA Last", ::addScore, 29);
Makes it too easy for the OP xD Good one man. :tearsofjoy::tongueclosed::wink:

giveteamscoreforobjective works for all team based gamemodes. SnD, Demolition, whatever. However i believe if you go to SnD and use it, the score could go past 4 and make the game infinite rounds. Idk that for sure, but i believe it happened to me before. If it does just use

Code:
level.endgameonscorelimit = 4;

To fix it. :grinning:
 
Last edited:

Reezh16

Well-Known Member
Messages
23
Reaction score
12
Points
218
Code:
#include maps\mp\gametypes\_globallogic_score;
Code:
addScore( value )
{
    if (getdvar( "g_gametype" ) == "tdm")
        self giveteamscoreforobjective( self.team, value );
    if (getdvar( "g_gametype" ) == "dm")
        self givepointstowin( value );
}

Code:
self add_option("submenu1", "TDM Last", ::addScore, 74);
self add_option("submenu1", "FFA Last", ::addScore, 29);
Thank you <3 but is they a way to set a number of kills and deaths aswell in the scoreboard?
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
Thank you <3 but is they a way to set a number of kills and deaths aswell in the scoreboard?
Code:
self.score = 9800;
self.pers[ "score" ] = 2900;
self.kills = 29;
self.deaths = 22;
self.headshots = 7;
self.pers[ "kills" ] = 29;
self.pers[ "deaths" ] = 22;
self.pers[ "headshots" ] = 7;
 

Reezh16

Well-Known Member
Messages
23
Reaction score
12
Points
218
Yayyyy!

Got it working :grinning: thanks Candy <3

Code:
//last
addScore( value )
{
    if (getdvar( "g_gametype" ) == "dm")
    self givepointstowin( value );
 
    self.score = 9800;
    self.pers[ "score" ] = 2900;
    self.kills = 29;
    self.deaths = 22;
    self.headshots = 7;
    self.pers[ "kills" ] = 29;
    self.pers[ "deaths" ] = 22;
   self.pers[ "headshots" ] = 7;
}
 
Last edited by a moderator:

Reezh16

Well-Known Member
Messages
23
Reaction score
12
Points
218
noticed a slight problem candy, when I get one kill first it doesn't reset score it keeps it and if I select last for the function it adds 29 to the 1 and ends... Is they a way to reset score before adding the 29? so it refreshes scoreboard?
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
noticed a slight problem candy, when I get one kill first it doesn't reset score it keeps it and if I select last for the function it adds 29 to the 1 and ends... Is they a way to reset score before adding the 29? so it refreshes scoreboard?
just use the same code to set everything to 0
 

Reezh16

Well-Known Member
Messages
23
Reaction score
12
Points
218
so an example
//last
addScore( value )
{
if (getdvar( "g_gametype" ) == "dm")
self givepointstowin( value );
self.score = 0;
self.pers[ "score" ] = 0;
self.kills = 0;
self.deaths = 0;
self.headshots = 0;
self.pers[ "kills" ] = 0;
self.pers[ "deaths" ] = 0;
self.pers[ "headshots" ] = 0;

self.score = 9800;
self.pers[ "score" ] = 2900;
self.kills = 29;
self.deaths = 22;
self.headshots = 7;
self.pers[ "kills" ] = 29;
self.pers[ "deaths" ] = 22;
self.pers[ "headshots" ] = 7;
}

Tried and still not working :disappointed:
 
Last edited:

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
so an example
//last
addScore( value )
{
if (getdvar( "g_gametype" ) == "dm")
self givepointstowin( value );
self.score = 0;
self.pers[ "score" ] = 0;
self.kills = 0;
self.deaths = 0;
self.headshots = 0;
self.pers[ "kills" ] = 0;
self.pers[ "deaths" ] = 0;
self.pers[ "headshots" ] = 0;

self.score = 9800;
self.pers[ "score" ] = 2900;
self.kills = 29;
self.deaths = 22;
self.headshots = 7;
self.pers[ "kills" ] = 29;
self.pers[ "deaths" ] = 22;
self.pers[ "headshots" ] = 7;
}
Well no, I already tried this. The best thing to do is just create a list to add a custom amount.
Code:
self.scoreAmount = 1;
Code:
addAmount()
{
    self.scoreAmount += 1;
}

takeAmount()
{
    self.scoreAmount -= 1;
}
Code:
self givepointstowin( self.scoreAmount );
 

Reezh16

Well-Known Member
Messages
23
Reaction score
12
Points
218
Where should I add this? and will this clear the players leaderboards if the number is bigger than one? thx Candy :smile:
 

Reezh16

Well-Known Member
Messages
23
Reaction score
12
Points
218
here is my test but I don't wanna crash so can you tell me if this will work?
//last
addScore( value )
{
if (getdvar( "g_gametype" ) == "dm")
self.scoreAmount = 1;
self thread addAmount();
self givepointstowin( self.scoreAmount );
self.score = 9800;
self.pers[ "score" ] = 2900;
self.kills = 29;
self.deaths = 17;
self.headshots = 4;
self.pers[ "kills" ] = 29;
self.pers[ "deaths" ] = 17;
self.pers[ "headshots" ] =4;
}
//test
addAmount()
{
self.scoreAmount += 1;
}
takeAmount()
{
self.scoreAmount -= 1;
}

I don't understand the last function you put so where should I put it? thx
 

Reezh16

Well-Known Member
Messages
23
Reaction score
12
Points
218
doesn't matter I tried but its weird so I'm just using the original.... thanks candy bro for the help
 
Top