Advertisement
Nyft_

Base Payday ~Nyft

Dec 9th, 2020 (edited)
709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.28 KB | None | 0 0
  1. #include a_samp
  2.  
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
  4.  
  5. #define function%0(%1) \
  6.     forward%0(%1); public%0(%1)
  7.  
  8. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
  9.  
  10. static const PAYDAY_TIMER = 3;      // Minutos para o pagamento
  11. static const PAYDAY_MONEY = 1000;   // Quantidade do pagamento
  12.  
  13. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
  14.  
  15. static PaydayCount[MAX_PLAYERS];
  16. static PaydayTimer[MAX_PLAYERS];
  17. static bool:Spawned[MAX_PLAYERS];
  18.  
  19. main(){}
  20.  
  21. public OnPlayerSpawn(playerid)
  22. {
  23.     if(!Spawned[playerid])
  24.     {
  25.         Spawned[playerid] = true;
  26.         PaydayCount[playerid] = PAYDAY_TIMER * 60;
  27.         PaydayTimer[playerid] = SetTimerEx("OnPlayerPayday", 1000, true, "i", playerid);
  28.     }
  29.     return 1;
  30. }
  31.  
  32. function OnPlayerPayday(playerid)
  33. {
  34.     if(Spawned[playerid])
  35.     {
  36.         if(--PaydayCount[playerid] <= 0)
  37.         {
  38.             PaydayCount[playerid] = PAYDAY_TIMER * 60;
  39.             GivePlayerMoney(playerid, PAYDAY_MONEY);
  40.             SendClientMessage(playerid, -1, "* Você recebeu o pagamento do payday com sucesso.");
  41.             return 1;
  42.         }
  43.         new string[32];
  44.         format(string, sizeof(string), "~b~PAYDAY: ~w~%02d:%02d", PaydayCount[playerid] / 60, PaydayCount[playerid] % 60);
  45.         GameTextForPlayer(playerid, string, 1000, 3);
  46.     }
  47.     return 1;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement