silverms

Event System

Apr 2nd, 2017
1,292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 19.37 KB | None | 0 0
  1. //Event System By Jack_Minner/Silverms
  2. /* Notes
  3. when u create the event if  u want it tdm set type=2 and the ff=0 so the freindly firwe will be off
  4. if it was tdm u have to add the team saw location when u type /setsspawns team1 it will set ur position and team one spawn and team2 will setur position
  5. as team 2 spawn and when u do /createevent if u setted type = 1 which is dm set the ff=1 and be standing in the position that the players spawn when they join the event
  6. */
  7. #include <a_samp>
  8. #include <zcmd>
  9. #include <sscanf>
  10. #include <streamer>
  11.  
  12. #define         COLOR_WHITE             0xFFFFFFFF
  13. #define         COLOR_YELLOW            0xFFFF00FF
  14. #define         COLOR_RED               0xFF0000FF
  15. #define         COLOR_GREEN             0x00FF00FF
  16. #define         COLOR_BLUE              0x0000FFFF
  17. #define         COLOR_LBLUE             0x0000FFFF
  18. #define         COLOR_ADMIN             0x0066FFFF
  19. #define         COLOR_ORANGE            0xFF9900FF
  20. #define         COLOR_LIGHTBLUE         0x99FFFFFF
  21.  
  22.  
  23. new Float:EX;
  24. new Float:EY;
  25. new Float:EZ;
  26. new ELocked;
  27. new ff, ft[15];
  28. new ename[256];
  29. new Float:ex[MAX_PLAYERS];
  30. new Float:ey[MAX_PLAYERS];
  31. new Float:ez[MAX_PLAYERS];
  32. new pInt[MAX_PLAYERS];
  33. new pWorld[MAX_PLAYERS];
  34. new eSkin[MAX_PLAYERS];
  35. new EventE;
  36. new InEvent[MAX_PLAYERS];
  37. new Float:Elocox, Float:Elocoy, Float:Elocoz;
  38. new Float:Eloctx, Float:Elocty, Float:Eloctz;
  39. new weapon1, weapon2, weapon3, ammo1, ammo2, ammo3, type;
  40. new team1[MAX_PLAYERS], team2[MAX_PLAYERS];
  41. new etype[15];
  42. new EWorld;
  43. new EInt;
  44. new oskin, tskin;
  45. new pWant[MAX_PLAYERS];
  46. new ACash[MAX_PLAYERS];
  47. new Float:phealth, Float:parmor;
  48.  
  49. forward Saver(playerid);
  50. forward OnJoinEvent(playerid);
  51. enum
  52. {
  53.     DIALOG_EVENTS,
  54.  
  55. };
  56. public OnPlayerConnect(playerid)
  57. {
  58.     ACash[playerid]=0;
  59.     InEvent[playerid]=0;
  60.     team1[playerid]=0;
  61.     team2[playerid]=0;
  62.     return 1;
  63. }
  64.  
  65. public OnPlayerDeath(playerid, killerid, reason)
  66. {
  67.     if(InEvent[playerid]==1)
  68.     {
  69.         if(type==2)
  70.         {
  71.             if(team1[playerid]==1)
  72.             {
  73.                 new name[MAX_PLAYER_NAME];
  74.                 GetPlayerName(playerid, name, sizeof(name));
  75.                 TogglePlayerControllable(playerid,0);
  76.                 SetPlayerPos(playerid, Float:Elocox, Float:Elocoy, Float:Elocoz);
  77.                 SetPlayerVirtualWorld(playerid, EWorld);
  78.                 SetPlayerVirtualWorld(playerid, EInt);
  79.                 SetTimerEx("OnJoinEvent", 2000, false, "i", playerid);
  80.                 SetTimerEx("Saver", 1000, true, "i", playerid);
  81.                 ResetPlayerWeapons(playerid);
  82.                 SetPlayerSkin(playerid, oskin);
  83.                 SetPlayerHealth(playerid, 9999999);
  84.                 SetPlayerArmour(playerid, 9999999);
  85.                 GivePlayerWeapon(playerid, weapon1, ammo1);
  86.                 GivePlayerWeapon(playerid, weapon2, ammo2);
  87.                 GivePlayerWeapon(playerid, weapon3, ammo3);
  88.                 printf("%s Has Been Killed And Joined The Event", name);
  89.                 InEvent[playerid]=1;
  90.                 team1[playerid]=1;
  91.                 team2[playerid]=0;
  92.             }
  93.             if(team2[playerid]==1)
  94.             {
  95.                 new name[MAX_PLAYER_NAME];
  96.                 GetPlayerName(playerid, name, sizeof(name));
  97.                 TogglePlayerControllable(playerid,0);
  98.                 SetPlayerPos(playerid, Float:Eloctx, Float:Elocty, Float:Eloctz);
  99.                 SetPlayerVirtualWorld(playerid, EWorld);
  100.                 SetPlayerVirtualWorld(playerid, EInt);
  101.                 SetTimerEx("OnJoinEvent", 3000, false, "i", playerid);
  102.                 SetTimerEx("Saver", 1000, true, "i", playerid);
  103.                 ResetPlayerWeapons(playerid);
  104.                 SetPlayerSkin(playerid, tskin);
  105.                 SetPlayerHealth(playerid, 9999999);
  106.                 SetPlayerArmour(playerid, 9999999);
  107.                 GivePlayerWeapon(playerid, weapon1, ammo1);
  108.                 GivePlayerWeapon(playerid, weapon2, ammo2);
  109.                 GivePlayerWeapon(playerid, weapon3, ammo3);
  110.                 printf("%s Has Been Killed And Joined The Event", name);
  111.                 InEvent[playerid]=1;
  112.                 team1[playerid]=0;
  113.                 team2[playerid]=1;
  114.             }
  115.             if(InEvent[killerid]==1)
  116.             {
  117.                 ACash[killerid]+=random(10000);
  118.             }
  119.         }
  120.         if(type==1)
  121.         {
  122.             new name[MAX_PLAYER_NAME];
  123.             GetPlayerName(playerid, name, sizeof(name));
  124.             TogglePlayerControllable(playerid,0);
  125.             SetPlayerPos(playerid, Float:EX, Float:EY, Float:EZ);
  126.             SetPlayerVirtualWorld(playerid, EWorld);
  127.             SetPlayerVirtualWorld(playerid, EInt);
  128.             SetTimerEx("OnJoinEvent", 3000, false, "i", playerid);
  129.             ResetPlayerWeapons(playerid);
  130.             SetPlayerHealth(playerid, 9999999);
  131.             SetPlayerArmour(playerid, 9999999);
  132.             GivePlayerWeapon(playerid, weapon1, ammo1);
  133.             GivePlayerWeapon(playerid, weapon2, ammo2);
  134.             GivePlayerWeapon(playerid, weapon3, ammo3);
  135.             printf("%s Has Been Killed And Joined The Event", name);
  136.             InEvent[playerid]=1;
  137.             team1[playerid]=0;
  138.             team2[playerid]=0;
  139.         }
  140.     }
  141.     return 1;
  142. }
  143. CMD:events(playerid, params[])
  144. {
  145.     if(EventE==0) return SendClientMessage(playerid, COLOR_RED, "There Isnt Any Active Event Right Now");
  146.     new string[256];
  147.     format(string, sizeof(string), "Event [%s]:Weapon 1:%d, Weapon 2:%d, Weapon 3:%d, Online:%d ,[/joinevent]", ename, weapon1, weapon2, weapon3, GetPlayersInEvent());
  148.     SendClientMessage(playerid, COLOR_YELLOW, string);
  149.     return 1;
  150. }
  151. CMD:createevent(playerid, params[])
  152. {
  153.     if(EventE==1) return SendClientMessage(playerid, COLOR_RED, "There Is Already An Active Event Stop It First [/stopevent]");
  154.     new pname[MAX_PLAYER_NAME], string[256];
  155.     if (sscanf(params, "iiiiiiiis", weapon1,ammo1, weapon2, ammo2, weapon3, ammo3, type, ff, ename)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /createevent [weapon1] [ammo1] [weapon2] [ammo2] [weapon3] [ammo3] [type:1-2] [ff:1-0] [Name]");
  156.     EWorld = GetPlayerVirtualWorld(playerid);
  157.     EInt = GetPlayerInterior(playerid);
  158.     GetPlayerName(playerid, pname, sizeof(pname));
  159.     if(ff==1)
  160.     {
  161.         ft="ON";
  162.     }
  163.     else if(ff==0)
  164.     {
  165.         etype="OFF";
  166.     }
  167.     if(type==1)
  168.     {
  169.         etype="DM";
  170.         GetPlayerPos(playerid, Float:EX, Float:EY, Float:EZ);
  171.     }
  172.     else if(type==2)
  173.     {
  174.         etype="TDM";
  175.         SendClientMessage(playerid, COLOR_YELLOW, "Now Use /editevent");
  176.         format(string, sizeof(string), "Admin Note: %s Has Created Event With Name:%s Weapon1:%d Ammo1:%d, Weapon2:%d Ammo2:%d,Weapon3:%d Ammo:%d, Interior:%d, World:%d Type:%s, FreindlyFire:%s",pname, ename, weapon1, ammo1, weapon2, ammo2,weapon3, ammo3, EInt, EWorld, etype, ft);
  177.         SendMessageToAdmins(COLOR_ADMIN, string);
  178.         ELocked=1;
  179.     }
  180.     else if(type>2) {etype="Unknown";}
  181.     else if(type<1) {etype="Unknow";}
  182.     format(string, sizeof(string), "Admin Note: %s Has Created Event With Name:%s Weapon1:%d Ammo1:%d, Weapon2:%d Ammo2:%d,Weapon3:%d Ammo:%d, Interior:%d, World:%d Type:%s, FreindlyFire:%s",pname, ename, weapon1, ammo1, weapon2, ammo2,weapon3, ammo3, EInt, EWorld, etype, ft);
  183.     SendMessageToAdmins(COLOR_ADMIN, string);
  184.     if(type==1)
  185.     {
  186.         format(string, sizeof(string), "Admin : %s Has Created Event [/joinevent]", pname);
  187.         ELocked=0;
  188.         SendClientMessageToAll(COLOR_ADMIN, string);
  189.     }
  190.     printf("%s Has Created Event With Name:%s Weapon1:%d Ammo1:%d, Weapon2:%d Ammo2:%d,Weapon3:%d Ammo:%d,Type:%s Interior:%d, World:%d,FreindlyFire:%s",pname, ename, weapon1, ammo1, weapon2, ammo2,weapon3, ammo3,etype, EInt, EWorld, ft);
  191.     EventE=1;
  192.     return 1;
  193. }
  194. CMD:editevent(playerid, params[])
  195. {
  196.     new pname[MAX_PLAYER_NAME], string[256];
  197.     GetPlayerName(playerid, pname, sizeof(pname));
  198.     if(EventE==0) return SendClientMessage(playerid, COLOR_RED, "There Isnt Any Active Event Create On [/createevent]");
  199.     if(sscanf(params, "iiiiiii", weapon1,ammo1, weapon2, ammo2, weapon3, ammo3, ff)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /editevent [weapon1] [ammo1] [weapon2] [ammo2] [weapon3] [ammo3] [Friendlyfire]");
  200.     format(string, sizeof(string), "Admin Note: %s Has Edited Event Event With Weapon1:%d Ammo1:%d, Weapon2:%d Ammo2:%d,Weapon3:%d Ammo:%d",pname, weapon1, ammo1, weapon2, ammo2,weapon3, ammo3);
  201.     SendMessageToAdmins(COLOR_ADMIN, string);
  202.     printf("%s Has Edited Event With Weapon1:%d Ammo1:%d, Weapon2:%d Ammo2:%d,Weapon3:%d Ammo:%d FreindlyFire:%d",pname, weapon1, ammo1, weapon2, ammo2,weapon3, ammo3,ff);
  203.     return 1;
  204. }
  205. CMD:endevent(playerid, params[])
  206. {
  207.     new string[256], name[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME];
  208.     if(EventE==0) return SendClientMessage(playerid, COLOR_RED, "There isnt Any Active Events Right Now.");
  209.     for(new i=0; i<MAX_PLAYERS; i++)
  210.     {
  211.         GetPlayerName(i, name, sizeof(name));
  212.         GetPlayerName(playerid, pname, sizeof(pname));
  213.         if(InEvent[i]==1)
  214.         {
  215.             SetPlayerPos(i, Float:ex[i], Float:ey[i], Float:ez[i]);
  216.             SetPlayerInterior(i, pInt[i]);
  217.             SetPlayerVirtualWorld(i, pWorld[i]);
  218.             InEvent[i]=0;
  219.             team1[i]=0;
  220.             team2[i]=0;
  221.             SetPlayerWantedLevel(i, pWant[i]);
  222.             SetPlayerSkin(i, eSkin[i]);
  223.             SetPlayerHealth(i, 100);
  224.             SetPlayerArmour(i, 0);
  225.             ResetPlayerWeapons(i);
  226.             format(string, sizeof(string), "%s Has Left The Event", name);
  227.             SendMessageToEvent(COLOR_BLUE, string);
  228.             SendClientMessage(playerid, COLOR_GREEN, "Welcome Back From The Event");
  229.         }
  230.         format(string, sizeof(string), "Admin Note:%s Has Stoped The Event", pname);
  231.         SendMessageToAdmins(COLOR_BLUE, string);
  232.         printf("%s Has Stoped The event", pname);
  233.         EventE=0;
  234.         ELocked=0;
  235.         return 1;
  236.     }
  237.     return 1;
  238. }
  239. CMD:joinevent(playerid, params[])
  240. {
  241.     new team;
  242.     if(EventE==0) return SendClientMessage(playerid, COLOR_RED, "There Isnt Any Active Event");
  243.     if(ELocked==1) return SendClientMessage(playerid, COLOR_RED, "This Event Is Locked");
  244.     if(InEvent[playerid]==1) return SendClientMessage(playerid, COLOR_RED, "You Are Already In Event");
  245.     if(GetPlayerWantedLevel(playerid) >=1) return SendClientMessage(playerid, COLOR_RED, "You Are Wanted Lose Your Wanted Level First!");
  246.     if(type==2)
  247.     {
  248.         if(GetPlayersInTeamOne()==3 && GetPlayersInTeamTwo()==3) return SendClientMessage(playerid, COLOR_RED, "Sorry This Event Is Full");
  249.         if(sscanf(params, "d", team)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE:/joinevent [team] [1-2]");
  250.         if(team==1)
  251.         {
  252.             if(GetPlayersInTeamOne()==3) return SendClientMessage(playerid, COLOR_RED, "For The Balance Of The Event You Need To Join Team 2");
  253.             new name[MAX_PLAYER_NAME], string[256];
  254.             GetPlayerName(playerid, name, sizeof(name));
  255.             GetPlayerPos(playerid, Float:ex[playerid], Float:ey[playerid], Float:ez[playerid]);
  256.             TogglePlayerControllable(playerid,0);
  257.             SetPlayerPos(playerid, Float:Elocox, Float:Elocoy, Float:Elocoz);
  258.             SetPlayerVirtualWorld(playerid, EWorld);
  259.             SetPlayerVirtualWorld(playerid, EInt);
  260.             pWant[playerid] = GetPlayerWantedLevel(playerid);
  261.             SetTimerEx("OnJoinEvent", 2000, false, "i", playerid);
  262.             SetTimerEx("Saver", 1000, true, "i", playerid);
  263.             eSkin[playerid] = GetPlayerSkin(playerid);
  264.             pInt[playerid] = GetPlayerInterior(playerid);
  265.             pWorld[playerid] = GetPlayerVirtualWorld(playerid);
  266.             ResetPlayerWeapons(playerid);
  267.             SetPlayerSkin(playerid, oskin);
  268.             SetPlayerHealth(playerid, 99999999);
  269.             SetPlayerArmour(playerid, 99999999);
  270.             GivePlayerWeapon(playerid, weapon1, ammo1);
  271.             GivePlayerWeapon(playerid, weapon2, ammo2);
  272.             GivePlayerWeapon(playerid, weapon3, ammo3);
  273.             format(string, sizeof(string), "%s joined an event Join Him /joinevent", name);
  274.             SendClientMessageToAll(COLOR_BLUE, string);
  275.             printf("%s Has Joined The Event", name);
  276.             InEvent[playerid]=1;
  277.             team1[playerid]=1;
  278.             team2[playerid]=0;
  279.             return 1;
  280.         }
  281.         if(team==2)
  282.         {
  283.             if(GetPlayersInTeamTwo()==3) return SendClientMessage(playerid, COLOR_RED, "For The Balance Of The Event You Need To Join Team 1");
  284.             new name[MAX_PLAYER_NAME], string[256];
  285.             GetPlayerName(playerid, name, sizeof(name));
  286.             GetPlayerPos(playerid, Float:ex[playerid], Float:ey[playerid], Float:ez[playerid]);
  287.             TogglePlayerControllable(playerid,0);
  288.             SetPlayerPos(playerid, Float:Eloctx, Float:Elocty, Float:Eloctz);
  289.             SetPlayerVirtualWorld(playerid, EWorld);
  290.             SetPlayerVirtualWorld(playerid, EInt);
  291.             pWant[playerid] = GetPlayerWantedLevel(playerid);
  292.             SetTimerEx("OnJoinEvent", 3000, false, "i", playerid);
  293.             SetTimerEx("Saver", 1000, true, "i", playerid);
  294.             eSkin[playerid] = GetPlayerSkin(playerid);
  295.             pInt[playerid] = GetPlayerInterior(playerid);
  296.             pWorld[playerid] = GetPlayerVirtualWorld(playerid);
  297.             ResetPlayerWeapons(playerid);
  298.             SetPlayerSkin(playerid, tskin);
  299.             SetPlayerHealth(playerid, 99999999);
  300.             SetPlayerArmour(playerid, 99999999);
  301.             GivePlayerWeapon(playerid, weapon1, ammo1);
  302.             GivePlayerWeapon(playerid, weapon2, ammo2);
  303.             GivePlayerWeapon(playerid, weapon3, ammo3);
  304.             format(string, sizeof(string), "%s joined an event Join Him /joinevent", name);
  305.             SendClientMessageToAll(COLOR_BLUE, string);
  306.             printf("%s Has Joined The Event", name);
  307.             InEvent[playerid]=1;
  308.             team1[playerid]=0;
  309.             team2[playerid]=1;
  310.             return 1;
  311.         }
  312.     }
  313.     else if(type==1)
  314.     {
  315.         new name[MAX_PLAYER_NAME], string[256];
  316.         GetPlayerName(playerid, name, sizeof(name));
  317.         GetPlayerPos(playerid, Float:ex[playerid], Float:ey[playerid], Float:ez[playerid]);
  318.         TogglePlayerControllable(playerid,0);
  319.         SetPlayerPos(playerid, Float:EX, Float:EY, Float:EZ);
  320.         SetPlayerVirtualWorld(playerid, EWorld);
  321.         SetPlayerVirtualWorld(playerid, EInt);
  322.         pWant[playerid] = GetPlayerWantedLevel(playerid);
  323.         SetTimerEx("OnJoinEvent", 3000, false, "i", playerid);
  324.         pInt[playerid] = GetPlayerInterior(playerid);
  325.         pWorld[playerid] = GetPlayerVirtualWorld(playerid);
  326.         ResetPlayerWeapons(playerid);
  327.         SetPlayerHealth(playerid, 99999999);
  328.         SetPlayerArmour(playerid, 99999999);
  329.         GivePlayerWeapon(playerid, weapon1, ammo1);
  330.         GivePlayerWeapon(playerid, weapon2, ammo2);
  331.         GivePlayerWeapon(playerid, weapon3, ammo3);
  332.         format(string, sizeof(string), "%s joined an event Join Him /joinevent", name);
  333.         SendClientMessageToAll(COLOR_BLUE, string);
  334.         printf("%s Has Joined The Event", name);
  335.         InEvent[playerid]=1;
  336.         team1[playerid]=0;
  337.         team2[playerid]=0;
  338.     }
  339.     return 1;
  340. }
  341. CMD:leaveevent(playerid, params[])
  342. {
  343.     new string[256], name[MAX_PLAYER_NAME];
  344.     if(InEvent[playerid]==0) return SendClientMessage(playerid, COLOR_RED, "You Arent In An Event");
  345.     SetPlayerPos(playerid, Float:ex[playerid], Float:ey[playerid], Float:ez[playerid]);
  346.     GetPlayerName(playerid, name, sizeof(name));
  347.     SetPlayerInterior(playerid, pInt[playerid]);
  348.     SetPlayerVirtualWorld(playerid, pWorld[playerid]);
  349.     InEvent[playerid]=0;
  350.     SetPlayerWantedLevel(playerid, pWant[playerid]);
  351.     SetPlayerHealth(playerid, 100);
  352.     SetPlayerArmour(playerid, 0);
  353.     team1[playerid]=0;
  354.     team2[playerid]=0;
  355.     SetPlayerSkin(playerid, eSkin[playerid]);
  356.     GivePlayerMoney(playerid, ACash[playerid]);
  357.     ResetPlayerWeapons(playerid);
  358.     format(string, sizeof(string), "%s Has Left The Event", name);
  359.     SendMessageToEvent(COLOR_BLUE, string);
  360.     format(string, sizeof(string), "Admin Note:%s Has Left The Event", name);
  361.     SendMessageToAdmins(COLOR_BLUE, string);
  362.     SendClientMessage(playerid, COLOR_GREEN, "Welcome Back From The Event");
  363.     printf("%s Has Left The Event", name);
  364.     return 1;
  365. }
  366. CMD:ecmds(playerid, params[])
  367. {
  368.     ShowPlayerDialog(playerid, DIALOG_EVENTS, DIALOG_STYLE_MSGBOX, "Server Event Commands", "1./createevent\n2./setespawnto set teams spawn location use it if type = 2]\n3./seteskins\n3./editevent[to edit the weapons]\n4./endevent\nNote:use /editevent and /setskins only if u choosed\ntype 2 and /editevent will set the spawn location of the\nchosen team.", "Close", "");
  369.     return 1;
  370. }
  371. CMD:setespawn(playerid, params[])
  372. {
  373.     new option[128], str[256], pname[MAX_PLAYER_NAME];
  374.     if(EventE==0) return SendClientMessage(playerid, COLOR_RED, "There Isnt Any Active Event To Edit");
  375.     if(type==1) return SendClientMessage(playerid, COLOR_RED, "You Can Only Edit TDM[Type 2] Events");
  376.     if (sscanf(params, "s", option)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setespawn [team1] [team2] (team 1 spawn, team 2 spawn)");
  377.     GetPlayerName(playerid, pname, sizeof(pname));
  378.     if(strcmp(option, "team1", true) == 0)
  379.     {
  380.         GetPlayerPos(playerid, Float:Elocox, Float:Elocoy, Float:Elocoz);
  381.         format(str, sizeof(str), "You Have Setted Team One Spawn Location At: X:%d, Y:%d, Z:%d", Float:Elocox, Float:Elocoy, Float:Elocoz);
  382.         SendClientMessage(playerid, COLOR_YELLOW, str);
  383.         printf("%s Has Setted Event Team One Spawn Location To: X:%d Y:%d Z:%d", pname, Float:Elocox, Float:Elocoy, Float:Elocoz);
  384.         return 1;
  385.     }
  386.     if(strcmp(option, "team2", true) == 0)
  387.     {
  388.         GetPlayerPos(playerid, Float:Eloctx, Float:Elocty, Float:Eloctz);
  389.         format(str, sizeof(str), "You Have Setted Team Two Spawn Location At: X:%d, Y:%d, Z:%d", Float:Eloctx, Float:Elocty, Float:Eloctz);
  390.         SendClientMessage(playerid, COLOR_YELLOW, str);
  391.         printf("%s Has Setted Event Team Two Spawn Location To: X:%d Y:%d Z:%d", pname, Float:Eloctx, Float:Elocty, Float:Eloctz);
  392.         SendClientMessage(playerid, COLOR_YELLOW, "You Can Now Use /seteskins");
  393.         return 1;
  394.     }
  395.     return 1;
  396. }
  397. CMD:seteskins(playerid, params[])
  398. {
  399.     new str[256], pname[MAX_PLAYER_NAME], string[256];
  400.     if(EventE==0) return SendClientMessage(playerid, COLOR_RED, "There Isnt Any Active Event To Edit");
  401.     if(type==1) return SendClientMessage(playerid, COLOR_RED, "You Can Only Edit TDM[Type 2] Events");
  402.     if(sscanf(params, "ii", oskin, tskin)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteskin [team1 skinid] [team2 skinid]");
  403.     GetPlayerName(playerid, pname, sizeof(pname));
  404.     format(str, sizeof(str), "You Have Setted Team One Skin Id To: %d , And Team Two To: %d .", oskin, tskin);
  405.     SendClientMessage(playerid, COLOR_YELLOW, str);
  406.     ELocked=0;
  407.     format(string, sizeof(string), "Admin : %s Has Created Event [/joinevent]", pname);
  408.     SendClientMessageToAll(COLOR_ADMIN, string);
  409.     return 1;
  410. }
  411. stock SendMessageToAdmins(color,const string[])// here will send message to admins only that he created an event
  412. {
  413.     for(new i=0; i < MAX_PLAYERS; i++)
  414.     {
  415.         if(IsPlayerConnected(i))
  416.         if(IsPlayerAdmin(i))//edit this in ur admin level in my case if the player was loged it as rcon
  417.         SendClientMessage(i,color,string);
  418.     }
  419.     return 1;
  420. }
  421. GetPlayersInEvent()
  422. {
  423.     new count;
  424.     for(new x=0; x< MAX_PLAYERS; x++)
  425.     {
  426.         if(InEvent[x]==1)
  427.         {
  428.             count++;
  429.         }
  430.     }
  431.     return count;
  432. }
  433. GetPlayersInTeamOne()
  434. {
  435.     new count;
  436.     for(new x=0; x< MAX_PLAYERS; x++)
  437.     {
  438.         if(team1[x]==1)
  439.         {
  440.             count++;
  441.         }
  442.     }
  443.     return count;
  444. }
  445. GetPlayersInTeamTwo()
  446. {
  447.     new count;
  448.     for(new x=0; x< MAX_PLAYERS; x++)
  449.     {
  450.         if(team2[x]==1)
  451.         {
  452.             count++;
  453.         }
  454.     }
  455.     return count;
  456. }
  457. stock SendMessageToEvent(color,const string[])
  458. {
  459.     for(new i=0; i < MAX_PLAYERS; i++)
  460.     {
  461.         if(IsPlayerConnected(i))
  462.         if(InEvent[i] >=1)
  463.         SendClientMessage(i,color,string);
  464.     }
  465.     return 1;
  466. }
  467. public OnJoinEvent(playerid)
  468. {
  469.     TogglePlayerControllable(playerid,1);
  470.     SetPlayerHealth(playerid, 100);
  471.     SetPlayerArmour(playerid, 100);
  472.     return 1;
  473. }
  474. //===================These are for the freindly fire==============//
  475. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
  476. {
  477.     if(type==2)
  478.     {
  479.         if(InEvent[playerid]==1)
  480.         {
  481.             if(ff==0)
  482.             {
  483.                 if(team1[issuerid]==1 && team1[playerid]==1)
  484.                 {
  485.                     SetPlayerArmour(playerid, parmor);
  486.                     SetPlayerHealth(playerid, phealth);
  487.                 }
  488.                 if(team2[issuerid]==1 && team2[playerid]==1)
  489.                 {
  490.                     SetPlayerArmour(playerid, parmor);
  491.                     SetPlayerHealth(playerid, phealth);
  492.                 }
  493.                 if(team1[issuerid]==1 && team1[playerid]==0)
  494.                 {
  495.                     SetPlayerArmour(playerid, parmor);
  496.                     SetPlayerHealth(playerid, phealth);
  497.                 }
  498.                 if(team2[issuerid]==1 && team2[playerid]==0)
  499.                 {
  500.                     SetPlayerArmour(playerid, parmor);
  501.                     SetPlayerHealth(playerid, phealth);
  502.                 }
  503.             }
  504.         }
  505.     }
  506.     return 1;
  507. }
  508. public Saver(playerid)
  509. {
  510.     GetPlayerArmour(playerid, parmor);
  511.     GetPlayerHealth(playerid, phealth);
  512.     return 1;
  513. }
  514. //===================================================//
Advertisement
Add Comment
Please, Sign In to add comment