P1xeL

Untitled

Dec 10th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. public Function()
  2. {
  3. else if(equali(iArgs[0] , "/gamble") || equali(iArgs[0],"!gamble"))
  4. {
  5. if (!get_pcvar_num(g_Cvar[ENABLED]) || get_pcvar_num(g_Cvar[ENABLED]) && !get_pcvar_num(g_Cvar[GAMBLE]))
  6. return 1;
  7.  
  8. new pointnum = str_to_num(iArgs[1]);
  9. if(!is_str_num(iArgs[1]))
  10. {
  11. ColorChat(id,"You ^3must ^1enter ^1numbers^1!");
  12. return 1;
  13. }
  14.  
  15. else if(!check_points(id,pointnum))
  16. {
  17. ColorChat(id,"You ^3don't ^1have enough ^3points^1!");
  18. return 1;
  19. }
  20.  
  21. else if(pointnum < 200)
  22. {
  23. ColorChat(id,"You ^3must ^1gamble on more than^4 200 ^3points^1!");
  24. return 1;
  25. }
  26.  
  27. new szName[32];
  28. get_user_name(id, szName, charsmax(szName));
  29. new GambledNum;
  30. GambledNum = random_num(1,100);
  31. switch(GambledNum)
  32. {
  33. case 1..54:
  34. {
  35. ColorChat(0,"The player ^3%s^1 has gambled on ^4%i^1 cash and ^3lost^1!",szName,pointnum,GambledNum);
  36. g_points[id] -= pointnum;
  37. do_effect(id,0,1);
  38. return 1;
  39. }
  40.  
  41. case 55..100:
  42. {
  43. ColorChat(0,"The player ^3%s^1 has gambled on ^4%i^1 cash and ^3WON^1!",szName,pointnum,GambledNum);
  44. g_points[id] += pointnum;
  45.  
  46. if (!max_points(id))
  47. g_points[id] = get_pcvar_num(g_Cvar[MAX_POINTS]);
  48.  
  49. return 1;
  50. }
  51. }
  52. }
  53.  
  54. return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment