Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. //=================================ATTEMPTING SYSTEM BY MELEK MIZHER===============================//
  2.  
  3. #include <a_samp>
  4.  
  5. // UNDER ONPLAYERCOMMANDTEXT
  6.  
  7. public OnPlayerCommandText(playerid, cmdtext[])
  8. {
  9. if(strcmp(cmd, "/attempt", true) == 0)
  10. {
  11. if(IsPlayerConnected(playerid))
  12. {
  13. if(gPlayerLogged[playerid] == 0)
  14. {
  15. SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !");
  16. return 1;
  17. }
  18. GetPlayerName(playerid, sendername, sizeof(sendername));
  19. new length = strlen(cmdtext);
  20. while ((idx < length) && (cmdtext[idx] <= ' '))
  21. {
  22. idx++;
  23. }
  24. new offset = idx;
  25. new result[96];
  26. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  27. {
  28. result[idx - offset] = cmdtext[idx];
  29. idx++;
  30. }
  31. result[idx - offset] = EOS;
  32. if(!strlen(result))
  33. {
  34. SendClientMessage(playerid, COLOR_WHITE, "Usage: /attempt [Action]");
  35. return 1;
  36. }
  37. new attempt = random(2);
  38. if(attempt == 1)
  39. {
  40. if(PlayerInfo[playerid][pMask] == 1)
  41. {
  42. format(string, sizeof(string), "* The Stranger has attempted to %s and succeeded.", result);
  43. }
  44. else
  45. {
  46. format(string, sizeof(string), "* %s has attempted to %s and succeeded.", sendername, result);
  47. }
  48. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  49. }
  50. else
  51. {
  52. if(PlayerInfo[playerid][pMask] == 1)
  53. {
  54. format(string, sizeof(string), "* The Stranger has attempted to %s and failed.", result);
  55. }
  56. else
  57. {
  58. format(string, sizeof(string), "* %s has attempted to %s and failed.", sendername, result);
  59. }
  60. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  61. }
  62. }
  63. return 1;
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement