SHARE
TWEET

DM Event [Friendly, Lovely, Simple]

a guest May 16th, 2017 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #if defined DME
  2.  
  3.                  Death Match Event System By RxErT!
  4.                        First Version: 1.0
  5.                  
  6. #endif
  7.  
  8.  
  9. //====== INCLUDES & DEFINES =======//
  10. #include <a_samp>
  11. #include <zcmd>
  12. #include <sscanf>
  13. #define SCM    SendClientMessage //defining SendClientMessage to be more easier to write it and to stop wasting time in writing it completely.
  14. #define SCMTA  SendClientMessageToAll //same to SendClientMessage's story.
  15.  
  16. //======== EVENT VARIABLES =========//
  17. new InEvent[MAX_PLAYERS]; //Checking player if he is in/out event.
  18. new EventOpened[MAX_PLAYERS]; //Checking if Event is opened to join it.
  19. new weapon; //Weapon variable.
  20. new Float:RandomEventSpawns[][] =
  21. {
  22.     {-1351.4404,27.2709,14.1484,229.3567},
  23.     {-1270.1122,-52.0604,14.1484,44.1982},
  24.     {-1284.0488,13.3623,14.1484,132.5356}
  25. }; //This is Random Event spawns.
  26.  
  27. //======== FORWARD =========//
  28. forward EventStart(); //we did forwarded this as timer to event stats.
  29.  
  30.  
  31. //======= COMMANDS AND MAP AND EVENT THINGYS GOES HERE! ========//
  32. CMD:dmevent(playerid, params[])
  33. {
  34.  if(IsPlayerAdmin(playerid))
  35.  {
  36.    if(EventOpened[playerid] == 0)
  37.    {
  38.    new string[128];
  39.    if(sscanf(params,"i",weapon)) return SCM(playerid,-1,"{fdfe1d}Syntax: {FFFFFF}/dmevent <weaponid>");
  40.    if(weapon < 0 || weapon > 46) return SCM(playerid,-1,"{f00f00}[ERROR]: {F00f00}Invalid WeaponID");
  41.    EventOpened[playerid] = 1;
  42.    SCMTA(-1,"{800080}[EVENT INFO] {fef65b}An Administrator has opened a DM Event!");
  43.    format(string,sizeof(string),"{800080}[EVENT INFO] {fef65b}Type {2faced}/joindm {fef65b}to join the DM Event! {F00f00}(Weapon: %d)",weapon);
  44.    SCMTA(-1,string);
  45.    GameTextForAll("~R~DM ~W~EVENT ~G~OPENED!",3000,3);
  46.    SetTimerEx("EventStart", 1000, false, "i", playerid);
  47.    }
  48.    else
  49.    {
  50.    if(EventOpened[playerid] == 1)
  51.    {
  52.    SCMTA(-1,"{800080}[EVENT INFO] {fef65b}An Administrator has closed the DM Event!");
  53.    GameTextForAll("~R~DM ~W~EVENT ~R~CLOSED!",3000,3);
  54.    EventOpened[playerid] = 0;
  55.    }
  56.    }
  57.  }
  58.  else
  59.  {
  60.  SCM(playerid, -1,"{F00f00}[ERROR]: {FFFFFF}You aren't authorized to use this command!");
  61.  }
  62.  return 1;
  63. }
  64.  
  65.  
  66. CMD:fire(playerid,params[])
  67. {
  68.    new string[128];
  69.    new ID;
  70.    new tname[MAX_PLAYER_NAME];
  71.    GetPlayerName(ID, tname,sizeof(tname));
  72.    if(sscanf(params,"ii",ID,params)) return SCM(playerid,-1,"{fdfe1d}Syntax: {FFFFFF}/fire <id> <reason>");
  73.    if(!IsPlayerAdmin(playerid)) return  SCM(playerid, -1, "{F00f00}[ERROR]: {FFFFFF}You are not authorized to use this command!");
  74.    if(!IsPlayerConnected(ID)) return SCM(playerid, -1, "{f00f00}[ERROR]: {FFFFFF}Player isn't connected!");
  75.    if(InEvent[ID] == 0) return SCM(playerid, -1, "{f00f00}[ERROR]: {FFFFFF}Player isn't in the DM Event!");
  76.    format(string,sizeof(string),"{800080}[EVENT FIRE] {Fef65b}%s has been fired from the DM Event! {f00f00}[REASON: %d]",tname,params);
  77.    SCMTA(-1,string);
  78.    InEvent[ID] = 0;
  79.    SpawnPlayer(ID);
  80.    return 1;
  81. }
  82.  
  83.  
  84. CMD:joindm(playerid,params[])
  85. {
  86.        if(InEvent[playerid] == 1) return SendClientMessage(playerid,-1,"{f00f00}[ERROR]: {FFFFFF}You're already in the DM Event!");
  87.        if(EventOpened[playerid] == 0) return SendClientMessage(playerid, -1,"{f00f00}[ERROR]: {FFFFFF}there isn't any DM Event At moment!");
  88.        new Random = random(sizeof(RandomEventSpawns));
  89.        SetPlayerPos(playerid,RandomEventSpawns[Random][0], RandomEventSpawns[Random][1], RandomEventSpawns[Random][2]);
  90.        TogglePlayerControllable(playerid, 0);
  91.        ResetPlayerWeapons(playerid);
  92.        GivePlayerWeapon(playerid, weapon, 99999);
  93.        SetPlayerArmour(playerid, 100);
  94.        SetPlayerHealth(playerid, 100);
  95.        InEvent[playerid] = 1;
  96.        SCM(playerid, -1,"{800080}[EVENT INFO] {fef65b}You Have Joined the DM Event!");
  97.        GameTextForPlayer(playerid, "~W~Event Will Start in ~P~Minutes!",3000,3);
  98.        return 1;
  99. }
  100.        
  101. CMD:startdm(playerid, params[])
  102. {
  103. for(new i = 0; i<MAX_PLAYERS; i++)
  104. {
  105. if(IsPlayerConnected(i))
  106. {
  107. TogglePlayerControllable(i, 1);
  108. SCMTA(-1,"{800080}[EVENT STARTED] {fef65b}An Administrator has Started the DM Event!");
  109. GameTextForPlayer(i, "~W~EVENT ~Y~HAS ~G~BEEN ~B~STARTED!",3000,3);
  110. if(!IsPlayerAdmin(playerid)) return SCM(playerid, -1, "{f00f00}[ERROR]: {FFFFFF}You are not authorized to use this command!");
  111. EventOpened[playerid] = 0;
  112. InEvent[playerid] = 1;
  113. }
  114. }
  115. return 1;
  116. }
  117.  
  118. public EventStart()
  119. {
  120. CreateObject(3453, -1221.230957, 432.340606, 9.336962, 0.000000, 0.000000, 0.000000);
  121. CreateObject(3452, -1215.755615, 460.229461, 9.311964, 0.000000, 0.000000, 90.000000);
  122. CreateObject(3453, -1222.101562, 474.111846, 9.367557, 0.000000, 0.000000, 90.000000);
  123. CreateObject(3452, -1251.935424, 479.604248, 9.405378, 0.000000, 0.000000, 180.000000);
  124. CreateObject(3453, -1241.440185, -24.832351, 15.722908, 0.000000, 0.000000, 45.000000);
  125. CreateObject(3452, -1258.452270, -0.125663, 15.747909, 0.000000, 0.000000, 134.999969);
  126. CreateObject(3452, -1300.089477, 41.548461, 15.697910, 0.000000, 0.000000, 134.999969);
  127. CreateObject(3453, -1325.257934, 57.730583, 15.647909, 0.000000, 0.000000, 134.999969);
  128. CreateObject(3452, -1350.413452, 40.271453, 15.647911, 0.000000, 0.000000, 225.000030);
  129. CreateObject(3452, -1371.132446, 19.394195, 15.672910, 0.000000, 0.000000, 225.000030);
  130. CreateObject(3452, -1257.617675, -50.034523, 15.722909, 0.000000, 0.000000, 45.000000);
  131. CreateObject(3452, -1278.682861, -70.883903, 15.697908, 0.000000, 0.000000, 45.000000);
  132. CreateObject(3453, -1386.855834, -5.336665, 15.715358, 0.000000, 0.000000, 225.000030);
  133. CreateObject(3453, -1303.802490, -88.125671, 15.647909, 0.000000, 0.000000, 315.000000);
  134. CreateObject(3452, -1369.440307, -30.486749, 15.747909, 0.000000, 0.000000, 315.000000);
  135. CreateObject(3452, -1328.677368, -72.280700, 15.597913, 0.000000, 0.000000, 315.000000);
  136. CreateObject(3279, -1327.697753, 47.628265, 13.224054, 0.000000, 0.000000, 134.999969);
  137. CreateObject(3279, -1373.739013, 1.586212, 13.224054, 0.000000, 0.000000, 134.999969);
  138. CreateObject(3279, -1253.568603, -26.533119, 13.224054, 0.000000, 0.000000, 315.000000);
  139. CreateObject(3279, -1299.551025, -72.534378, 13.224054, 0.000000, 0.000000, 315.000000);
  140. CreateObject(16776, -1241.716308, -69.387710, 22.292963, 0.000000, 0.000000, 315.000000);
  141. CreateObject(7392, -1262.929931, 32.618263, 40.102794, 0.000000, 0.000000, 45.000000);
  142. CreateObject(7073, -1277.822631, 50.415985, 31.428398, 0.000000, 0.000000, 45.000000);
  143. CreateObject(3452, -1279.342285, 20.789491, 15.722909, 0.000000, 0.000000, 134.999969);
  144. CreateObject(3749, -1346.161132, -48.366500, 19.006851, 0.000000, 0.000000, 315.000000);
  145. CreateObject(971, -1357.530395, -39.579605, 16.718370, 0.000000, 0.000000, 225.000030);
  146. CreateObject(971, -1362.657348, -44.729606, 16.743370, 0.000000, 0.000000, 45.000000);
  147. CreateObject(971, -1352.056396, -39.570392, 16.768369, 0.000000, 0.000000, 134.999969);
  148. CreateObject(971, -1337.760986, -60.380943, 16.743370, 0.000000, 0.000000, 225.000030);
  149. CreateObject(971, -1342.364746, -65.028961, 16.743370, 0.000000, 0.000000, 225.000030);
  150. CreateObject(971, -1337.698242, -54.490985, 16.693370, 0.000000, 0.000000, 134.999969);
  151. CreateObject(14467, -1354.408935, -46.069114, 15.882230, 0.000000, 0.000000, 45.000000);
  152. CreateObject(14467, -1343.873657, -57.543529, 15.882230, 0.000000, 0.000000, 225.000030);
  153. CreateObject(10281, -1253.928955, 16.057811, 27.112640, 0.000000, 0.000000, 315.000000);
  154. CreateObject(9527, -1348.007324, -50.055614, 20.397682, 0.000000, 0.000000, 315.000000);
  155. CreateObject(9191, -1339.683349, -74.586944, 16.470876, 0.000000, 0.000000, 315.000000);
  156. CreateObject(9190, -1327.904907, -86.385421, 16.420877, 0.000000, 0.000000, 315.000000);
  157. CreateObject(9190, -1371.315429, -41.996185, 16.470876, 0.000000, 0.000000, 315.000000);
  158. CreateObject(9191, -1382.572875, -30.718606, 16.470876, 0.000000, 0.000000, 315.000000);
  159. CreateObject(9188, -1394.302368, -18.988555, 16.470876, 0.000000, 0.000000, 315.000000);
  160. CreateObject(9188, -1316.148437, -98.181648, 16.420877, 0.000000, 0.000000, 315.000000);
  161. CreateObject(7093, -1352.766357, -41.006092, 25.340902, 0.000000, 0.000000, 0.000000);
  162. CreateObject(9191, -1400.149291, -4.900668, 16.470876, 0.000000, 0.000000, 270.000000);
  163. CreateObject(972, -1387.840576, 11.532464, 12.677876, 0.000000, 0.000000, 134.999969);
  164. CreateObject(972, -1370.220947, 29.158786, 12.685426, 0.000000, 0.000000, 134.999984);
  165. CreateObject(972, -1352.855712, 46.681182, 12.660427, 0.000000, 0.000000, 134.999984);
  166. CreateObject(972, -1338.070312, 61.488784, 12.685424, 0.000000, 0.000000, 134.999984);
  167. CreateObject(972, -1319.473388, 64.975769, 12.658924, 0.000000, 0.000000, 78.750000);
  168. CreateObject(9190, -1302.253662, -102.315498, 16.420877, 0.000000, 0.000000, 11.250030);
  169. CreateObject(972, -1289.466796, -91.362266, 12.410429, 0.000000, 0.000000, 315.000000);
  170. CreateObject(972, -1271.873901, -73.712463, 12.382879, 0.000000, 0.000000, 315.000000);
  171. CreateObject(972, -1254.444335, -56.299110, 12.418819, 0.000000, 0.000000, 315.000000);
  172. CreateObject(972, -1239.102050, -38.207252, 12.504232, 0.000000, 0.000000, 326.249969);
  173. CreateObject(972, -1233.524902, -18.601697, 12.585428, 0.000000, 0.000000, 11.250030);
  174. CreateObject(972, -1242.772094, 1.222285, 12.620326, 0.000000, 0.000000, 45.000000);
  175. CreateObject(972, -1260.213378, 18.620136, 12.645326, 0.000000, 0.000000, 45.000000);
  176. CreateObject(972, -1300.708129, 53.481170, 12.645326, 0.000000, 0.000000, 45.000000);
  177. CreateObject(972, -1280.746337, 37.279335, 12.545328, 0.000000, 0.000000, 56.250000);
  178. CreateObject(974, -1268.357666, 32.086219, 15.768571, 0.000000, 0.000000, 315.000000);
  179. CreateObject(987, -1243.385375, 33.131969, 12.820373, 0.000000, 0.000000, 134.999969);
  180. CreateObject(987, -1249.803222, 39.503234, 12.862133, 0.000000, 0.000000, 134.999969);
  181. CreateObject(982, -1263.090332, -32.494636, 13.831992, 0.000000, 0.000000, 315.000000);
  182. CreateObject(982, -1281.185913, -50.588050, 13.804745, 0.000000, 0.000000, 315.000000);
  183. CreateObject(983, -1292.503295, -61.968704, 13.781992, 0.000000, 0.000000, 315.000000);
  184. CreateObject(983, -1297.052124, -66.487190, 13.781992, 0.000000, 0.000000, 134.999969);
  185. CreateObject(982, -1311.596801, -63.880908, 13.831992, 0.000000, 0.000000, 45.000000);
  186. CreateObject(982, -1329.769409, -45.746337, 13.806992, 0.000000, 0.000000, 45.000000);
  187. CreateObject(982, -1347.868774, -27.644811, 13.831992, 0.000000, 0.000000, 45.000000);
  188. CreateObject(982, -1365.989990, -9.540893, 13.856991, 0.000000, 0.000000, 45.000000);
  189. CreateObject(982, -1364.442382, 7.443561, 13.831992, 0.000000, 0.000000, 315.000000);
  190. CreateObject(982, -1346.335815, 25.531946, 13.831992, 0.000000, 0.000000, 315.000000);
  191. CreateObject(983, -1334.998413, 36.842609, 13.831992, 0.000000, 0.000000, 315.000000);
  192. CreateObject(983, -1330.491943, 41.277942, 13.831992, 0.000000, 0.000000, 134.999969);
  193. CreateObject(983, -1327.098388, 44.698101, 13.831992, 0.000000, 0.000000, 134.999969);
  194. CreateObject(982, -1315.922607, 39.280868, 13.831992, 0.000000, 0.000000, 45.000000);
  195. CreateObject(982, -1297.836425, 21.188003, 13.856991, 0.000000, 0.000000, 45.000000);
  196. CreateObject(982, -1279.721069, 3.056617, 13.881991, 0.000000, 0.000000, 45.000000);
  197. CreateObject(982, -1261.634643, -14.932929, 13.856991, 0.000000, 0.000000, 45.000000);
  198. }
  199.  
  200. public OnPlayerSpawn(playerid)
  201. {
  202.    InEvent[playerid] = 0;
  203.    TogglePlayerControllable(playerid, 1);
  204.    return 1;
  205. }
  206.  
  207. CMD:dmcmds(playerid, params[])
  208. {
  209.    if(IsPlayerAdmin(playerid))
  210.    {
  211.    new string[500];
  212.    strcat(string, "{fef65b}/dmevent {1ffdc4}-> {fd1f58}to create the DM event!\n");
  213.    strcat(string, "{fef65b}/dmevent {1ffdc4}-> {fd1f58}again type to close the event!\n");
  214.    strcat(string, "{fef65b}/startdm {1ffdc4}-> {fd1f58}to start the DM event!\n");
  215.    strcat(string, "{fef65b}/fire{1ffdc4} -> {fd1f58}to fire/kick someone from the DM event!\n\n");
  216.    strcat(string, "{bbbbee}This DM Event system was created By: {fdfe1d}RxErT!");
  217.    ShowPlayerDialog(playerid, 1884, DIALOG_STYLE_MSGBOX,"DM Event - Commands", string, "Ok", "");
  218.    }
  219.    else
  220.    {
  221.    SCM(playerid, -1, "{F00f00}[ERROR]: {FFFFFF}You are not authorized to use this command!");
  222.    }
  223.    return 1;
  224. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top