I_M_Epic

Untitled

Sep 18th, 2017
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  new MoneyPickup,m;
  2.     new MoneyBagPay;
  3.     new town[128];
  4.     new location[128];
  5.     new nearest[128];
  6.     new nearestplayer,nearplayername[128];
  7.     new Float:distance;
  8.     new Float:x, Float:y, Float:z,Float:clos=20000.0;
  9.  
  10.  
  11.     new timer_mb_4;
  12.     new timer_mb_2;
  13.     new timer_mb_3;
  14.     new timer_mb_1;
  15.     new near_timer;
  16.  
  17.     new bool:iseventstarted = false;
  18.  
  19.     enum MoneyBagEnum
  20.     {
  21.             Float:X,
  22.             Float:Y,
  23.             Float:Z,
  24.             Pay,
  25.             area[128],
  26.             loc[128]
  27.     }
  28.     /*
  29.     INSTRUCTIONS - How To Add More Locations
  30.  
  31.     To add more moneybag locations to the script, you first need to load SAMP and use the
  32.     Samp command "/Save [name]" This will save your current Co-ords into a text file called
  33.     SavedPositions.Txt.
  34.  
  35.     Copy the X Y Z Cords and paste them into the first 3 sections. After that add the contents value.
  36.     Then the two clues which is Region and Area
  37.  
  38.     To make it easier I have added some already done for you.
  39.  
  40.     Enjoy :D
  41.     */
  42.     new MBagLocations[][MoneyBagEnum] =
  43.     {
  44.     //      {X CO-ORD,Y CO-ORD,Z CO-ORD,MONEY,"REGION SUCH AS SF/LS/LV","AREA SUCH AS DOHERTY/DOWNTOWN/WILLOWFIELD"},
  45.             {-2432.5957,-1620.1436,526.8685,21032,"San Fierro","Mt Chilliad"},
  46.             {-2528.2793,-1025.5176,102.1070,18076,"San Fierro","Mt Chilliad"},
  47.  
  48.             {-2172.0171,-1843.8499,214.7547,19056,"San Fierro","Mt Chilliad"},
  49.             {-2432.5957,-1620.1436,526.8685,21032,"San Fierro","Mt Chilliad"},
  50.             {-2528.2793,-1025.5176,102.1070,18076,"San Fierro","Mt Chilliad"},
  51.             {-8.2656,-266.3369,11.9437,16921,"San Fierro","Blueberry"},
  52.             {-2120.4558,-1300.9391,77.9728,22053,"San Fierro","Whetstone"},
  53.             {-1956.4731,764.5522,55.7254,13998,"San Fierro","Downtown"},
  54.             {-1963.7705,487.2920,31.9687,16098,"San Fierro","Downtown"},
  55.             {-2542.7930,-353.2107,37.0313,15666,"San Fierro","Avispa Country Club"},
  56.             {-1509.4563,1370.2919,3.0108,18223,"San Fierro","Esplande East"},
  57.             {-2189.1086,-269.0943,40.7195,24012,"San Fierro","Doherty"},
  58.             {-1933.9781,211.7276,25.3226,16908,"San Fierro","Doherty"},
  59.             {-2576.5107,1187.6368,41.8775,21087,"San Fierro","Paradiso"},
  60.             {2667.6277,2307.3535,24.0614,29872,"San Fierro","Bayside"},
  61.             {-1074.6843,-1234.5952,129.2188,25112,"San Fierro","The Farm"},
  62.             {-2807.5503,1162.7417,20.3125,19729,"San Fierro","Palisades"},
  63.             {-2268.7791,2664.1946,73.5156,14309,"San Fierro","Tierra Robada"},
  64.             {-1205.4790,-2349.8513,2.0340,39112,"Los Santos","Red County"},
  65.             {-743.1037,-1933.7535,7.9191,14098,"Los Santos","Back-O-Beyond"},
  66.             {471.4406,-269.6804,7.3002,41022,"Los Santos","Red County"},
  67.             {1271.9558,295.4855,20.6563,21011,"Los Santos","Montgomery"},
  68.             {2189.4036,-697.5020,56.4319,39012,"Los Santos","Red County"},
  69.             {2372.1699,-2135.6299,27.1750,28765,"Los Santos","Ocean Docks"},
  70.             {2274.2246,-2563.0544,19.9043,29052,"Los Santos","Ocean Docks"},
  71.             {1926.8618,-2692.0869,19.3672,11098,"Los Santos","Los Santos International"},
  72.             {1024.0765,-313.3355,73.9931,22098,"Los Santos","Hilltop Farm"},
  73.             {1629.1864,7.0049,9.2344,26543,"Los Santos","Red County"},
  74.             {2146.2021,94.8287,27.1627,17609,"Los Santos","Palomino Creek"},
  75.             {2634.9646,263.1964,54.3462,15489,"Los Santos","Hankypanky Point"},
  76.             {2581.4714,-1473.8392,24.0000,13062,"Los Santos","East Los Santos"},
  77.             {2438.9673,-1901.5713,13.5534,17822,"Los Santos","Willowfield"},
  78.             {2476.8198,-1972.9170,16.6281,15809,"Los Santos","Willowfield"},
  79.             {2545.9392,-2248.8154,13.5469,23091,"Los Santos","Ocean Docks"},
  80.             {836.7835,-1856.7886,8.3893,8092,"Los Santos","Verona Beach"},
  81.             {664.9876,-1380.3512,21.8417,19872,"Los Santos","Vinewood"},
  82.             {588.3129,-1555.4790,15.6424,20112,"Los Santos","Rodeo"},
  83.             {459.0752,-1276.6705,15.4114,19221,"Los Santos","Richman"},
  84.             {770.7070,-1084.6780,24.0859,22041,"Los Santos","Richman"},
  85.             {1435.1244,-1093.3391,17.5879,16822,"Los Santos","Downtown"},
  86.             {2792.7664,698.0993,9.8893,23659,"Las Venturas","Rockshore East"},
  87.             {2892.5449,948.4681,10.6730,39621,"Las Venturas","Linden Side"},
  88.             {2345.3472,1293.8081,67.4688,27001,"Las Venturas","The Camels Toe"},
  89.             {2243.4036,1131.7672,10.8203,26822,"Las Venturas","Come-A-Lot"},
  90.             {-781.4629,2147.3931,60.3828,28711,"Las Venturas","Sherman Dam"},
  91.             {-86.8024,2642.1128,58.6177,36081,"Las Venturas","Bone County"},
  92.             {384.6790,2435.0015,16.5000,22901,"Las Venturas","Verdant Meadows"},
  93.             {826.2070,2665.7825,28.9297,40921,"Las Venturas","Bone County"},
  94.             {1047.2354,2921.5979,48.3125,50982,"Las Venturas","Las Venturas"},
  95.             {1400.8108,2767.2092,10.8203,51091,"Las Venturas","Las Venturas"},
  96.             {2465.7429,2226.0747,10.8203,25002,"Las Venturas","Roca Escalante"},
  97.             {2479.1763,1921.0494,10.4679,24069,"Las Venturas","Starfish Casino"},
  98.             {1765.3286,592.7733,13.0000,18092,"Las Venturas","Red County"},
  99.             {586.6403,392.7565,15.8715,1922,"Las Venturas","Fallow Bridge"},
  100.             {1407.5444,2142.0837,12.0156,19112,"Las Venturas","Redsands West"},
  101.             {2626.3064,2417.3677,10.8132,10921,"Las Venturas","Julius Thruway East"},
  102.             {2879.5156,1595.7340,10.8203,11092,"Las Venturas","Sobell Rail Yards"},
  103.             {2819.0471,1670.2314,10.8203,11021,"Las Venturas","Sobell Rail Yards"}
  104.     };
  105.  
  106.     forward moneybag1();
  107.     forward moneybag2();
  108.     forward moneybag3();
  109.     forward moneybag4();
  110.     forward findnear();
  111.  
  112.  
  113.  
  114.     public OnPlayerRequestClass(playerid, classid)
  115.     {
  116.             SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  117.             SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  118.             SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  119.             return 1;
  120.     }
  121.  
  122.     public OnPlayerConnect(playerid)
  123.     {
  124.             return 1;
  125.     }
  126.  
  127.     public OnPlayerDisconnect(playerid, reason)
  128.     {
  129.             return 1;
  130.     }
  131.  
  132.     public OnPlayerSpawn(playerid)
  133.     {
  134.             return 1;
  135.     }
  136.  
  137.     public OnPlayerDeath(playerid, killerid, reason)
  138.     {
  139.             return 1;
  140.     }
  141.  
  142.     public OnVehicleSpawn(vehicleid)
  143.     {
  144.             return 1;
  145.     }
  146.  
  147.     public OnVehicleDeath(vehicleid, killerid)
  148.     {
  149.             return 1;
  150.     }
  151.  
  152.     public OnPlayerText(playerid, text[])
  153.     {
  154.             return 1;
  155.     }
  156.  
  157.     public OnPlayerCommandText(playerid, cmdtext[])
  158.     {
  159.             if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  160.             {
  161.                     // Do something here
  162.                     return 1;
  163.             }
  164.             return 0;
  165.     }
  166.  
  167.     public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  168.     {
  169.             return 1;
  170.     }
  171.  
  172.     public OnPlayerExitVehicle(playerid, vehicleid)
  173.     {
  174.             return 1;
  175.     }
  176.  
  177.     public OnPlayerStateChange(playerid, newstate, oldstate)
  178.     {
  179.             return 1;
  180.     }
  181.  
  182.     public OnPlayerEnterCheckpoint(playerid)
  183.     {
  184.             return 1;
  185.     }
  186.  
  187.     public OnPlayerLeaveCheckpoint(playerid)
  188.     {
  189.             return 1;
  190.     }
  191.  
  192.     public OnPlayerEnterRaceCheckpoint(playerid)
  193.     {
  194.             return 1;
  195.     }
  196.  
  197.     public OnPlayerLeaveRaceCheckpoint(playerid)
  198.     {
  199.             return 1;
  200.     }
  201.  
  202.     public OnRconCommand(cmd[])
  203.     {
  204.             return 1;
  205.     }
  206.  
  207.     public OnPlayerRequestSpawn(playerid)
  208.     {
  209.             return 1;
  210.     }
  211.  
  212.     public OnObjectMoved(objectid)
  213.     {
  214.             return 1;
  215.     }
  216.  
  217.     public OnPlayerObjectMoved(playerid, objectid)
  218.     {
  219.             return 1;
  220.     }
  221.  
  222.     public OnPlayerPickUpPickup(playerid, pickupid)
  223.     {
  224.             return 1;
  225.     }
  226.  
  227.     public OnVehicleMod(playerid, vehicleid, componentid)
  228.     {
  229.             return 1;
  230.     }
  231.  
  232.     public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  233.     {
  234.             return 1;
  235.     }
  236.  
  237.     public OnVehicleRespray(playerid, vehicleid, color1, color2)
  238.     {
  239.             return 1;
  240.     }
  241.  
  242.     public OnPlayerSelectedMenuRow(playerid, row)
  243.     {
  244.             return 1;
  245.     }
  246.  
  247.     public OnPlayerExitedMenu(playerid)
  248.     {
  249.             return 1;
  250.     }
  251.  
  252.     public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  253.     {
  254.             return 1;
  255.     }
  256.  
  257.     public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  258.     {
  259.             return 1;
  260.     }
  261.  
  262.     public OnRconLoginAttempt(ip[], password[], success)
  263.     {
  264.             return 1;
  265.     }
  266.  
  267.     public OnPlayerUpdate(playerid)
  268.     {
  269.             return 1;
  270.     }
  271.  
  272.     public OnPlayerStreamIn(playerid, forplayerid)
  273.     {
  274.             return 1;
  275.     }
  276.  
  277.     public OnPlayerStreamOut(playerid, forplayerid)
  278.     {
  279.             return 1;
  280.     }
  281.  
  282.     public OnVehicleStreamIn(vehicleid, forplayerid)
  283.     {
  284.             return 1;
  285.     }
  286.  
  287.     public OnVehicleStreamOut(vehicleid, forplayerid)
  288.     {
  289.             return 1;
  290.     }
  291.  
  292.     public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  293.     {
  294.             return 1;
  295.     }
  296.  
  297.     public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  298.     {
  299.             return 1;
  300.     }
  301.  
  302.     public OnPlayerPickUpDynamicPickup(playerid, pickupid)
  303.     {
  304.             if(pickupid == MoneyPickup)
  305.             {
  306.                     new str[128];
  307.                     new str2[128];
  308.                     new Name[MAX_PLAYER_NAME];
  309.                     GetPlayerName(playerid, Name, sizeof(Name));
  310.                     format(str,sizeof(str),"%s(%d)has found the Moneybag And Recieved %i!",Name,playerid,MoneyBagPay);
  311.                     SendClientMessageToAll(0xffccffaa,str);
  312.                     format(str2,sizeof(str2),"You Found ~n~The MoneyBag ~n~And Got ~g~$%i",MoneyBagPay);
  313.                     GivePlayerMoney(playerid,MoneyBagPay);
  314.                     GameTextForPlayer(playerid,str2,3000,4);
  315.                     DestroyDynamicPickup(MoneyPickup);//used to remove pickup
  316.                     KillTimer(timer_mb_1);
  317.                     KillTimer(timer_mb_2);
  318.                     KillTimer(timer_mb_3);
  319.                     KillTimer(timer_mb_4);
  320.                     KillTimer(near_timer);
  321.                     return 1;
  322.             }
  323.             else
  324.             {
  325.                     printf("Unknown Pickup Detected. Please Check Your Code");
  326.                     return 1;
  327.             }
  328.  
  329.     }
  330.  
  331.     public moneybag1()
  332.     {
  333.             SendClientMessageToAll(0xffccffaa,town);
  334.             timer_mb_2=SetTimer("moneybag2", 60*3000, false);
  335.     }
  336.     public moneybag2()
  337.     {
  338.             SendClientMessageToAll(0xffccffaa,location);
  339.             timer_mb_3=SetTimer("moneybag3", 60*3000, false);
  340.     }
  341.     public moneybag3()
  342.     {       foreach(m:Player)
  343.                         {distance=GetPlayerDistanceFromPoint(m,x,y,z);
  344.                          if(distance < clos)
  345.                          {
  346.                          GetPlayerName(m,nearplayername,128);
  347.                          clos=distance;
  348.                          nearestplayer=m;
  349.                         }}
  350.                         format(nearest,128,"%s(%i) is currently located nearest to the hidden money bag.",nearplayername,nearestplayer);
  351.             SendClientMessageToAll(0xffccffaa,nearest);
  352.             timer_mb_4=SetTimer("moneybag4", 60*3000, false);
  353.             near_timer=SetTimer("findnear",5,true);//change the value here for updating closest player time
  354.     }
  355.    
  356.     public findnear()
  357.     {foreach(m:Player)
  358.                         {distance=GetPlayerDistanceFromPoint(m,x,y,z);
  359.                          if(distance < clos)
  360.                          {
  361.                          GetPlayerName(m,nearplayername,128);
  362.                          clos=distance;
  363.                          nearestplayer=m;
  364.  
  365.                         }}
  366.                         format(nearest,128,"%s(%i) is currently located nearest to the hidden money bag.",nearplayername,nearestplayer);
  367.     }
  368.  
  369.  
  370.     public moneybag4()
  371.     {
  372.             SendClientMessageToAll(0xffccffaa,"Nobody Collected The MoneyBag. It Has Been Eaten By A Deer");
  373.             DestroyDynamicPickup(MoneyPickup);//used to remove pickup
  374.             iseventstarted = false;
  375.             KillTimer(near_timer);
  376.             return 1;
  377.     }
  378.    
  379.     /* You Will Need To Edit This Command To Work With Your Admin Script */
  380.     CMD:moneybag(playerid,params[])
  381.     {
  382.     //I dont know your admin script so Edit this to allow your admin(s) to use the command
  383.         //if(PlayerInfo[playerid][Admin] >= 1)
  384.   //{
  385.             if(iseventstarted == true)SendClientMessage(playerid,0xff0000ff,"The MoneyBag Event Has Already Started");
  386.             else
  387.             {
  388.                     DestroyDynamicPickup(MoneyPickup); //used to remove last pickup used
  389.                     new Rand = random(sizeof(MBagLocations));
  390.                     x = MBagLocations[Rand][X];
  391.                     y = MBagLocations[Rand][Y];
  392.                     z = MBagLocations[Rand][Z];
  393.                     MoneyBagPay = MBagLocations[Rand][Pay];
  394.                     MoneyPickup = CreateDynamicPickup(1550, 2,x,y,z, -1, -1, -1, 1000.0);
  395.                     SendClientMessageToAll(0xffccffaa,"The Money Bag Event Has Started.");
  396.                     format(town,128, "The Money Bag Is Nearest To %s",MBagLocations[Rand][area]);
  397.                     format(location, 128, "The Money Bag Is In %s",MBagLocations[Rand][loc]);
  398.                     timer_mb_1=SetTimer("moneybag1", 60*3000, false);
  399.                     iseventstarted = true;
  400.             }
  401.  
  402.  // }
  403.             return 1;
  404.     }
  405.     // Debug / Admin Command. By Default It Will Not Be Accesible To None RCON Admins
  406. /*
  407.  
  408.     CMD:clue(playerid,params[])
  409.     {
  410.             SendClientMessage(playerid,0xffccffaa,town);
  411.             SendClientMessage(playerid,0xffccffaa,location);
  412.             return 1;
  413.     }
Advertisement
Add Comment
Please, Sign In to add comment