OtaconEvil

[FS] Descripcion Para Vehiculos By OTACON

Jul 9th, 2013
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.67 KB | None | 0 0
  1. //============================================================================//
  2. //                                                                            //
  3. //                SCRIPT EXCLUSIVO PARA PAWNOSCRIPTING.COM                    //
  4. //                                                                            //
  5. //                  >-- DESCRIPCION PARA VEHICULOS <--                        //
  6. //                                                                            //
  7. //============================================================================//
  8.  
  9. //============================================================================//
  10. //                                                                            //
  11. //                     CREADO POR <ØTACØN> DESDE 0                            //
  12. //                                                                            //
  13. //                 FECHA DE INICIO DEL SCRIPT 29/01/2012                      //
  14. //                        ----------------------                              //
  15. //              FECHA DE FINALIZACION DEL SCRIPT 29/01/2012                   //
  16. //                                                                            //
  17. //                       PROHIBIDO ROBAR CREDITOS                             //
  18. //                                                                            //
  19. //                       ACTUALIZACION 10/02/2012                             //
  20. //                                                                            //
  21. //                 Agregado: Cuando El Vehiculo Explota,                      //
  22. //                   Si tiene Descripcion es Eliminada.                       //
  23. //                                                                            //
  24. //             Agregado: Cuando El Player Sale Del Servidor,                  //
  25. //               La Descripcion Del Vehiculo Es Eliminada.                    //
  26. //                                                                            //
  27. //============================================================================//
  28.  
  29. //============================================================================//
  30. //                                  INCLUDEs                                  //
  31. //============================================================================//
  32. #include <a_samp>
  33. //============================================================================//
  34. //                                    NEWs                                    //
  35. //============================================================================//
  36. new
  37.    Str[50],
  38.    Activar_Descripcion[MAX_VEHICLES],
  39.    Text3D:Descripcion[MAX_VEHICLES],
  40.    Death[MAX_VEHICLES]
  41. ;
  42. //============================================================================//
  43. //                                  DEFINESs                                  //
  44. //============================================================================//
  45. #define COLOR_VERDE 0x19793AFF
  46. #define COLOR_BLANCO 0xFFFFFFFF
  47. #define COLOR_GRIS 0x74777EFF
  48. #define COLOR_ROSA 0x9516D0FF
  49. //============================================================================//
  50. //                     >-- DESCRIPCION PARA VEHICULOS <--                     //
  51. //============================================================================//
  52. public OnFilterScriptInit()
  53. {
  54.     print("\n|---------------------------------------|");
  55.     print("|          Filescript por <ØTACØN>        |");
  56.     print("|   Descripcion Para Vehiculo -- Cargado  |");
  57.     print("|-----------------------------------------|\n");
  58.     return 1;
  59. }
  60. //============================================================================//
  61. //                     >-- DESCRIPCION PARA VEHICULOS <--                     //
  62. //============================================================================//
  63. public OnFilterScriptExit()
  64. {
  65.     print("\n|---------------------------------------|");
  66.     print("|          Filescript por <ØTACØN>        |");
  67.     print("|   Descripcion Para Vehiculo -- Cerrado  |");
  68.     print("|-----------------------------------------|\n");
  69.     return 1;
  70. }
  71. //============================================================================//
  72. //                     >-- DESCRIPCION PARA VEHICULOS <--                     //
  73. //============================================================================//
  74. public OnPlayerConnect(playerid)
  75. {
  76.     for(new i=0; i<MAX_VEHICLES; i++)
  77.     {
  78.        Death[i] = 0;
  79.     }
  80.     return 1;
  81. }
  82. //============================================================================//
  83. //                     >-- DESCRIPCION PARA VEHICULOS <--                     //
  84. //============================================================================//
  85. public OnPlayerDisconnect(playerid, reason)
  86. {
  87.     new vehicleid = GetPlayerVehicleID(playerid);
  88.     if(Death[vehicleid] >= 1)
  89.     {
  90.        Delete3DTextLabel(Descripcion[vehicleid]);
  91.        Activar_Descripcion[vehicleid] = 0;
  92.        Death[vehicleid] = 0;
  93.     }
  94.     return 1;
  95. }
  96. //============================================================================//
  97. //                     >-- DESCRIPCION PARA VEHICULOS <--                     //
  98. //============================================================================//
  99. public OnVehicleDeath(vehicleid)
  100. {
  101.     if(Death[vehicleid] >= 1)
  102.     {
  103.        Delete3DTextLabel(Descripcion[vehicleid]);
  104.        Activar_Descripcion[vehicleid] = 0;
  105.        Death[vehicleid] = 0;
  106.     }
  107.     return 1;
  108. }
  109. //============================================================================//
  110. //                     >-- DESCRIPCION PARA VEHICULOS <--                     //
  111. //============================================================================//
  112.     public OnPlayerCommandText(playerid, cmdtext[])
  113.     {
  114.        new cmd[256], idx;
  115.        cmd = strtok(cmdtext, idx);
  116. //============================================================================//
  117. //                     >-- DESCRIPCION PARA VEHICULOS <--                     //
  118. //============================================================================//
  119.        if (strcmp("/Descripcion", cmd, true) == 0)
  120.        {
  121.            if(!IsPlayerInAnyVehicle(playerid))
  122.            {
  123.                SendClientMessage(playerid, COLOR_VERDE, "    [ ! ] Usted No Se Encuentra En Un Vehiculo.");
  124.                return 1;
  125.            }
  126.            new vehicleid = GetPlayerVehicleID(playerid);
  127.            if(Activar_Descripcion[vehicleid] == 0)
  128.            {
  129.                new length = strlen(cmdtext);
  130.                while ((idx < length) && (cmdtext[idx] <= ' '))
  131.                {
  132.                    idx++;
  133.                }
  134.                new offset = idx;
  135.                new result[64];
  136.                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  137.                {
  138.                    result[idx - offset] = cmdtext[idx];
  139.                    idx++;
  140.                }
  141.                result[idx - offset] = EOS;
  142.                if(!strlen(result))
  143.                {
  144.                    SendClientMessage(playerid, COLOR_VERDE, "    [ ! ] Escribe: /Descripcion [Texto]");
  145.                    return 1;
  146.                }
  147.                format(Str, sizeof(Str), "- %s -",result);
  148.                Descripcion[vehicleid] = Create3DTextLabel(Str, COLOR_ROSA, 30.0, 40.0, 5.0, 40.0, 1);
  149.                Attach3DTextLabelToVehicle( Descripcion[vehicleid], vehicleid, 0.0, 0.0, 1.2);
  150.                SendClientMessage(playerid, COLOR_GRIS, "    [ ! ] Usted Ha Puesto Una Descripcion Al Vehiculo!.");
  151.                SendClientMessage(playerid, COLOR_GRIS, "    [ ! ] Escribe: /BorrarDescripcion Para Borrar La Descripcion Actual!.");
  152.                Activar_Descripcion[vehicleid] = 1;
  153.                Death[vehicleid] = 1;
  154.                
  155.                format(Str, sizeof(Str), "    [ - ] La Descripcion Del Vehiculo Dice: %s",result);
  156.                SendClientMessage(playerid, COLOR_BLANCO, Str);
  157.            }
  158.            else
  159.            {
  160.                SendClientMessage(playerid, COLOR_VERDE, "    [ ! ] Este Vehiculo Ya Tiene Descripcion, Escribe /BorrarDescripcion .");
  161.            }
  162.            return 1;
  163.        }
  164. //============================================================================//
  165. //                     >-- DESCRIPCION PARA VEHICULOS <--                     //
  166. //============================================================================//
  167.        if (strcmp("/BorrarDescripcion", cmd, true) == 0)
  168.        {
  169.            if(!IsPlayerInAnyVehicle(playerid))
  170.            {
  171.                SendClientMessage(playerid, COLOR_VERDE, "    [ ! ] Usted No Se Encuentra En Un Vehiculo.");
  172.                return 1;
  173.            }
  174.            new vehicleid = GetPlayerVehicleID(playerid);
  175.            if(Activar_Descripcion[vehicleid] == 1)
  176.            {
  177.                Delete3DTextLabel(Descripcion[vehicleid]);
  178.                Activar_Descripcion[vehicleid] = 0;
  179.                Death[vehicleid] = 0;
  180.                SendClientMessage(playerid, COLOR_VERDE, "    [ ! ] Usted Ha Borrado La Descripcion Del Vehiculo!.");
  181.            }
  182.            else
  183.            {
  184.                SendClientMessage(playerid, COLOR_VERDE, "    [ ! ] Este Vehiculo No Tiene Descripcion, Escribe /Descripcion [Texto].");
  185.            }
  186.            return 1;
  187.        }
  188. //============================================================================//
  189. //                     >-- DESCRIPCION PARA VEHICULOS <--                     //
  190. //============================================================================//
  191.        return 0;
  192.     }
  193. //============================================================================//
  194. //                             FUNCIONES OTRAS                                //
  195. //============================================================================//
  196. stock strtok(const string[], &index)
  197. {
  198.     new length = strlen(string);
  199.     while ((index < length) && (string[index] <= ' '))
  200.     {
  201.         index++;
  202.     }
  203.     new offset = index;
  204.     new result[20];
  205.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  206.     {
  207.         result[index - offset] = string[index];
  208.         index++;
  209.     }
  210.     result[index - offset] = EOS;
  211.     return result;
  212. }
  213. //============================================================================//
  214. //                     >-- DESCRIPCION PARA VEHICULOS <--                     //
  215. //============================================================================//
  216.  
  217. //============================================================================//
  218. //                SI TE SIRVIO RESPETA EL TRABAJO DEL CREADOR                 //
  219. //                                                                            //
  220. //=========================FINAL DEL FILESCRIPT===============================//
Advertisement
Add Comment
Please, Sign In to add comment