Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*------------------------------------------------------------------------------
- 'BestAim' Minigame
- - You have 30 seconds to hit as many objects as possible. It counts how many objects you hit.
- ------------------------------------------------------------------------------*/
- #include <a_samp>
- #include <streamer>
- #include <zcmd>
- #include <dini>
- #define FILTERSCRIPT
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_GREEN 0x33AA33AA
- forward StartAimMG(playerid);
- forward EndAimMG(playerid);
- //------------------------------------------------------------------------------
- public OnFilterScriptInit()
- {
- CreateDynamicObject(6959, -1022.1649, 2978.9646, 15.23726, 0, 0, 0);
- CreateDynamicObject(6959, -1022.1691, 2958.9819, 12.49946, 90, 0, 0);
- CreateDynamicObject(6959, -1022.1589, 2998.73, 12.49946, 90, 0, 0);
- CreateDynamicObject(6959, -1001.6608, 2978.5088, 12.49946, 90, 0, 270);
- CreateDynamicObject(6959, -1042.4482, 2978.9543, 12.49946, 90, 0, 270);
- CreateDynamicObject(971, -1019.2831, 2994.3704, 18.76093, 0, 0, 270);
- CreateDynamicObject(971, -1019.2791, 2985.5342, 18.76093, 0, 0, 270);
- CreateDynamicObject(971, -1019.2825, 2976.6917, 18.76093, 0, 0, 270);
- CreateDynamicObject(971, -1014.8792, 2972.2932, 18.76093, 0, 0, 0);
- CreateDynamicObject(971, -1006.023, 2972.2817, 18.76093, 0, 0, 0);
- CreateDynamicObject(2180, -1018.6847, 2982.6489, 15.20601, 0, 0, 0);
- CreateDynamicObject(2180, -1016.7241, 2982.6563, 15.20601, 0, 0, 0);
- CreateDynamicObject(2180, -1014.769, 2982.6636, 15.20601, 0, 0, 0);
- CreateDynamicObject(2180, -1012.8085, 2982.6641, 15.20601, 0, 0, 0);
- CreateDynamicObject(2180, -1010.8498, 2982.6641, 15.20601, 0, 0, 0);
- CreateDynamicObject(2180, -1008.8862, 2982.6641, 15.20601, 0, 0, 0);
- CreateDynamicObject(2180, -1006.9288, 2982.6641, 15.20601, 0, 0, 0);
- CreateDynamicObject(2180, -1004.9717, 2982.6641, 15.20601, 0, 0, 0);
- CreateDynamicObject(2180, -1003.0129, 2982.6641, 15.20601, 0, 0, 0);
- CreateDynamicObject(3657, -1037.9402, 2975.3809, 15.72422, 0, 0, 0);
- CreateDynamicObject(3657, -1034.2484, 2975.3809, 15.72422, 0, 0, 0);
- CreateDynamicObject(3657, -1030.5594, 2975.3796, 15.72422, 0, 0, 0);
- CreateDynamicObject(3657, -1026.8669, 2975.3787, 15.72422, 0, 0, 0);
- CreateDynamicObject(3657, -1037.932, 2976.2275, 15.72422, 0, 0, 180);
- CreateDynamicObject(3657, -1034.2452, 2976.2268, 15.72422, 0, 0, 179.995);
- CreateDynamicObject(3657, -1030.5593, 2976.2258, 15.72422, 0, 0, 179.995);
- CreateDynamicObject(3657, -1026.8698, 2976.2249, 15.72422, 0, 0, 179.995);
- CreateDynamicObject(1360, -1024.9982, 2962.6099, 15.97803, 0, 0, 0);
- CreateDynamicObject(1360, -1025.0029, 2965.3311, 15.97803, 0, 0, 0);
- CreateDynamicObject(1364, -1029.8301, 2960.2063, 15.99013, 0, 0, 180);
- CreateDynamicObject(1360, -1034.9595, 2962.752, 15.97803, 0, 0, 0);
- CreateDynamicObject(1360, -1034.9412, 2965.4548, 15.97803, 0, 0, 0);
- CreateDynamicObject(1361, -1030.0675, 2967.5332, 15.94935, 0, 0, 0);
- CreateDynamicObject(2599, -1040.2933, 2975.7778, 15.66972, 0, 0, 0);
- CreateDynamicObject(2745, -1024.5011, 2980.425, 16.41463, 0, 0, 0);
- CreateDynamicObject(2745, -1040.5854, 2980.1987, 16.41463, 0, 0, 0);
- CreateDynamicObject(4731, -1031.0397, 2998.6316, 19.33885, 0, 0, 30.25);
- CreateDynamicObject(4238, -1042.3098, 2979.0171, 24.38178, 0, 0, 120.25);
- CreateDynamicObject(4731, -1030.9341, 2959.0835, 19.33885, 0, 0, 210.245);
- CreateDynamicObject(16151, -1002.7093, 2965.6318, 15.20601, 0, 0, 0.5);
- CreateDynamicObject(1726, -1010.1022, 2963.3545, 15.20601, 0, 0, 0);
- CreateDynamicObject(1727, -1011.5054, 2961.0471, 15.20601, 0, 0, 90);
- CreateDynamicObject(2311, -1009.7652, 2961.4856, 15.20601, 0, 0, 0);
- CreateDynamicObject(1726, -1007.9939, 2959.699, 15.20601, 0, 0, 180);
- CreateDynamicObject(1726, -1006.4829, 2962.4402, 15.20601, 0, 0, 270);
- CreateDynamicObject(2311, -1012.3929, 2968.1448, 15.20601, 0, 0, 0);
- CreateDynamicObject(1726, -1012.6633, 2969.7253, 15.20601, 0, 0, 0);
- CreateDynamicObject(1726, -1010.6631, 2966.5469, 15.20601, 0, 0, 179.995);
- CreateDynamicObject(1726, -1009.3495, 2969.1506, 15.20601, 0, 0, 270);
- CreateDynamicObject(1726, -1013.7789, 2967.0437, 15.20601, 0, 0, 90);
- return 1;
- }
- new ObjectHitCount[MAX_PLAYERS],
- BestAimRun,
- BestAimObject,
- InBestAim[MAX_PLAYERS],
- PlayerText:TObjectHit[MAX_PLAYERS];
- //------------------------------------------------------------------------------
- CMD:bestaim(playerid,params[])
- {
- SetPlayerPos(playerid,-1034.8854,2971.0862,16.2060);
- SetPlayerFacingAngle(playerid,270);
- SendClientMessage(playerid,COLOR_ORANGE,")_Welcome to the 'BestAim' area. TIP: With c-bug you will be faster_(");
- SendClientMessage(playerid,COLOR_ORANGE,"-> Use /startaim if you want to start the minigame.");
- return 1;
- }
- CMD:startaim(playerid,params[])
- {
- if(BestAimRun == 1)return SendClientMessage(playerid,COLOR_GREEN,"SERVER: BestAim Minigame is already running, wait until it ends.");
- SetTimerEx("StartAimMG", 3000, false, "i", playerid);
- SetPlayerPos(playerid,-1010.1898,2979.0808,16.2060);
- ResetPlayerWeapons(playerid);
- GivePlayerWeapon(playerid,24,500);
- SetPlayerFacingAngle(playerid,0);
- TogglePlayerControllable(playerid,0);
- ObjectHitCount[playerid] = 0;
- GameTextForPlayer(playerid,"~g~Ready, Steady",2000,4);
- BestAimRun = 1;
- InBestAim[playerid] = 1;
- BestAimObject = CreateDynamicObject(3497, -1016.5088, 2999.0059, 15.68677, 0, 0, 0);
- TObjectHit[playerid] = CreatePlayerTextDraw(playerid,500,150,"HIT COUNT");
- PlayerTextDrawShow(playerid,TObjectHit[playerid]);
- return 1;
- }
- //------------------------------------------------------------------------------
- new Float:RandomObjectPosition[][] =
- {
- { -1012.5088, 2999.0059, 15.67517},
- {-1008.5088, 2999.0059, 15.67517},
- {-1004.5088, 2999.0059, 15.68097},
- {-1016.5088, 2999.0059, 17.18677},
- {-1016.5088, 2999.0059, 18.68677},
- {-1012.5088, 2999.0059, 18.67517},
- {-1012.5088, 2999.0059, 17.17517},
- {-1008.5088, 2999.0059, 18.67517},
- {-1008.5088, 2999.0059, 17.17517},
- {-1004.5088, 2999.0059, 18.68097},
- {-1004.5088, 2999.0059, 17.18097}
- };
- public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
- {
- new RandPos = random(sizeof(RandomObjectPosition));
- if(InBestAim[playerid] == 1)
- {
- if(hittype == 4)
- {
- if(hitid == BestAimObject)
- {
- ++ObjectHitCount[playerid];
- new string[128];
- format(string,sizeof(string),"Hit Objects: %i",ObjectHitCount[playerid]);
- PlayerTextDrawSetString(playerid,TObjectHit[playerid],string);
- DestroyDynamicObject(BestAimObject);
- BestAimObject = CreateDynamicObject(3497,RandomObjectPosition[RandPos][0],RandomObjectPosition[RandPos][1],RandomObjectPosition[RandPos][2],0,0,0);
- }
- }
- }
- return 1;
- }
- //------------------------------------------------------------------------------
- public StartAimMG(playerid)
- {
- TogglePlayerControllable(playerid,1);
- SetTimerEx("EndAimMG", 30000, false, "i", playerid);
- GameTextForPlayer(playerid,"~b~GO GO GO",2000,4);
- PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
- return 1;
- }
- public EndAimMG(playerid)
- {
- if(ObjectHitCount[playerid] > dini_Int("/BestAim/BestAim.txt","RecordAmount"))
- {
- new string[128];
- SetPlayerPos(playerid,-1025.7495,2992.4087,16.4060);
- dini_Set("/BestAim/BestAim.txt","RecordHolder",PlayerName(playerid));
- dini_IntSet("/BestAim/BestAim.txt","RecordAmount",ObjectHitCount[playerid]);
- format(string,sizeof(string),")_{FF9900}%s {33CCFF}has set a new record at the 'BestAim' Minigame with {FF9900}>> %i << {33CCFF}hits_(",PlayerName(playerid),ObjectHitCount[playerid]);
- SendClientMessageToAll(COLOR_LIGHTBLUE,string);
- BestAimRun = 0;
- InBestAim[playerid] = 0;
- DestroyDynamicObject(BestAimObject);
- PlayerTextDrawDestroy(playerid,TObjectHit[playerid]);
- }
- else
- {
- new string[128],string2[128];
- SetPlayerPos(playerid,-1025.7495,2992.4087,16.4060);
- format(string,sizeof(string),")_{FF9900}%s{33CCFF} finished the 'BestAim' Minigame with{FF9900} >> %i << {33CCFF}hit objects_(",PlayerName(playerid),ObjectHitCount[playerid]);
- SendClientMessageToAll(COLOR_LIGHTBLUE,string);
- format(string2,sizeof(string2),")_Recordholder is {FF9900}%s{33CCFF} with {FF9900}%i {33CCFF}hits_(",dini_Get("/BestAim/BestAim.txt","RecordHolder"),dini_Int("/BestAim/BestAim.txt","RecordAmount"));
- SendClientMessageToAll(COLOR_LIGHTBLUE,string2);
- BestAimRun = 0;
- InBestAim[playerid] = 0;
- DestroyDynamicObject(BestAimObject);
- PlayerTextDrawDestroy(playerid,TObjectHit[playerid]);
- }
- return 1;
- }
- //------------------------------------------------------------------------------
- public OnPlayerDisconnect(playerid,reason)
- {
- ObjectHitCount[playerid] = 0;
- InBestAim[playerid] = 0;
- return 1;
- }
- //------------------------------------------------------------------------------
- stock PlayerName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment