Sign in to follow this  
Barone del Fastidio

set ranks, and unlock all on my server

Recommended Posts

Hi Guys, I am hosting a private cod4 server to play with my friends only, I have made this script getting the stuff from: https://github.com/balsa0/cod4-level-hack-mod

I have made this: https://pastebin.com/PjKGnXc0,

it kinda works, but when it set levels, I get negative xp on the profile, but I see level 55 as rank when I connect to my server. how can I fix that?

Share this post


Link to post
Share on other sites

You are calling giveXp inside the for loop as a thread.

I guess that's the problem

Share this post


Link to post
Share on other sites

Alright, i found your problem... 

 

In your giveXp function you are forcing rankID 54 at every run and that's why the rank does not update correctly.

In fact your are still rank 1 but with the rankxp of rank 55, so your are a negative amount away from the required xp to reach rank 2.

 

Easy fix:

	for(i = 0; i < giveXp.size; i++)
	{
		self giveXp( giveXp[ i ], i );	
		wait .1;
	}

 

and

giveXp( amount, nextRank )
{
	newXp = amount;
	self.pers["rankxp"] = newXp;
	self maps\mp\gametypes\_persistence::statSet( "rankxp", newXp );
	rankId = nextRank;
	self.pers["rank"] = rankId;
	self maps\mp\gametypes\_persistence::statSet( "rank", rankId );
	self maps\mp\gametypes\_persistence::statSet( "minxp", int(level.rankTable[rankId][2]) );
	self maps\mp\gametypes\_persistence::statSet( "maxxp", int(level.rankTable[rankId][7]) );
	self maps\mp\gametypes\_rank::updateRank();
}

 

Works for me :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this