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