Advertisement
Guest User

Untitled

a guest
Feb 1st, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. forward drugupdate(playerid);
  2. forward drugended(playerid);
  3.  
  4. CMD:takedrugs(playerid,params[])
  5. {
  6. new amount,str1[128];
  7. if(var[playerid][LoginCheck] == 0) return SendClientMessage(playerid,COLOR_RED,"You Must Login Before Using Any Command.");
  8. if(blocktd == 1) return SendClientMessage(playerid,COLOR_RED,"The Command /takedrugs Has Been Disabled By The Administration.");
  9. if(var[playerid][Spawned] == 0) return SendClientMessage(playerid,COLOR_RED,""DEAD_ERROR"");
  10. if(pInfo[playerid][Jailed] >= 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Use This Command In Jail.");
  11. if(var[playerid][aduty] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Use This Command While You Are An Admin On Duty.");
  12. if(var[playerid][Frozen] == 1) return SendClientMessage(playerid,COLOR_RED,""FROZEN_ERROR"");
  13. if(IsSpecing[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Use This Command While You Are Spectating.");
  14. if(sscanf(params,"d",amount)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /takedrugs (Amount)");
  15. if(pInfo[playerid][Drugs] < amount)
  16. {
  17. format(str1,sizeof(str1),"You Do Not Have %d Grams Drugs. You Are Carrying %d Grams Of Drugs.",amount,pInfo[playerid][Drugs]);
  18. SendClientMessage(playerid,COLOR_RED,str1);
  19. return 1;
  20. }
  21. if(var[playerid][ODWarn] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Take Drugs While You Are Suffering From A Drug Overdose.");
  22. else
  23. {
  24. KillTimer(drugkill[playerid]);
  25. KillTimer(drugend[playerid]);
  26. pInfo[playerid][Drugs] -=amount;
  27. pInfo[playerid][OnDrugs]+=amount;
  28. str1,sizeof(str1),"You Are Now On Drugs. %d Grams Remaining.",pInfo[playerid][Drugs]);
  29. SendClientMessage(playerid,COLOR_LIGHTBLUE,str1);
  30. GameTextForPlayer(playerid,"~w~On Drugs",5000,3);
  31. ApplyAnimation(playerid,"SMOKING","M_smk_in",4,0,0,0,0,0,0);
  32. SetPlayerChatBubble(playerid, "On Drugs", COLOR_YELLOW, 100.0, 5000);
  33. drugkill[playerid] = SetTimerEx("drugupdate",3*1000,true,"i",playerid);
  34. drugend[playerid] = SetTimerEx("drugended",pInfo[playerid][OnDrugs]*3*1000,false,"i",playerid);
  35. }
  36. return 1;
  37. }
  38.  
  39. public drugupdate(playerid)
  40. {
  41. pInfo[playerid][OnDrugs] --;
  42. new Float:Health[MAX_PLAYERS];
  43. GetPlayerHealth(playerid,Health[playerid]);
  44. if(Health[playerid] > 98.0)
  45. {
  46. SetPlayerHealth(playerid,98.0);
  47. return 1;
  48. }
  49. else if(Health[playerid] < 98.0)
  50. {
  51. SetPlayerHealth(playerid,Health[playerid] + 5.0);
  52. GetPlayerHealth(playerid,Health[playerid]);
  53. if(Health[playerid] > 98.0)
  54. {
  55. SetPlayerHealth(playerid,98.0);
  56. }
  57. }
  58. return 1;
  59. }
  60. public drugended(playerid)
  61. {
  62. KillTimer(drugkill[playerid]);
  63. return 1;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement