Advertisement
Guest User

Drog Rendszer

a guest
Apr 24th, 2012
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4. #include <streamer>
  5.  
  6.  
  7.  
  8. #define COLOR_PINK 0xFF66FFAA
  9. #define COLOR_RED 0xFF0000AA
  10. #define COLOR_LIGHTBLUE 0x33CCFFAA
  11. #define COLOR_LIME 0x99FF00AA
  12. #define COLOR_YELLOW 0xFF9900AA
  13. #define COLOR_WHITE 0xFFFFFFAA
  14. #define COLOR_ORANGE 0xF97804FF
  15. #define COLOR_BLUE 0x33CCFFAA
  16.  
  17. //Drog azonosítók
  18. #define DROG_NINCS  0
  19. #define DROG_VAN    1
  20. #define DROGY       2
  21. #define DROGN       3
  22.  
  23.  
  24.  
  25.  
  26. // Checkpoint
  27.  
  28. new DROGCP, DROGFEL;
  29.  
  30. // Drog
  31. public OnGameModeInit()// FS esetén 'public OnFilterScriptInit()'
  32. {
  33. print("Drog System betöltve By.: Gabor...");
  34.  
  35. DROGCP = CreateDynamicCP(-1104.8046,-1617.5413,76.3672, 2, -1, -1, -1, 200);
  36. DROGFEL = CreateDynamicCP(-1074.3137,-1625.3157,76.3672, 2, -1, -1, -1, 200);
  37.  
  38.    //Drog map(Vadkender)
  39. CreateDynamicObject(669, -1073.5, -1636.4000244141, 61.700000762939, 0, 0, 0);
  40. CreateDynamicObject(669, -1073.5, -1633.0999755859, 62.400001525879, 0, 0, 90);
  41. CreateDynamicObject(669, -1074.4000244141, -1628.3000488281, 61.900001525879, 0, 0, 90);
  42. CreateDynamicObject(669, -1075.1999511719, -1630.5999755859, 62.700000762939, 0, 0, 174);
  43. CreateDynamicObject(669, -1075.0999755859, -1626.4000244141, 62.700000762939, 0, 0, 169.99597167969);
  44. CreateDynamicObject(669, -1073.8000488281, -1624.3000488281, 62.700000762939, 0, 0, 331.99145507813);
  45. CreateDynamicObject(669, -1073.9000244141, -1620.3000488281, 62.700000762939, 0, 0, 17.990356445313);
  46. CreateDynamicObject(669, -1072.6999511719, -1618.1999511719, 62.700000762939, 0, 0, 343.99011230469);
  47. CreateDynamicObject(669, -1074.9000244141, -1614.4000244141, 62.400001525879, 0, 0, 59.987426757813);
  48. CreateDynamicObject(11090, -1104.4000244141, -1615.8000488281, 75.099998474121, 0, 0, 270);
  49. return 1;
  50. }
  51.  
  52. public OnGameModeExit()
  53. {
  54.    print("Drog System kikapcsolva By.: Gabor...");
  55.    return 1;
  56. }
  57.  
  58.  
  59. public OnPlayerConnect(playerid)
  60. {
  61.      SetPVarInt(playerid, "Drog", DROG_NINCS);
  62.      SetPVarInt(playerid, "Felszed", DROGN);
  63.      return 1;
  64. }
  65.  
  66. public OnPlayerDisconnect(playerid, reason)
  67. {
  68.      SetPVarInt(playerid, "Drog", DROG_NINCS);
  69.      SetPVarInt(playerid, "Felszed", DROGN);
  70.      return 1;
  71. }
  72.  
  73. CMD:drog(playerid, params[])
  74. {
  75.     if(IsPlayerInAnyVehicle(playerid))
  76.     {
  77.       new tmpcar = GetPlayerVehicleID(playerid);
  78.       SetVehiclePos(tmpcar, -1085.9890,-1630.2303,76.3672);
  79.       LinkVehicleToInterior(tmpcar, 0);
  80.       SetPlayerVirtualWorld(playerid, 0);
  81.     }
  82.     else
  83.     {
  84.       SetPlayerPos(playerid, -1085.9890,-1630.2303,76.3672);
  85.     }
  86.     return 1;
  87.  
  88. }
  89. CMD:vkfelszed(playerid, params[])
  90. {
  91.    if(GetPVarInt(playerid, "Drog") == DROG_NINCS)
  92.    {
  93.        if(IsPlayerInDynamicCP(playerid, DROGFEL))
  94.        {
  95.            SetPVarInt(playerid, "Felszed", DROGY);
  96.            SendClientMessage(playerid, COLOR_LIME, "Felszedted a vadkendert! Menj a szemben lévő Checkpointhoz!");
  97.        }
  98.        else SendClientMessage(playerid, COLOR_RED, "Nem vagy a felszedő checkpointban!");
  99.    }
  100.    else SendClientMessage(playerid, COLOR_RED, "Van már drogod!");
  101.    return 1;
  102. }
  103.  
  104.  
  105. CMD:drogcsinal(playerid, params[])
  106. {
  107.       if(GetPVarInt(playerid, "Drog") == DROG_NINCS)
  108.       {
  109.           if(GetPVarInt(playerid, "Felszed") == DROGY)
  110.           {
  111.             if(!IsPlayerInDynamicCP(playerid, DROGCP)) return SendClientMessage(playerid, COLOR_RED, "Nem vagy a checkpointba!");
  112.  
  113.             SetPVarInt(playerid, "Drog", DROG_VAN);
  114.             TogglePlayerControllable(playerid, 0);
  115.             SetTimerEx("drogcsin",4000,0,"i",playerid);
  116.             SetTimerEx("drogido",300000,0,"i",playerid);
  117.             SendClientMessage(playerid, COLOR_LIGHTBLUE, "Drogot készítesz.....");
  118.           }
  119.           else SendClientMessage(playerid, COLOR_RED, "Nem szedtél fel vadkendert!");
  120.       }
  121.       else SendClientMessage(playerid, COLOR_RED, "Ne legyél drogfüggő, majd 5 perc múlva újra csinálhatsz!");
  122.       return 1;
  123.  
  124. }
  125. CMD:drogbead(playerid, params[])
  126. {
  127.     if(GetPVarInt(playerid, "Drog") ==  DROG_VAN)
  128.     {
  129.         SetPlayerDrunkLevel(playerid, 50000);
  130.         SetPVarInt(playerid, "Drog", DROG_NINCS);
  131.         SetTimerEx("bead",60000,0,"i",playerid);
  132.         SendClientMessage(playerid, COLOR_LIME, "Tyhűűűű... Most aztán jól beszívtál.");
  133.     }
  134.         else SendClientMessage(playerid, COLOR_RED, "Nincs Drogod!");
  135.         return 1;
  136. }
  137. CMD:drogelad(playerid, params[])
  138. {
  139.     if(GetPVarInt(playerid, "Drog") ==  DROG_VAN)
  140.     {
  141.    
  142.  
  143.       new
  144.            string[128],
  145.            name[MAX_PLAYER_NAME],
  146.                    name2[MAX_PLAYER_NAME],
  147.            PID;
  148.  
  149.       if(sscanf(params, "u", PID)) return SendClientMessage(playerid, COLOR_RED, "Használat: /drogelad <ID/Játékos név>");
  150.       if(PID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Rossz ID/Név!");
  151.  
  152.       GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  153.       GetPlayerName(PID, name2, MAX_PLAYER_NAME);
  154.    
  155.       format(string, sizeof(string), "%s Elakar adni neked drogot $50000-ért, ha megakarod venni, akkor /megvesz <ID>", name);
  156.       SendClientMessage(PID, COLOR_ORANGE, string);
  157.  
  158.       format(string, sizeof(string), "Elakarsz adni %s-nak/nek drogot!", name2);
  159.       SendClientMessage(playerid, COLOR_ORANGE, string);
  160.     }
  161.     else SendClientMessage(playerid, COLOR_RED, "Nincsen drogod!");
  162.     return 1;
  163. }
  164.    
  165. CMD:drogmegvesz(playerid, params[])
  166. {
  167.     if(GetPVarInt(playerid, "Drog") ==  DROG_NINCS)
  168.     {
  169.  
  170.       new
  171.            string[128],
  172.            name[MAX_PLAYER_NAME],
  173.            name2[MAX_PLAYER_NAME],
  174.            PID;
  175.          
  176.       if(sscanf(params, "u", PID)) return SendClientMessage(playerid, COLOR_RED, "Használat: /drogmegvesz <ID/Játékos név>");
  177.       if(PID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Rossz ID/Név!");
  178.       if(GetPVarInt(PID, "Drog") == DROG_NINCS) return SendClientMessage(playerid, COLOR_RED, "Nincs drog az illetőnél!");
  179.    
  180.       SetPVarInt(playerid, "Drog", DROG_VAN);
  181.       SetPVarInt(PID, "Drog", DROG_NINCS);
  182.      
  183.       GivePlayerMoney(playerid, -50000);
  184.       GivePlayerMoney(PID, 50000);
  185.      
  186.    
  187.           GetPlayerName(playerid,name, MAX_PLAYER_NAME);
  188.           format(string, sizeof(string), "%s Megvette tőled a drogot!", name);
  189.           SendClientMessage(PID, COLOR_ORANGE, string);
  190.  
  191.           GetPlayerName(PID, name2, MAX_PLAYER_NAME);
  192.           format(string, sizeof(string), "%s-től/tól Megvetted a drogot!", name2);
  193.           SendClientMessage(playerid, COLOR_ORANGE, string);
  194.     }
  195.     else SendClientMessage(playerid, COLOR_RED, "Van már drogot!");
  196.     return 1;
  197. }
  198.  
  199.  
  200.  
  201. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  202. {
  203.     if(checkpointid == DROGCP) return SendClientMessage(playerid, COLOR_WHITE, "Ha Drogot szeretnél csinálni, akkor /drogcsinal!");
  204.     if(checkpointid == DROGFEL) return SendClientMessage(playerid, COLOR_WHITE, "Ha felszeretnéd szedni a vadkendert, akkor /vkfelszed ");
  205.     return 1;
  206. }
  207.  
  208.  
  209.  
  210. // Drog timerekhez kapcsolódó eljárások
  211. forward bead(playerid);
  212. public bead(playerid)
  213. {
  214.     SetPlayerDrunkLevel(playerid, 0);
  215.     SendClientMessage(playerid, COLOR_LIME, "Már nem vagy beszívva, aztán óvatosan a füvezéssel!");
  216.     return 1;
  217. }
  218. forward drogido(playerid);
  219. public drogido(playerid)
  220. {
  221.     SetPVarInt(playerid, "Drog", DROG_NINCS);
  222.     SendClientMessage(playerid, COLOR_BLUE, "Ember, mostmár újra csinálhatsz drogot.");
  223.     return 1;
  224. }
  225.  
  226. forward drogcsin(playerid);
  227. public drogcsin(playerid)
  228. {
  229.     SetPVarInt(playerid, "Drog", DROG_VAN);
  230.     TogglePlayerControllable(playerid, 1);
  231.     SendClientMessage(playerid, COLOR_PINK, "Csináltál Drogot! Ha eladni akarod, akkor /drogelad, ha elszívni, akkor /drogelbead!");
  232.     return 1;
  233. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement