Payday problem
#1

I have this code, but it is not giving the payday?

OnGameModeInit
pawn Код:
SetTimer("PayDay", 60000, true);
pawn Код:
forward PayDay();
public PayDay()
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        GivePlayerMoney(i, (GetPlayerMoney(i) * 10) / 100);
    }
}
Why isn't it working?
Reply
#2

Is that line that sets the timer in OnGameModeInit()?
pawn Код:
public OnGameModeInit()
{
SetTimer("PayDay", 60000, true);
}
Reply
#3

It Won't Work On "OnGameModeInit" Function.
Reply
#4

Quote:
Originally Posted by Youssef214
Посмотреть сообщение
It Won't Work On "OnGameModeInit" Function.
Make sure the function is defined above OnGamemodeInit()
pawn Код:
forward PayDay();
public PayDay()
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        GivePlayerMoney(i, (GetPlayerMoney(i) * 10) / 100);
    }
}

public OnGameModeInit()
{
    SetTimer("PayDay", 60000, true);
}
Reply
#5

@Nathan_Taylor, that shouldn't matter, it doesn't have to be above, it can be below.
Reply
#6

pawn Код:
public OnGameModeInit()
{
    SetTimer("PayDay", 60000, true);
}
forward PayDay();
public PayDay()
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        GivePlayerMoney(i, (GetPlayerMoney(i) * 10) / 100);
    }
}
This is my code. It doesn't even give a penny when I hosted the server
Reply
#7

Wait so, you want to get the player's money, multiply it by 10 then divide it by 100 and that's what you give them?

Because if I have 1000 before paycheck, i'll get 100. But if I have 150 before paycheck, i'll get 15. And if I have less than 100, say 50, then 50x10 = 500 /100 = 5.
Reply
#8

Quote:
Originally Posted by Mattakil
Посмотреть сообщение
Wait so, you want to get the player's money, multiply it by 10 then divide it by 100 and that's what you give them?

Because if I have 1000 before paycheck, i'll get 100. But if I have 150 before paycheck, i'll get 15. And if I have less than 100, say 50, then 50x10 = 500 /100 = 5.
I have a system where you always have atleast more than $900. Anyways , why isn't it working?
Reply
#9

Hmm, try this

pawn Код:
public OnGameModeInit()
{
    SetTimer("PayDay", 60000, true);
}
forward PayDay();
public PayDay()
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        GivePlayerMoney(i, 900);
    }
}
Also, add
pawn Код:
CMD:forcepay(playerid)
{
    PayDay();
}
Reply
#10

pawn Код:
SetTimerEx("PayDay",6000,true,"i",playerid);
try this..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)