SA-MP Forums Archive
Help with money - 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: Help with money (/showthread.php?tid=571984)



Help with money - Jakwob - 24.04.2015

hey i have made this code when a player plays a certain amount of hours they get rewarded. but when they play the first hour instead of it rewarding you with $1000 it for some reason gives $19000.


pawn Код:
if(CST[playerid] == 2) // 1st Hour Played
    {
        GivePlayerMoney(playerid, 1000);
        PlayerTextDrawSetString(playerid, TOS, "Current Time~n~On Server~n~1 Hour");
        PlayerTextDrawShow(playerid, PayoutTD);
        PlayerTextDrawSetString(playerid, PayoutTD, "TOS Payout~n~You Recieved~n~$~g~1000");
        SetTimerEx("TDDestroy", 50000, false, "i", playerid);
    }
I will rep the help i get


AW: Help with money - Sithis - 24.04.2015

How many times is the above code called?


Re: Help with money - BleverCastard - 24.04.2015

Why are you showing the TD for 50 seconds?


Re: Help with money - Jakwob - 24.04.2015

once per hour

pawn Код:
ServerPayout(playerid)
{
    if(CST[playerid] == 0) // 0 Hours Played
    {
        PlayerTextDrawSetString(playerid, TOS, "Current Time~n~On Server~n~0 Hours");
    }
    if(CST[playerid] == 2) // 1st Hour Played
    {
        GivePlayerMoney(playerid, 1000);
        PlayerTextDrawSetString(playerid, TOS, "Current Time~n~On Server~n~1 Hour");
        PlayerTextDrawShow(playerid, PayoutTD);
        PlayerTextDrawSetString(playerid, PayoutTD, "TOS Payout~n~You Recieved~n~$~g~1000");
        SetTimerEx("TDDestroy", 5000, false, "i", playerid);
        return 1;
    }
    if(CST[playerid] == 4) // 2nd Hour Played
    {
        GivePlayerMoney(playerid, 2000);
        PlayerTextDrawSetString(playerid, TOS, "Current Time~n~On Server~n~2 Hours");
        PlayerTextDrawShow(playerid, PayoutTD);
        PlayerTextDrawSetString(playerid, PayoutTD, "TOS Payout~n~You Recieved~n~$~g~2000");
        SetTimerEx("TDDestroy", 5000, false, "i", playerid);
        return 1;
    }
    if(CST[playerid] == 6) // 3rd Hour Played
    {
        GivePlayerMoney(playerid, 3000);
        PlayerTextDrawSetString(playerid, TOS, "Current Time~n~On Server~n~3 Hours");
        PlayerTextDrawShow(playerid, PayoutTD);
        PlayerTextDrawSetString(playerid, PayoutTD, "TOS Payout~n~You Recieved~n~$~g~3000");
        SetTimerEx("TDDestroy", 5000, false, "i", playerid);
        return 1;
    }
    if(CST[playerid] == 8) // 4th Hour Played
    {
        GivePlayerMoney(playerid, 4000);
        PlayerTextDrawSetString(playerid, TOS, "Current Time~n~On Server~n~4 Hours");
        PlayerTextDrawShow(playerid, PayoutTD);
        PlayerTextDrawSetString(playerid, PayoutTD, "TOS Payout~n~You Recieved~n~$~g~4000");
        SetTimerEx("TDDestroy", 5000, false, "i", playerid);
        return 1;
    }
    if(CST[playerid] == 10) // 5th Hour Played
    {
        GivePlayerMoney(playerid, 5000);
        PlayerTextDrawSetString(playerid, TOS, "Current Time~n~On Server~n~5 Hours");
        PlayerTextDrawShow(playerid, PayoutTD);
        PlayerTextDrawSetString(playerid, PayoutTD, "TOS Payout~n~You Recieved~n~$~g~5000");
        SetTimerEx("TDDestroy", 5000, false, "i", playerid);
        return 1;
    }
    if(CST[playerid] == 12) // 6th Hour Played
    {
        GivePlayerMoney(playerid, 6000);
        PlayerTextDrawSetString(playerid, TOS, "Current Time~n~On Server~n~6 Hours");
        PlayerTextDrawShow(playerid, PayoutTD);
        PlayerTextDrawSetString(playerid, PayoutTD, "TOS Payout~n~You Recieved~n~$~g~6000");
        SetTimerEx("TDDestroy", 5000, false, "i", playerid);
        return 1;
    }
thats a cut of my code


Re: Help with money - Azula - 24.04.2015

and timer declaration code