Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2012
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.95 KB | None | 0 0
  1. /*
  2.     Advents System by !TheO
  3.     Sind sie auch manchmal Taktloss ? :D
  4.    
  5.     (c) by TheO
  6.  
  7. */
  8.  
  9. #include <a_samp>
  10. #include <zcmd>
  11. #include <dini>
  12.  
  13. new Baum,
  14. Geschenk[4],
  15. Pickup,
  16. Text3D:Label,
  17. timer;
  18.  
  19. forward OnDateChange();
  20.  
  21. new year, month, day;
  22.  
  23.  
  24. new Kerze[9];
  25.  
  26. new Advent = 0;
  27.  
  28.  
  29. public OnFilterScriptInit()
  30. {
  31.     print("\n--------------------------------------");
  32.     print(" Advents System geladen (c) by TheO");
  33.     print("--------------------------------------\n");
  34.     new datei[50];
  35.     format(datei,50,"/Advent.txt");
  36.     if(!fexist(datei))
  37.     {
  38.         dini_Create(datei);
  39.         if(day >= 2)
  40.         {
  41.             dini_IntSet(datei,"Kerze",1);
  42.             CreateObject(18688,1478.290649,-1684.835205,13.156875,0,0,0);
  43.            
  44.         }
  45.         if(day >= 9)
  46.         {
  47.             dini_IntSet(datei,"Kerze",2);
  48.             CreateObject(18688,1481.993530,-1685.043334,13.106875,0,0,0);
  49.         }
  50.         if(day >= 16)
  51.         {
  52.             dini_IntSet(datei,"Kerze",3);
  53.             CreateObject(18688,1482.502319,-1680.885620,13.116871,0,0,0);
  54.         }
  55.         if(day >= 23)
  56.         {
  57.             dini_IntSet(datei,"Kerze",4);
  58.             CreateObject(18688,1478.336425,-1680.745117,13.076870,0,0,0);
  59.         }
  60.     }
  61.     else
  62.     {
  63.         Advent = dini_Int(datei,"Kerze");
  64.         if(Advent >= 1)
  65.         {
  66.             CreateObject(18688,1478.290649,-1684.835205,13.156875,0,0,0);
  67.         }
  68.         if(Advent >= 2)
  69.         {
  70.             CreateObject(18688,1481.993530,-1685.043334,13.106875,0,0,0);
  71.         }
  72.         if(Advent >= 3)
  73.         {
  74.             CreateObject(18688,1482.502319,-1680.885620,13.116871,0,0,0);
  75.         }
  76.         if(Advent >= 4)
  77.         {
  78.             CreateObject(18688,1478.336425,-1680.745117,13.076870,0,0,0);
  79.         }
  80.     }
  81.    
  82.    
  83.    
  84.     Baum =CreateObject(19076, 1480.38, -1682.43, 12.84,   0.00, 0.00, 0.00);
  85.     Geschenk[0] = CreateObject(19058, 1481.38, -1683.44, 13.55,   0.00, 0.00, 8.58);
  86.     Geschenk[1] = CreateObject(19057, 1479.90, -1683.87, 13.56,   0.00, 0.00, -13.50);
  87.     Geschenk[2] = CreateObject(19056, 1478.91, -1682.53, 13.55,   0.00, 0.00, 0.00);
  88.     Geschenk[3] = CreateObject(19054, 1481.53, -1681.76, 13.61,   0.00, 0.00, 0.00);
  89.     timer = SetTimer("OnDateChange",5000,true);
  90.     Pickup = CreatePickup(1239, 1, 1480.2238,-1687.2345,14.0469,0);
  91.     Label = Create3DTextLabel("",-1,1480.2238,-1687.2345,14.0469,20,0,1);
  92.  
  93.     Kerze[0] = CreateObject(1877, 1478.35, -1684.85, 13.38,   0.00, 0.00, 0.00);
  94.     Kerze[1] = CreateObject(1877, 1482.08, -1684.98, 13.38,   0.00, 0.00, 0.00);
  95.  
  96.     Kerze[2] = CreateObject(1877, 1482.08, -1684.98, 14.08,   0.00, 0.00, 0.00);
  97.     Kerze[3] = CreateObject(1877, 1478.41, -1680.36, 13.38,   0.00, 0.00, 0.00);
  98.  
  99.     Kerze[4] = CreateObject(1877, 1478.41, -1680.36, 14.08,   0.00, 0.00, 0.00);
  100.     Kerze[5] = CreateObject(1877, 1482.53, -1680.42, 13.38,   0.00, 0.00, 0.00);
  101.  
  102.     Kerze[6] = CreateObject(1877, 1482.53, -1680.42, 14.08,   0.00, 0.00, 0.00);
  103.     Kerze[7] = CreateObject(1877, 1478.35, -1684.85, 14.08,   0.00, 0.00, 0.00);
  104.     return 1;
  105. }
  106.  
  107. public OnFilterScriptExit()
  108. {
  109.     DestroyObject(Baum);
  110.     DestroyPickup(Pickup);
  111.     Delete3DTextLabel(Label);
  112.     KillTimer(timer);
  113.     for(new i = 0; i < sizeof(Geschenk); i++)
  114.     {
  115.         DestroyObject(Geschenk[i]);
  116.     }
  117.     for(new i = 0; i <sizeof(Kerze); i++)
  118.     {
  119.         DestroyObject(Kerze[i]);
  120.     }
  121.     return 1;
  122. }
  123.  
  124. public OnDateChange()
  125. {
  126.     new datei[50];
  127.     format(datei,50,"/Advent.txt");
  128.     getdate(year, month, day);
  129.     if(month == 12)
  130.     {
  131.         if(day >= 1 && day <= 24)
  132.         {
  133.             new string[128];
  134.             format(string, 128, "Tippe {FF0037}'/advent' {FFFFFF}Um das Türchen des %dten Tag zu öffnen\nEs brennt die %dte",day,Advent);
  135.             Update3DTextLabelText(Label,-1,string);
  136.         }
  137.         if(day == 2)
  138.         {
  139.             dini_IntSet(datei,"Kerze",1);
  140.             CreateObject(18688,1478.290649,-1684.835205,13.156875,0,0,0);
  141.             Advent = 1;
  142.         }
  143.         if(day == 9)
  144.         {
  145.             dini_IntSet(datei,"Kerze",2);
  146.             CreateObject(18688,1481.993530,-1685.043334,13.106875,0,0,0);
  147.             Advent = 2;
  148.         }
  149.         if(day == 16)
  150.         {
  151.             dini_IntSet(datei,"Kerze",3);
  152.             CreateObject(18688,1482.502319,-1680.885620,13.116871,0,0,0);
  153.             Advent = 3;
  154.         }
  155.         if(day == 23)
  156.         {
  157.             dini_IntSet(datei,"Kerze",4);
  158.             CreateObject(18688,1478.336425,-1680.745117,13.076870,0,0,0);
  159.             Advent = 4;
  160.         }
  161.     }
  162.     return 1;
  163. }
  164.  
  165.  
  166.  
  167. CMD:advent(playerid,params[])
  168. {
  169.     #pragma unused params
  170.     if(IsPlayerInRangeOfPoint(playerid, 6, 1480.2238,-1687.2345,14.0469))
  171.     {
  172.         getdate(year, month, day);
  173.         if(GetPVarInt(playerid,"Geschenk") < day)
  174.         {
  175.             new mon = random(1000);
  176.             GivePlayerMoney(playerid,mon);
  177.             SetPlayerAttachedObject(playerid,0,19064,2,0.116999,0.014000,0.000000,80.299995,104.499984,1.700000,1.000000,1.000000,1.000000);
  178.             SetPVarInt(playerid,"Geschenk",day);
  179.             new string[24];
  180.             format(string, 24, "Du hast das Türchen zum %ten Advent Geöffnet und erhälst %d $",day,mon);
  181.             SendClientMessage(playerid, -1, string);
  182.  
  183.         }
  184.         else
  185.         {
  186.             SendClientMessage(playerid,-1,"Du hast bereits das Türchen für heute geöffnet!");
  187.         }
  188.     }
  189.     else
  190.     {
  191.         SendClientMessage(playerid, -1, "Du bist nicht am Advents Punkt!");
  192.     }
  193.     return 1;
  194. }
  195.  
  196.  
  197. public OnPlayerConnect(playerid)
  198. {
  199.     RemoveBuildingForPlayer(playerid, 1231, 1479.3828, -1692.3906, 15.6328, 0.25);
  200.     RemoveBuildingForPlayer(playerid, 1231, 1479.3828, -1682.3125, 15.6328, 0.25);
  201.     new name[24],datei[60];
  202.     GetPlayerName(playerid,name,24);
  203.     format(datei, 60, "/%s.txt",name);
  204.     getdate(year, month, day);
  205.     if(fexist(datei))
  206.     {
  207.         SetPVarInt(playerid,"Geschenk",dini_Int(datei,"Geschenk"));
  208.         if(GetPVarInt(playerid,"Geschenk") == day)
  209.         {
  210.             SetPlayerAttachedObject(playerid,0,19064,2,0.116999,0.014000,0.000000,80.299995,104.499984,1.700000,1.000000,1.000000,1.000000);
  211.         }
  212.     }
  213.     else
  214.     {
  215.         dini_Create(datei);
  216.         new d = day;
  217.         d --;
  218.         dini_IntSet(datei,"Geschenk",d);
  219.         SetPVarInt(playerid,"Geschenk",d);
  220.  
  221.     }
  222.     return 1;
  223. }
  224.  
  225. public OnPlayerDisconnect(playerid, reason)
  226. {
  227.     new name[24],datei[60];
  228.     GetPlayerName(playerid,name,24);
  229.     format(datei, 60, "/%s.txt",name);
  230.     dini_IntSet(datei,"Geschenk",GetPVarInt(playerid,"Geschenk"));
  231.     return 1;
  232. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement