Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #include <sdktools>
  2. #include <store> // NVM THIS <
  3. #include <zephstocks> // and this <
  4. #include <sourcemod>
  5. new Handle:countdownTimer = INVALID_HANDLE;
  6.  
  7. new g_cvarMin = -1;
  8. new g_cvarMax = -1;
  9.  
  10. public Plugin:myinfo =
  11. {
  12. name = "Raffle re-make",
  13. author = "Grandpa",
  14. description = "Gives credits to random client.",
  15. version = "1.0",
  16. url = "redtube.com"
  17. }
  18.  
  19. public OnPluginStart()
  20. {
  21. RegAdminCmd("sm_test", Command_Countdown, ADMFLAG_CHAT, "Generates a random number for a raffle.");
  22.  
  23. g_cvarMin = RegisterConVar("sm_store_raffle_min_credits", "200", "Minimum amount of credits", TYPE_INT);
  24. g_cvarMax = RegisterConVar("sm_store_raffle_max_credits", "1000", "Maximum amount of credits", TYPE_INT);
  25.  
  26. }
  27.  
  28. public Action:Command_Countdown(iClient, args)
  29. {
  30. countdownTimer = CreateTimer(1.0, Timer_Countdown, INVALID_HANDLE, TIMER_REPEAT);
  31. countdownTimer = 10;
  32. return Plugin_Handled;
  33. }
  34.  
  35. public Action:Timer_Countdown(Handle:timer)
  36. {
  37.  
  38. new credits = GetRandomInt(g_eCvars[g_cvarMin][aCache], g_eCvars[g_cvarMax][aCache]);
  39. if(countdownTimer <= 0) {
  40.  
  41. KillTimer(countdownTimer);
  42. PrintToChatAll("goes here");
  43. return Plugin_Handled;
  44.  
  45. } else {
  46.  
  47. PrintCenterTextAll("A Raffle for %d credits, is starting in: %i seconds.", credits, countdownTimer);
  48. countdownTimer--;
  49. }
  50.  
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement