Advertisement
Guest User

S-Giftbox by simo0000

a guest
Jul 13th, 2015
988
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.09 KB | None | 0 0
  1. /*--S-Giftbox created by simo0000*/
  2.  
  3. #include            <a_samp>
  4. #include            <streamer>
  5. #include            <sscanf2>
  6. #include            <zcmd>
  7. #define COLOR_YELLOW 0xFFFF00AA
  8. #define COLOR_RED 0xAA3333AA
  9.  
  10. #define MAX_RANDOM_GIFTS 3
  11.  
  12. public OnFilterScriptInit()
  13. {
  14.     print("\n--------------------------------------");
  15.     print("S-AFK system by simo0000 is loaded.");
  16.     print("--------------------------------------\n");
  17.     return 1;
  18. }
  19.  
  20. #pragma tabsize 0
  21.  
  22.  
  23. stock RandomGift(playerid)
  24. {
  25.     new randomgift = random(MAX_RANDOM_GIFTS) + 1;
  26.     switch (randomgift)
  27.     {
  28.         case 1:
  29.         {
  30.             GivePlayerMoney(playerid, 50000);
  31.             SendClientMessage(playerid, COLOR_YELLOW, "You have won 50000$ enjoy!.");
  32.         }
  33.         case 2:
  34.         {
  35.             GivePlayerMoney(playerid, 10000);
  36.             SendClientMessage(playerid, COLOR_YELLOW, "You have won 10000$ enjoy!.");
  37.         }
  38.         case 3:
  39.         {
  40.             SetPlayerArmour(playerid, 100);
  41.             SendClientMessage(playerid, COLOR_YELLOW, "You have a vest enjoy!.");
  42.         }
  43.     }
  44.     return 1;
  45. }
  46.  
  47.  
  48. new Float:giftPos[4];
  49. new giftboxobject;
  50. new giftboxcreated = 0;
  51. new Text3D:giftbox3DText;
  52.  
  53.  
  54. CMD:giftbox(playerid, params[])
  55. {
  56.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not an admin!");
  57.     if (isnull(params))
  58.     {
  59.         SendClientMessage(playerid, -1, "/giftbox [Option]");
  60.         SendClientMessage(playerid, COLOR_YELLOW, "[OPTIONS]: place, destroy");
  61.         return 1;
  62.     }
  63.     static
  64.         Float:X,
  65.         Float:Y,
  66.         Float:Z,
  67.         Float:A;
  68.  
  69.     GetPlayerPos(playerid, X, Y, Z);
  70.     GetPlayerFacingAngle(playerid, A);
  71.  
  72.     if (!strcmp(params, "place", true))
  73.     {
  74.         if (IsPlayerInAnyVehicle(playerid))
  75.             return SendClientMessage(playerid, COLOR_RED, "You must be outside vehicle first.");
  76.         if(giftboxcreated == 1) return SendClientMessage(playerid, COLOR_RED, "Giftbox is already placed.");
  77.             giftPos[0] = X;
  78.             giftPos[1] = Y;
  79.             giftPos[2] = Z;
  80.             giftboxcreated = 1;
  81.             giftboxobject = CreateDynamicObject(19054, X, Y, Z - 0.4, 0.0, 0.0, A);
  82.             giftbox3DText = CreateDynamic3DTextLabel("/getgift\nTo get your gift.",0x10F441AA,X, Y, Z+0.25,8.0);
  83.             SendClientMessage(playerid, -1, "You have placed a giftbox");
  84.             return 1;
  85.     }
  86.    
  87.     if (!strcmp(params, "destroy", true))
  88.     {
  89.      if(giftboxcreated == 0) return SendClientMessage(playerid, COLOR_RED, "Giftbox is not placed yet.");
  90.             DestroyDynamicObject(giftboxobject);
  91.             DestroyDynamic3DTextLabel(giftbox3DText);
  92.             giftboxcreated = 0;
  93.             SendClientMessage(playerid, -1, "You have destoryed the giftbox");
  94.             return 1;
  95.     }
  96.     return 1;
  97. }
  98.  
  99. CMD:getgift(playerid)
  100. {
  101.     if(!IsPlayerConnected(playerid))
  102.         return SendClientMessage(playerid, -1, "You must be logged in to do this.");
  103.  
  104.     GetObjectPos(giftboxobject, giftPos[0], giftPos[1], giftPos[2]);
  105.    
  106.     if(IsPlayerInRangeOfPoint(playerid, 5.0, giftPos[0], giftPos[1], giftPos[2]) && giftboxcreated == 1)
  107.     {
  108.     RandomGift(playerid);
  109.     }
  110.     return 1;
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement