Badyx

[FS] Sistema de evento.

Apr 3rd, 2013
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.76 KB | None | 0 0
  1. /*      Sistema de Evento y hora feliz By BadyX     */
  2.  
  3. /*
  4.         http://img802.imageshack.us/img802/8524/samp000rf.png
  5.         http://img208.imageshack.us/img208/3227/samp001mdx.png
  6. */
  7. #include <a_samp>
  8.  
  9. /*      Colores     */
  10. #define Rojo                                                                    0xff001bff
  11. #define Amarillo                                                                0xFFFF00AA
  12. #define Verde                                                                   0x33AA33AA
  13. #define Azul                                                                    0x8D8DFF00
  14.  
  15. /*      News        */
  16. new Eventos = 0;
  17. new EstadoChat = 1;
  18. new Float:Posiciones[3];
  19.  
  20. #if defined FILTERSCRIPT
  21.  
  22. #else
  23.  
  24. main(){}
  25.  
  26. #endif
  27.  
  28. public OnPlayerCommandText(playerid, cmdtext[])
  29. {
  30.     new string[128];
  31.     new cmd[256];
  32.     new idx;
  33.     new tmp[256];
  34.     cmd = strtok(cmdtext, idx);
  35.     if (strcmp("/crearevento", cmdtext, true, 10) == 0)
  36.     {
  37.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,  Rojo,  # [Error] Usted no esta logeado con rcon );
  38.         if(Eventos == 1)            return SendClientMessage(playerid,  Rojo,  # [Error] El modo evento ya esta activado );
  39.         GetPlayerPos(playerid, Posiciones[0], Posiciones[1], Posiciones[2]);
  40.         SendClientMessageToAll(Amarillo, "[Atencion] El modo evento fue activado, para participar usa {FF23FF}[/Participar]");
  41.         Eventos = 1;
  42.         return 1;
  43.     }
  44.    
  45.     if (strcmp("/CerrarEvento", cmdtext, true, 10) == 0)
  46.     {
  47.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,  Rojo,  # [Error] Usted no esta logeado con rcon );
  48.         if(Eventos == 0)            return SendClientMessage(playerid,  Rojo,  # [Error] El modo evento no esta activado );
  49.         SendClientMessageToAll(Amarillo, "[Atencion] El modo evento fue desactivado");
  50.         Eventos = 0;
  51.         return 1;
  52.     }
  53.    
  54.     if (strcmp("/Participar", cmdtext, true, 10) == 0)
  55.     {
  56.         if(Eventos == 0)            return SendClientMessage(playerid,  Rojo,  # [Error] El modo evento no esta activado );
  57.         SetPlayerPos(playerid,Posiciones[0], Posiciones[1], Posiciones[2]);
  58.         SendClientMessage(playerid,Verde, # [Info] Entraste al modo evento);
  59.         SendClientMessage(playerid,Verde, # [Info] Espera instrucciones);
  60.         return 1;
  61.     }
  62.    
  63.     if(strcmp(cmd, "/Evento", true) == 0 || strcmp(cmd, "/e", true) == 0)
  64.     {
  65.         if(IsPlayerConnected(playerid))
  66.         {
  67.             new length = strlen(cmdtext);
  68.             while ((idx < length) && (cmdtext[idx] <= ' '))
  69.             {
  70.                 idx++;
  71.             }
  72.             new offset = idx;
  73.             new result[256];
  74.             while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  75.             {
  76.                 result[idx - offset] = cmdtext[idx];
  77.                 idx++;
  78.             }
  79.             result[idx - offset] = EOS;
  80.             if(!strlen(result))         return  SendClientMessage(playerid, Verde, "Usa /Evento [Texto]");
  81.             if(EstadoChat   == 0)       return  SendClientMessage(playerid, Rojo, "[Error]El chat para eventos esta desactivado");
  82.             if(IsPlayerAdmin(playerid))
  83.             {
  84.                 format(string, sizeof(string),"(([Staff Evento] %s: %s ))", NombreEx(playerid), result);
  85.                 SendClientMessageToAll(Azul,string);
  86.                 return 1;
  87.             }
  88.             format(string, sizeof(string), "(([Usuario Evento] [%d] %s: %s ))",playerid, NombreEx(playerid), result);
  89.             SendClientMessageToAll(Azul,string);
  90.             return 1;
  91.         }
  92.         return 1;
  93.     }
  94.    
  95.     if (strcmp("/ChatEvento", cmdtext, true, 10) == 0)
  96.     {
  97.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,  Rojo,  # [Error] Usted no esta logeado con rcon );
  98.         if(EstadoChat   == 1)
  99.         {
  100.         SendClientMessageToAll(Amarillo, "[Atencion] El chat /Evento fue desactivado");
  101.         EstadoChat   = 0;
  102.         return 1;
  103.         }
  104.         SendClientMessageToAll(Amarillo, "[Atencion] El chat /Evento fue activado");
  105.         EstadoChat   = 1;
  106.         return 1;
  107.     }
  108.    
  109.     if(strcmp(cmd, "/EventoArmas", true) == 0)
  110.     {
  111.         if(IsPlayerConnected(playerid))
  112.         {
  113.             tmp = strtok(cmdtext, idx);
  114.             new ArmaElegida;
  115.             if(!strlen(tmp))                return  SendClientMessage(playerid, Verde, "[Uso:] /DarArma [Id/Arma]");
  116.             if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,  Rojo,  # [Error] Usted no esta logeado con rcon );
  117.             ArmaElegida = strval(tmp);
  118.             for(new i = 0; i < MAX_PLAYERS; i++)
  119.             {
  120.                 GivePlayerWeapon(i, ArmaElegida, 99999);
  121.             }
  122.             SendClientMessageToAll(Amarillo, "[Atencion] Un administrador dio armas a todos");
  123.             return 1;
  124.             }
  125.         return 1;
  126.     }
  127.    
  128.     if (strcmp("/EventoVida", cmdtext, true, 10) == 0)
  129.     {
  130.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,  Rojo,  # [Error] Usted no esta logeado con rcon );
  131.         if(Eventos == 0)            return SendClientMessage(playerid,  Rojo,  # [Error] El modo evento no esta activado );
  132.         for(new i = 0; i < MAX_PLAYERS; i++)
  133.         {
  134.             SetPlayerHealth(playerid,100);
  135.         }
  136.         SendClientMessageToAll(Amarillo, "[Atencion] Un administrador lleno la vida de todos");
  137.         return 1;
  138.     }
  139.    
  140.     if(strcmp(cmd, "/EventoSkin", true) == 0)
  141.     {
  142.         if(!strlen(tmp))                return  SendClientMessage(playerid, Verde, "[Uso:] /EventoSkin [Id/Skin]");
  143.         if(!IsPlayerAdmin(playerid))    return SendClientMessage(playerid,  Rojo,  # [Error] Usted no esta logeado con rcon );
  144.         if(IsPlayerConnected(playerid))
  145.         {
  146.             tmp = strtok(cmdtext, idx);
  147.             new SkinElegido;
  148.             SkinElegido = strval(tmp);
  149.             for(new i = 0; i < MAX_PLAYERS; i++)
  150.             {
  151.                 SetPlayerSkin(playerid, SkinElegido);
  152.             }
  153.             SendClientMessageToAll(Amarillo, "[Atencion] Un administrador dio armas a todos");
  154.             return 1;
  155.             }
  156.         return 1;
  157.     }
  158.  
  159.        
  160.    
  161.     if (strcmp("/EventoChaleco", cmdtext, true, 10) == 0)
  162.     {
  163.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,  Rojo,  # [Error] Usted no esta logeado con rcon );
  164.         if(Eventos == 0)            return SendClientMessage(playerid,  Rojo,  # [Error] El modo evento no esta activado );
  165.         for(new i = 0; i < MAX_PLAYERS; i++)
  166.         {
  167.             SetPlayerArmour(playerid,100);
  168.         }
  169.         SendClientMessageToAll(Amarillo, "[Atencion] Un administrador dio chalecos a todos");
  170.         return 1;
  171.     }
  172.    
  173.     if (strcmp("/EventoAyuda", cmdtext, true, 10) == 0)
  174.     {
  175.         new MsnAyuda[500];
  176.         strcat(MsnAyuda, "{00A5FF}Creador: {F0F0F0}Badyx.\n\n");
  177.         strcat(MsnAyuda, "{F5FF00}/Crearevento (Abre el modo evento) \n\n{F0F0F0}/CerrarEvento (Cierra el modo evento)\n/Participar (Si el modo evento esta activo, con este comando iras a la posicion del evento)\n");
  178.         strcat(MsnAyuda, "{F5FF00}/Evento (Chat global para hablar)\n/ChatEvento (Activa/desactiva el chat evento)/EventoArmas (Da el arma elegida a todos los usuarios)\n/EventoVida   (Da vida a todos los usuarios)\n/EventoChaleco (Da chaleco a todos los usuarios)\nEventoSkin (Da el skin definido a todos los usuarios)\n\n\n\n");
  179.         strcat(MsnAyuda, "\n\n\n\n{F5FF00}Copyright © 2012-2013.");
  180.         ShowPlayerDialog(playerid, 999, DIALOG_STYLE_MSGBOX, "{00A5FF}Creditos © BadyX.", MsnAyuda, "Aceptar", "");
  181.         return 1;
  182.     }
  183.  
  184.     return 0;
  185. }
  186.  
  187. stock NombreEx(playerid)
  188. {
  189.     new string[24];
  190.     GetPlayerName(playerid,string,24);
  191.     new str[24];
  192.     strmid(str,string,0,strlen(string),24);
  193.     for(new i = 0; i < MAX_PLAYER_NAME; i++)
  194.     {
  195.         if (str[i] == '_') str[i] = ' ';
  196.     }
  197.     return str;
  198. }
  199.  
  200. strtok(const string[], &index)
  201. {
  202.     new length = strlen(string);
  203.     while ((index < length) && (string[index] <= ' '))
  204.     {
  205.         index++;
  206.     }
  207.     new offset = index;
  208.     new result[20];
  209.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  210.     {
  211.         result[index - offset] = string[index];
  212.         index++;
  213.     }
  214.     result[index - offset] = EOS;
  215.     return result;
  216. }
  217.  
  218.  
  219. //============================================================================//
  220. //                                                                            //
  221. //                              FINAL DEL SCRIPT                              //
  222. //                                                                            //
  223. //                SI TE SIRVIO, RESPETA EL TRABAJO DEL CREADOR                //
  224. //                                                                            //
  225. //============================================================================//
Advertisement
Add Comment
Please, Sign In to add comment