PDA

View Full Version : Help with money


Jakwob
24/04/2015, 09:34 AM
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.



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

Sithis
24/04/2015, 10:09 AM
How many times is the above code called?

BleverCastard
24/04/2015, 10:16 AM
Why are you showing the TD for 50 seconds?

Jakwob
24/04/2015, 10:17 AM
once per hour


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

Azula
24/04/2015, 11:57 AM
and timer declaration code