Reward every XX playing hours? - 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)
+--- Thread: Reward every XX playing hours? (
/showthread.php?tid=330729)
Reward every XX playing hours? -
Supercop - 02.04.2012
I'm working on a RP gamemode and I want to do the following:
Each paycheck you get one extra Played Hour in your account (this works properly)
But now I want that if you've played 10 playing hours, you get 1 "Reward Point", now I can do the first 10 playing hours but how can i script it easily that you get a Reward Point at EACH 10 playing hours?
Re: Reward every XX playing hours? -
TzAkS. - 02.04.2012
When player is doing 10 hours,then it`s start again from 1?
You cand do something like
Код:
If(PlayerInfo[playerid][pHours] == 10
{
PlayerInfo[playerid][RewardPoint] += 1;
}
If(PlayerInfo[playerid][pHours] == 20
{
PlayerInfo[playerid][RewardPoint] += 1;
}
If(PlayerInfo[playerid][pHours] == 30
{
PlayerInfo[playerid][RewardPoint] += 1;
}
Or if is starting from 0 again you need just If(PlayerInfo[playerid][pHours] == 10 ..
Change RewardPoint with your code
Re: Reward every XX playing hours? -
Supercop - 02.04.2012
Well that's what I want to avoid as then I have to make a list up to 500 hours or so, I think I just make an additional counter besides pHours, when that counter hits 10 it'll return to 0 and give the player 1 RewardPoint.
I think that'll work! Thanks.
Re: Reward every XX playing hours? -
AndreT - 02.04.2012
Modulo (% in PAWN) will help you out here.
pawn Код:
if(PlayerInfo[playerid][pHours] % 10 == 0)
{
// No leftover after division by 10...
// Reward!
}
TzAkS., please read a coding manual or something. Start off small, not by helping others. Your if-statements don't have their closing )-s