Badyx

[FS] Hora feliz

Oct 18th, 2012
789
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.34 KB | None | 0 0
  1. /*
  2.         Sistema Hora feliz By Badyx
  3.                                                         */
  4.                                                        
  5. /*
  6.     Tiempo                      12 minutos
  7.     Script                      Badyx
  8.     Desarrollo                  Badyx
  9.     Tester                      Badyx
  10.    
  11.     Creditos adicionales:       Wiki.sa-mp
  12.  
  13.     Imagenes:
  14.    
  15.     http://imageshack.us/scaled/landing/211/desea.jpg
  16.  
  17.     http://imageshack.us/scaled/landing/402/acth.jpg
  18.                                                         */
  19.                                                        
  20. /*      Includes        */
  21. #include <a_samp>
  22. /*      Macros          */
  23. #define funcion%0(%1) \
  24.                      forward %0(%1); \
  25.                                     public %0(%1)
  26.  
  27. /*      News        */
  28. new EstadoHoraFeliz = 0;
  29. /*      Inicio del Script       */
  30. #if defined FILTERSCRIPT
  31. #else
  32. main(){}
  33. #endif
  34.  
  35. /*      Esto no es necesario y lo pueden borrar     */
  36. public OnPlayerConnect(playerid)
  37. {
  38.     SendClientMessage(playerid, -1, "{FFFFFF}[Info] Este servidor cuenta con sistema Hora Feliz.");
  39.     return 1;
  40. }
  41. /*      Comandos del FileScript     */
  42. public OnPlayerCommandText(playerid, cmdtext[])
  43. {
  44.     new string[100];
  45.     /*      Este comando es una prueba de como hacer que solo funcionen algunos comandos solo si la hora feliz esta activada        */
  46.     if (strcmp("/Prueba", cmdtext, true, 10) == 0)
  47.     {
  48.         if(EstadoHoraFeliz == 1)
  49.         {
  50.         SendClientMessage(playerid, -1, "{FFFFFF}Funcionaria el comando.");
  51.         return 1;
  52.         }
  53.         return SendClientMessage(playerid, -1, "{FFFFFF}La hora feliz no esta activada.");
  54.     }
  55.     /*      Comando para comprobar el estado de la hora feliz       */
  56.    
  57.     if (strcmp("/EstadoHora", cmdtext, true, 10) == 0)
  58.     {
  59.         if(EstadoHoraFeliz == 1)
  60.         {
  61.         SendClientMessage(playerid, -1, "{FFFFFF}El modo hora feliz esta activada!.");
  62.         return 1;
  63.         }
  64.         return SendClientMessage(playerid, -1, "{FFFFFF}El modo hora feliz esta desactivado!.");
  65.     }
  66.  
  67.    
  68.     /*      Comando para activar la hora feliz. Requiere estar logeado con la Rcon      */
  69.    
  70.     if (strcmp("/HoraFeliz", cmdtext, true, 10) == 0)
  71.     {
  72.     if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, -1, "{FFFFFF}Necesitas estar logeado con Rcon para usar este comando.");
  73.     if(EstadoHoraFeliz != 1)
  74.     {
  75.     EstadoHoraFeliz = 1;
  76.     format(string, sizeof(string), "{FFFFFF}La hora feliz ha sido activada por {CDE878}%s, {FFFFFF}A {519760}Trol{FFFFFF}ear.", NombreEx(playerid));
  77.     SendClientMessageToAll(-1, string);
  78.     return 1;
  79.     }
  80.     else
  81.     {
  82.     EstadoHoraFeliz = 0;
  83.     SendClientMessageToAll(-1, "{FFFFFF}La hora feliz ha sido {F80F60}desactivada.");
  84.     return 1;
  85.     }
  86.  
  87.     }
  88.     return 0;
  89. }
  90.  
  91. /*      Detecta cuando vamos a entrar en un coche       */
  92. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  93. {
  94.     new Float:slx, Float:sly, Float:slz;
  95.     if(EstadoHoraFeliz != 1)
  96.     {
  97.     if(EsVehiculoGuerra(GetPlayerVehicleID(playerid)) && !ispassenger)
  98.     {
  99.     return 1;
  100.     }
  101.     else
  102.     {
  103.     GetPlayerPos(playerid, slx, sly, slz);
  104.     SetPlayerPos(playerid, slx, sly, slz+2);
  105.     SendClientMessage(playerid, -1, "{FFFFFF}[Error] Estos vehiculos solo estan disponibles en hora feliz.");
  106.     return 1;
  107.     }
  108.     }
  109.     return 1;
  110. }
  111.  
  112. /*      Si desean crear mas restricciones tienen que añadir mas modelos       */
  113.  
  114. /*      Todas las ids de coches en
  115.  
  116.         http://wiki.sa-mp.com/wiki/Vehicles:All
  117.        
  118.                                                                               */
  119. funcion EsVehiculoGuerra(vehicleid)
  120. {   new model = GetVehicleModel(vehicleid);
  121. //  if(model == IDCOCHE || model == IDCOCHE ||model == IDCOCHE ||model == IDCOCHE)  Este es el formato para añadir mas coches
  122.     if(model == 432 || model == 520)//Tanque y Hidra
  123.     {
  124.         return 1;
  125.     }
  126.     return 0;
  127. }
  128.  
  129. /*      Funcion que obtiene el nombre del administrador que activa la hora feliz        */
  130. stock NombreEx(playerid)
  131. {
  132.     new string[24];
  133.     GetPlayerName(playerid,string,24);
  134.     new str[24];
  135.     strmid(str,string,0,strlen(string),24);
  136.     for(new i = 0; i < MAX_PLAYER_NAME; i++)
  137.     {
  138.         if (str[i] == '_') str[i] = ' ';
  139.     }
  140.     return str;
  141. }
  142.  
  143.  
  144. //============================================================================//
  145. //                                                                            //
  146. //                              FINAL DEL SCRIPT                              //
  147. //                                                                            //
  148. //                SI TE SIRVIO, RESPETA EL TRABAJO DEL CREADOR                //
  149. //                                                                            //
  150. //============================================================================//
Advertisement
Add Comment
Please, Sign In to add comment