SA-MP Forums Archive
Help with equation? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with equation? (/showthread.php?tid=138757)



Help with equation? - LoneWolf23245 - 03.04.2010

Hey, It's kinda late at night and i am tired, haha, So well in my code i have it so every time you kill someone you get 100 points, It's 1000 points to rank up, I have a variable to say how many points they have left before ranking up its name is "RankUpNeeded", I can't seem to figure out the equation you would need to establish how many 100's there are in a number, Can anyone help me out with this?, Cheers.

- LoneWolf23245


Re: Help with equation? - adsy - 03.04.2010

1000 points is 10*100
(your equation you want sounds like this)
1000/100


so

equation

800 points means 200 to go

1000(levelup)
800(needed)
var1-var2 = amount left



Re: Help with equation? - LoneWolf23245 - 03.04.2010

I have that, The idea is i want it to show how many kills you need before leveling up too, This is what i have so far:

Код:
CMD:points(playerid, params[])
{
	new PointsString1[128], PointsString2[128], RankUpNeeded;
	
	RankUpNeeded = PlayerInfo[playerid][PlayerPoints] - 1000;
	
	format(PointsString1, sizeof(PointsString1), "You currently have %d server points.", PlayerInfo[playerid][PlayerPoints]);
	format(PointsString2, sizeof(PointsString2), "You need %d more points before ranking up!.", RankUpNeeded);
	
	SendClientMessage(playerid, CommandSuccess, PointsString1);
	SendClientMessage(playerid, CommandError, PointsString2);
}
Now i need a way to figure out how many hundreds are in the variable 'RankUpNeeded' and echo it as amount of kills needed before rankup.



Re: Help with equation? - adsy - 03.04.2010

ToBeShown = RankUpNeeded/100;

no??


Re: Help with equation? - LoneWolf23245 - 03.04.2010

Quote:
Originally Posted by adsy
ToBeShown = RankUpNeeded/100;

no??
Worked thanks, Just tired is all xD


Re: Help with equation? - adsy - 03.04.2010

its 2 am here, im tired too