Advertisement
Guest User

[FS] Evento System [v0.1c]

a guest
Oct 16th, 2010
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 14.18 KB | None | 0 0
  1.  
  2.  
  3. #include <a_samp>
  4.  
  5. forward CountDown();
  6.  
  7. #define COR_VERMELHA 0xF66767AA
  8. #define COR_BRANCO   0xFFFFFFAA
  9. #define COR_AZUL     0x447FECAA
  10. enum EventoSystem
  11. {
  12.     bool:Eventoiniciado,//bool irá indicar sim ou não (false or true) melhor doque 0 ou 1
  13.     bool:Eventotrancado,
  14.     bool:Eventodestrancado,
  15.     bool:Entrar,
  16. };
  17. new Airton[MAX_PLAYERS][EventoSystem];
  18. new Float:ex,Float:ey,Float:ez;
  19. new Float:entroux,Float:entrouy,Float:entrouz;
  20. new entraram;
  21. new bool: IsCountdownStarted;
  22. new CountdownTimer;
  23.  
  24. public OnFilterScriptInit()
  25. {
  26.     print("--**Evento System Iniciado com sucesso**--");
  27.     print("--**Desenvolvido para o SA-MP 0.3b RC2**--");
  28.     print("--**Progamado por Airton.Vitor**--");
  29.     SendClientMessageToAll(COR_VERMELHA,"Evento System Iniciado com sucesso by Airton");
  30.     return 1;
  31. }
  32.  
  33. public OnFilterScriptExit()
  34. {
  35.     print("--**Evento System Finalizado com sucesso**--");
  36.     SendClientMessageToAll(COR_AZUL,"-**Evento System Finalizado com sucesso by Airton");
  37.     return 1;
  38. }
  39.  
  40. main(){}
  41.  
  42. public OnPlayerConnect(playerid)
  43. {
  44.     Airton[playerid][Eventoiniciado] = false;
  45.     Airton[playerid][Eventodestrancado] = false;
  46.     Airton[playerid][Eventotrancado] = false;
  47.     Airton[playerid][Entrar] = false;
  48.     return 1;
  49. }
  50.  
  51. public OnPlayerSpawn(playerid)
  52. {
  53.     if(IsPlayerAdmin(playerid))
  54.     {
  55.         SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: Uso> /evento para ver os comandos disponiveis");
  56.     }
  57.     return 1;
  58. }
  59. public OnPlayerDeath(playerid, killerid, reason)
  60. {
  61.     Airton[playerid][Entrar] = false;
  62.     return 1;
  63. }
  64.  
  65. public OnPlayerCommandText(playerid, cmdtext[])
  66. {
  67.     new cmd[128]; new adminterior; new streventu[128]; new idcmd;
  68.     new admnick[20];
  69.     cmd = strtok(cmdtext, idcmd);
  70.     if(strcmp(cmd, "/evento", true) == 0&&IsPlayerAdmin(playerid))
  71.     {
  72.         SendClientMessage(playerid, COR_BRANCO, "===============================================================================");
  73.         SendClientMessage(playerid, COR_VERMELHA, "=========================EVENTO SYSTEM COMANDOS DÍSPONIVEIS====================");
  74.         SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: /einiciar,/edestrancar,/etrancar,/edestrancar,/eventoterminar,/ekick");
  75.         SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: /ecarro,/evida,/earma,/ecolete,/econtar,/econgelar,/edescongelar    ");
  76.         SendClientMessage(playerid, COR_BRANCO, "===============================================================================");
  77.         return 1;
  78.     }
  79.     if(strcmp(cmd, "/einiciar", true) == 0&&Airton[playerid][Eventoiniciado] == false &&IsPlayerAdmin(playerid))
  80.     {
  81.         GetPlayerInterior(adminterior);
  82.         GetPlayerPos(playerid, ex, ey, ez);
  83.         SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  84.         SendClientMessageToAll(COR_AZUL, "-INFO- Um evento acaba de ser iniciado! Digite /entrar para se teleportar até o evento");
  85.         SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  86.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
  87.         {
  88.             GameTextForPlayer(possiveis,"~y~novo evento aberto ~n~digite ~b~/entrar", 2200, 1);
  89.             Airton[possiveis][Eventoiniciado] = true;
  90.             Airton[possiveis][Eventotrancado] = false;
  91.             Airton[possiveis][Eventodestrancado] = false;
  92.             Airton[playerid][Entrar] = false;
  93.         }
  94.         return 1;
  95.     }
  96.     if(strcmp(cmd, "/etrancar", true) == 0&&Airton[playerid][Eventoiniciado] == true&&Airton[playerid][Eventotrancado] == false &&IsPlayerAdmin(playerid))
  97.     {
  98.         SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  99.         format(streventu, 128, "-INFO- O evento foi trancado - %d jogadores(ras) entrarao", entraram);
  100.         SendClientMessageToAll(COR_AZUL, streventu);
  101.         SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  102.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
  103.         {
  104.             GameTextForPlayer(possiveis,"~y~evento ~r~fechado", 2500, 1);
  105.             Airton[possiveis][Eventotrancado] = true;
  106.             Airton[possiveis][Eventodestrancado] = true;
  107.         }
  108.         return 1;
  109.     }
  110.     if(strcmp(cmd, "/edestrancar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&Airton[playerid][Eventodestrancado] == true&&IsPlayerAdmin(playerid))
  111.     {
  112.         SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  113.         SendClientMessageToAll(COR_AZUL, "-INFO- O evento foi destrancado! Digite /entrar");
  114.         SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  115.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
  116.         {
  117.             GameTextForPlayer(possiveis,"~w~evento ~g~aberto", 2500, 1);
  118.             Airton[possiveis][Eventotrancado] = false;
  119.             Airton[possiveis][Eventodestrancado] = false;
  120.         }
  121.         return 1;
  122.     }
  123.     if(strcmp(cmd, "/efinalizar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  124.     {
  125.         GetPlayerName(playerid,admnick, 24);
  126.         SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  127.         format(streventu, 128, "-INFO- O Administrador RCON %s evento foi finalizado!", admnick);
  128.         SendClientMessageToAll(COR_AZUL, streventu);
  129.         SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  130.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
  131.         {
  132.             GameTextForPlayer(possiveis,"~w~evento ~r~finalizado", 2500, 1);
  133.             Airton[possiveis][Eventotrancado] = false;
  134.             Airton[possiveis][Eventoiniciado] = false;
  135.             Airton[possiveis][Eventodestrancado] = false;
  136.         }
  137.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  138.         {
  139.             Airton[possiveis][Entrar] = false;
  140.             SetPlayerPos(playerid, entroux, entrouy, entrouz);
  141.         }
  142.         return 1;
  143.     }
  144.     if(strcmp(cmd, "/entrar", true) == 0&&Airton[playerid][Entrar] == false&&Airton[playerid][Eventoiniciado] == true &&Airton[playerid][Eventotrancado] == false&&IsPlayerAdmin(playerid))
  145.     {
  146.         Airton[playerid][Entrar] = true;
  147.         entraram++;
  148.         SetPlayerInterior(playerid,adminterior);
  149.         SetPlayerPos(playerid, ex, ey, ez);
  150.         GetPlayerPos(playerid, entroux, entrouy, entrouz);
  151.         return 1;
  152.     }
  153.     if(strcmp(cmd, "/esair", true) == 0&&Airton[playerid][Entrar] == true&&Airton[playerid][Eventoiniciado] == true &&Airton[playerid][Eventotrancado] == false&&IsPlayerAdmin(playerid))
  154.     {
  155.         Airton[playerid][Entrar] = false;
  156.         entraram--;
  157.         SetPlayerInterior(playerid,adminterior);
  158.         SetPlayerPos(playerid, entroux, entrouy, entrouz);
  159.         return 1;
  160.     }
  161.     if(strcmp(cmd, "/edesarmar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  162.     {
  163.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  164.         {
  165.             ResetPlayerWeapons(possiveis);
  166.             SetPlayerArmedWeapon(possiveis,0);
  167.         }
  168.         GetPlayerName(playerid,admnick, 24);
  169.         format(streventu, 128, "-INFO- O Administrador RCON %s desarmou todos jogadores do evento!", admnick);
  170.         SendClientMessageToAll(COR_AZUL, streventu);
  171.         return 1;
  172.     }
  173.     if(strcmp(cmd, "/earma", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  174.     {
  175.         new gun;
  176.         new ammo;
  177.         new tmp[128];
  178.         tmp = strtok(cmdtext, idcmd);
  179.         gun = strval(tmp);
  180.         if(!strlen(tmp))
  181.         {
  182.             SendClientMessage(playerid, COR_BRANCO, "Digite o id da arma e a munição!");
  183.             return 1;
  184.         }
  185.         tmp = strtok(cmdtext, idcmd);
  186.         ammo = strval(tmp);
  187.         /*if(ammo < 1||ammo > 9999)
  188.         {
  189.             return 1;
  190.         }*/
  191.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  192.         {
  193.             GivePlayerWeapon(possiveis, gun, ammo);
  194.         }
  195.         GetPlayerName(playerid,admnick, 24);
  196.         format(streventu, 128, "-INFO- O Administrador RCON %s deu arma %d munição %d aos jogadores do evento!", admnick,gun,ammo);
  197.         SendClientMessageToAll(COR_AZUL, streventu);
  198.         return 1;
  199.     }
  200.     if(strcmp(cmd, "/ecarro", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  201.     {
  202.         new tmp[128];
  203.         tmp = strtok(cmdtext, idcmd);
  204.         new carro;
  205.         carro = strval(tmp);
  206.         if(!strlen(tmp))
  207.         {
  208.             SendClientMessage(playerid, COR_BRANCO, "Digite o id do carro!");
  209.             return 1;
  210.         }
  211.         if(carro < 400 || carro > 611)
  212.         {
  213.             SendClientMessage(playerid, COR_VERMELHA, "   O ID do veiculo digitado está invalido! veiculos de 400 á 611");
  214.             return 1;
  215.         }
  216.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  217.         {
  218.             new Float:X = 0,Float:Y = 0,Float:Z = 0,Float:Angulo = 0;
  219.             GetPlayerPos(possiveis, X,Y,Z);
  220.             GetPlayerFacingAngle(playerid, Angulo);
  221.             //CreateVehicle(car, X, Y, Z, Angulo, 1, 1, 10000);//cria um veiculo bem no player
  222.             PutPlayerInVehicle(possiveis, CreateVehicle(carro, X,Y,Z, Angulo, 1, 1,10000), 0);//coloca o player num veiculo
  223.         }
  224.         GetPlayerName(playerid,admnick, 24);
  225.         format(streventu, 128, "-INFO- O Administrador RCON %s deu veiculo %d aos jogadores do evento!", admnick,carro);
  226.         SendClientMessageToAll(COR_AZUL, streventu);
  227.         return 1;
  228.     }
  229.     if(strcmp(cmd, "/econtar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  230.     {
  231.         if(IsCountdownStarted == false)
  232.         {
  233.             CountdownTimer = SetTimer("CountDown", 1000, 1);
  234.             IsCountdownStarted = true;
  235.             GetPlayerName(playerid,admnick, 24);
  236.             format(streventu, 128, "-INFO- O Administrador RCON %s iniciou a contagem do evento", admnick);
  237.             SendClientMessageToAll(COR_AZUL, streventu);
  238.         }
  239.         else
  240.         {
  241.             SendClientMessage(playerid, COR_VERMELHA, "Já há uma contagem em andamento");
  242.         }
  243.         return 1;
  244.     }
  245.     if(strcmp(cmd, "/econgelar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  246.     {
  247.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  248.         {
  249.             TogglePlayerControllable(possiveis, false);
  250.         }
  251.         GetPlayerName(playerid,admnick, 24);
  252.         format(streventu, 128, "-INFO- O Administrador RCON %s congelou os jogadores do evento!", admnick);
  253.         SendClientMessageToAll(COR_AZUL, streventu);
  254.         return 1;
  255.     }
  256.     if(strcmp(cmd, "/edescongelar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  257.     {
  258.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  259.         {
  260.             TogglePlayerControllable(possiveis, true);
  261.         }
  262.         GetPlayerName(playerid,admnick, 24);
  263.         format(streventu, 128, "-INFO- O Administrador RCON %s descongelou os jogadores do evento!", admnick);
  264.         SendClientMessageToAll(COR_AZUL, streventu);
  265.         return 1;
  266.     }
  267.     if(strcmp(cmd, "/evida", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  268.     {
  269.         new tmp[128];
  270.         tmp = strtok(cmdtext, idcmd);
  271.         new vida = strval(tmp);
  272.         if(!strlen(tmp))
  273.         {
  274.             SendClientMessage(playerid, COR_BRANCO, "Digite a quantidade do HP!");
  275.             return 1;
  276.         }
  277.         /*if(vida < 1 || vida > 9999)
  278.         {
  279.             return 1;
  280.         }*/
  281.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  282.         {
  283.             SetPlayerHealth(possiveis,vida);
  284.         }
  285.         GetPlayerName(playerid,admnick, 24);
  286.         format(streventu, 128, "-INFO- O Administrador RCON %s setou HP %d para os jogadores do evento", admnick,vida);
  287.         SendClientMessageToAll(COR_AZUL, streventu);
  288.         return 1;
  289.     }
  290.     if(strcmp(cmd, "/ecolete", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  291.     {
  292.         new tmp[128];
  293.         tmp = strtok(cmdtext, idcmd);
  294.         new colete = strval(tmp);
  295.         if(!strlen(tmp))
  296.         {
  297.             SendClientMessage(playerid, COR_BRANCO, "Digite a quantidade do Colete!");
  298.             return 1;
  299.         }
  300.         /*if(colete < 1 || colete > 9999)
  301.         {
  302.             return 1;
  303.         }*/
  304.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  305.         {
  306.             SetPlayerArmour(possiveis, colete);
  307.         }
  308.         GetPlayerName(playerid,admnick, 24);
  309.         format(streventu, 128, "-INFO- O Administrador RCON %s setou Colete %d para os jogadores do evento", admnick, colete);
  310.         SendClientMessageToAll(COR_AZUL, streventu);
  311.         return 1;
  312.     }
  313.     return 1;
  314. }
  315.  
  316. public CountDown()
  317. {
  318.     new Count;
  319.     switch(Count)
  320.     {
  321.         case 5: { GameTextForAll("~n~~b~-~r~ 5 ~b~-", 1100, 3); }
  322.         case 4: { GameTextForAll("~n~~b~-~r~ 4 ~b~-", 1100, 3); }
  323.         case 3: { GameTextForAll("~n~~b~-~r~ 3 ~b~-", 1100, 3); }
  324.         case 2: { GameTextForAll("~n~~b~-~r~ 2 ~b~-", 1100, 3); }
  325.         case 1: { GameTextForAll("~n~~b~-~r~ 1 ~b~-", 1100, 3); }
  326.         case 0:
  327.         {
  328.             GameTextForAll("~n~~b~-~g~ GO! ~b~-", 2000, 3);
  329.             KillTimer(CountdownTimer);
  330.             IsCountdownStarted = false;
  331.         }
  332.     }
  333.     Count--;
  334. }
  335. /*
  336.  
  337.     Discrição: Sistema de eventos v0.1c
  338.     Progamado por: Airton.Vitor
  339.     Manual: Para criar,trancar,setar,etc você deve estar logado como Administrador RCON
  340.     Dica: /rcon login [suasenha]
  341.     Lembrete: Sejá um bom menino e mantenha os créditos :p
  342.  
  343. */
  344. strtok(const string[], &index)
  345. {
  346.     new length = strlen(string);
  347.     while ((index < length) && (string[index] <= ' '))
  348.     {
  349.         index++;
  350.     }
  351.  
  352.     new offset = index;
  353.     new result[20];
  354.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  355.     {
  356.         result[index - offset] = string[index];
  357.         index++;
  358.     }
  359.     result[index - offset] = EOS;
  360.     return result;
  361. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement