SA-MP Forums Archive
Payday problem - 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: Payday problem (/showthread.php?tid=508963)



Payday problem - Affan - 24.04.2014

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?


Re: Payday problem - Nathan_Taylor - 24.04.2014

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



Re: Payday problem - Youssef214 - 24.04.2014

It Won't Work On "OnGameModeInit" Function.


Re: Payday problem - Nathan_Taylor - 24.04.2014

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);
}



Re: Payday problem - Luis- - 24.04.2014

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


Re: Payday problem - Affan - 25.04.2014

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


Re: Payday problem - Mattakil - 25.04.2014

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.


Re: Payday problem - Affan - 25.04.2014

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?


Re: Payday problem - Mattakil - 25.04.2014

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();
}



Re: Payday problem - Galletziz - 25.04.2014

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