Reward every XX playing hours?
#1

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?
Reply
#2

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
Reply
#3

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.
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)