Advertisement
GomesBB

SISTEMA DE MACONHA

Dec 4th, 2020 (edited)
1,577
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.78 KB | None | 1 0
  1. #include a_samp
  2. #include dof2
  3. #include sscanf2
  4. #include zcmd
  5. #include foreach
  6.  
  7. #define COLOR_PINK              0xFF80C0FF
  8. #define COR_VERMELHO            0xFF0000FF
  9.  
  10. enum InfoPlayer {
  11.  
  12. Maconha
  13. };
  14.  
  15. new Player[MAX_PLAYERS][InfoPlayer];
  16.  
  17. public OnPlayerConnect(playerid)
  18. {
  19.     SendClientMessage(playerid, -1, "[INFO]: Sistema de drogas desenvolvido por Gomes em prol da Pawn Coders!!");
  20.     return 1;
  21. }
  22.  
  23. public OnPlayerDisconnect(playerid, reason)
  24. {
  25.     DOF2_Exit();
  26.     return 1;
  27. }
  28.  
  29. CMD:fumar(playerid, params[])
  30. {
  31.     if(Player[playerid][Maconha] >= 5)
  32.     {        
  33.         new string[128];
  34.         ApplyAnimation(playerid, "SMOKING", "M_SMK_IN",4.1, 1, 0, 0, 0, 0);
  35.         format(string, sizeof(string), "%s fumou um baseado", GetPlayerNameEx(playerid));
  36.         SendClientMessageInRange(30.0, playerid, string, COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
  37.         Player[playerid][Maconha] -= 5;
  38.         SetTimerEx("PararFumo",10000,true,"i",playerid);
  39.         SetPlayerDrunkLevel(playerid, 3000);
  40.     }
  41.     else
  42.     {
  43.         SendClientMessage(playerid,-1,"[INFO]: Erro: Voce precisa ter pelo menos 5g para fumar!");
  44.     }
  45.     return true;
  46. }
  47.  
  48. CMD:vendermaconha(playerid, params[])
  49. {
  50.     new Vendeu, Gramas, Str[128];
  51.     if(sscanf(params, "ud", Vendeu, Gramas))
  52.     if(Vendeu == INVALID_PLAYER_ID) return SendClientMessage(playerid, COR_VERMELHO, "[SERVER]: ID invalido!");
  53.     if(Gramas > 100 && Gramas > 5) return SendClientMessage(playerid, COR_VERMELHO, "[SERVER]: De um valor entre 100 e 1 gramas de maconha!");
  54.  
  55.     Player[Vendeu][Maconha] = Gramas;
  56.     format(Str, sizeof Str, "[SERVER]: O traficante %s te deu %dg de maconha!", GetPlayerNameEx(playerid), Gramas);
  57.     SendClientMessage(Vendeu, COLOR_PINK, Str);  
  58.     return 1;
  59. }
  60.  
  61. forward PararFumo(playerid);
  62. public PararFumo(playerid)
  63. {
  64.     ClearAnimations(playerid);
  65.     return 1;
  66. }
  67.  
  68. stock GetPlayerNameEx(playerid)
  69. {
  70.     new Nome[MAX_PLAYER_NAME];
  71.     GetPlayerName(playerid, Nome, sizeof(Nome));
  72.     return Nome;
  73. }
  74.  
  75. stock SendClientMessageInRange(Float:_r, playerid,const _s[],c1,c2,c3,c4,c5)
  76. {
  77.     new Float:_x, Float:_y, Float:_z;
  78.     GetPlayerPos(playerid, _x, _y, _z);
  79.     foreach(Player, i)
  80.     {
  81.         if(GetPlayerVirtualWorld(i) != GetPlayerVirtualWorld(playerid))continue;
  82.         if(GetPlayerDistanceFromPoint(i,_x,_y,_z) < _r/16)
  83.         SendClientMessage(i, c1, _s);
  84.         else if(GetPlayerDistanceFromPoint(i,_x,_y,_z) < _r/8)
  85.         SendClientMessage(i, c2, _s);
  86.         else if(GetPlayerDistanceFromPoint(i,_x,_y,_z) < _r/4)
  87.         SendClientMessage(i, c3, _s);
  88.         else if(GetPlayerDistanceFromPoint(i,_x,_y,_z) < _r/2)
  89.         SendClientMessage(i, c4, _s);
  90.         else if(GetPlayerDistanceFromPoint(i,_x,_y,_z) < _r)
  91.         SendClientMessage(i, c5, _s);
  92.     }
  93.     return 1;
  94. }
  95.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement