10.12.2008, 21:26
Hey there,
I've tried to make a simple Bank-System, so if the clock turns 6, every player inside the Bank-Area gets an amount of money, every day at 6 o' clock.
I tried the following code so far on myself, but unfortunatelly it isn't working like I want it to. You just get the money 1 time after server-start, but not the following days. I guess it has something to do with the Timer, but if I delete the "KillTimer" you get the money infinite times at 6 and it is not stopping lol.
I hope you can help me out to fix this, I'm a scripting-beginner
I've tried to make a simple Bank-System, so if the clock turns 6, every player inside the Bank-Area gets an amount of money, every day at 6 o' clock.
I tried the following code so far on myself, but unfortunatelly it isn't working like I want it to. You just get the money 1 time after server-start, but not the following days. I guess it has something to do with the Timer, but if I delete the "KillTimer" you get the money infinite times at 6 and it is not stopping lol.
Код:
timer1 = SetTimer("isPlayerInArea",100, 1); timer2 = SetTimer("BankTime", 999, 1); public isPlayerInArea() { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerInArea(i, 1711.4371, 1731.7839, -1670.3661, -1643.2722)) { SendClientMessage(i, 0xFFFF00AA, "( ! ) Welcome to Bank!"); KillTimer(timer1); return 1; } } return 1; } public BankTime() { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerInArea(i, 1711.4371, 1731.7839, -1670.3661, -1643.2722)) { new hours; new minutes; GetPlayerTime(i, hours, minutes); if(hours == 6.00 && minutes == 0.00) { PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0); GivePlayerMoney(i, 7500); SendClientMessage(i, 0x12900BBF, "||| 6:00 | BANK TIME: |||"); SendClientMessage(i, 0xFFFF00AA, "YOU RECEIVE +7.500 $"); KillTimer(timer2); return 1; } } } return 1; }