Advertisement
OtaconEvil

[FS] Editor de NPC (creacion facil de NPC) | By OTACON

May 26th, 2015
931
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 32.69 KB | None | 0 0
  1. /*
  2.     * ## LEASE ATENTAMENTE PARA NO CONVERTIRSE EN LAMMER!!.: :D ##
  3.     *
  4.     * Estè Simple FILTERSCRIPT esta hecho especialmente para www.forum.sa-mp.com
  5.     * NO Publicar estè FILTERSCRIPT en Otros foros de SA-MP y hacerse pasar por el creador del CODE.
  6.     *
  7.     * Codigo Creado Por OTACON
  8.     *
  9.     * CREDITOS:
  10.     *     OTACON: Realizacion y Idea de creacion del code.
  11.     *     TÙ: Modificacion libremente respetando lo mencionado ;).
  12.     *
  13.     *    NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  14.     *
  15.     *                Prohibido TOTALMENTE el Robo de Créditos o la
  16.     *                  Publicación de este FILTERSCRIPT sin Mi Permiso.
  17. */
  18. /*
  19.     * ## READ CAREFULLY TO AVOID BECOMING LAMMER!.: :D ##
  20.     *
  21.     * This simple FILTERSCRIPT is made especially for www.forum.sa-mp.com
  22.     * DO NOT Post the FILTERSCRIPT in Other SAMP forums and impersonating the creator of the CODE.
  23.     *
  24.     * Code Created By OTACON
  25.     *
  26.     * CREDITS:
  27.     *     OTACON: Idea Making and code creation.
  28.     *     YOUR: Modification freely respecting the above ;).
  29.     *
  30.     *    NOTE: Less Credits for those who criticize me.. JO'PUTAS! :D xD ;)
  31.     *
  32.     *                        FULLY spaces Theft Credit or
  33.     *                 Publication of this FILTERSCRIPT without my permission.
  34. */
  35.  
  36. #include <a_samp>
  37. #include <zcmd>
  38. #include <sscanf2>
  39.  
  40. #define MAX_NPC (1000)
  41. #define DIALOG_NPC (10)
  42. enum B_bots{
  43.     b_name[24],
  44.     b_mode,
  45.     b_vehicle,
  46.     b_seat,
  47.     b_skin,
  48.     b_weapons,
  49.     Float:nPos[4],
  50.     b_actors,
  51.     id_actors,
  52.     b_descripction[24],
  53.     Text3D:bText,
  54.     Float:b_armour,
  55. };
  56. new bDataBots[MAX_NPC][B_bots];
  57.  
  58. enum A_bots{
  59.     bool:EditorNPC,
  60.     bool:RecNPC,
  61.     bool:SaveNPC,
  62.     bool:SelectNPC,
  63. };
  64. new InfoDataBots[MAX_PLAYERS][A_bots],
  65. more_bots, select_bots;
  66.  
  67. COMMAND:npc(playerid, params[]){
  68.     new bData[1024];
  69.     strcat(bData,"{CB0000}INSTRUCCIONES DE USO:\n");
  70.     strcat(bData,"{FFE300}encendido del editor:\n {FFFFFF}presiona la tecla 'Y' para configurar los datos del npc y encender el editor.\n");
  71.     strcat(bData,"{FFE300}grabacion del npc:\n {FFFFFF}una vez encendido el editor vuelve a presionar la tecla 'Y' para grabar al npc. \n");
  72.     strcat(bData,"{FFE300}finalizar la grabacion:\n {FFFFFF}para finalizar la grabacion activa presiona la tecla 'N' para finalizarla. \n");
  73.     strcat(bData,"{FFE300}apagado del editor:\n {FFFFFF}parta apagar el editor presiona la tecla 'C' para apagarlo, haciendo esta \n");
  74.     strcat(bData,"{FFFFFF}accion reiniciaras el editor y crearas un archivo 'filterscript' \n");
  75.     strcat(bData,"{FFFFFF}con los datos necesarios para conectar los npc's creados. \n");
  76.     ShowPlayerDialog(playerid, DIALOG_NPC+2, DIALOG_STYLE_MSGBOX,\
  77.     "{FFE300}Sistema de grabacion de npc:", bData, "cerrar", "mas...");
  78.     return true;
  79. }
  80.  
  81. COMMAND:npcedit(playerid, params[]){
  82.     if(IsPlayerInAnyVehicle(playerid)){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  83.         return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted se encuentra ne un vehiculo, {FFE300}baje del vehiculo para editarlo{FFFFFF}!.");}
  84.     if(InfoDataBots[playerid][RecNPC]){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  85.         return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted se encuentra grabando un npc, {FFFFFF}termina la grabacion para editarlo{FFFFFF}!.");}
  86.     new bData[1024];
  87.     strcat(bData,"{FFE300}editar: {FFFFFF}texto \n");
  88.     strcat(bData,"{FFE300}editar: {FFFFFF}armour \n");
  89.     strcat(bData,"{FFE300}editar: {FFFFFF}weapon \n");
  90.     strcat(bData,"{FFE300}editar: {FFFFFF}skin \n");
  91.     strcat(bData,"{FFE300}editar: {FFFFFF}coche \n");
  92.     strcat(bData,"{FFE300}seleccionar npc \n");
  93.     strcat(bData,"{FFFFFF}**coming soon* {FFDC00}reproducir \n");
  94.     ShowPlayerDialog(playerid, DIALOG_NPC+3, DIALOG_STYLE_TABLIST,\
  95.     "{FFE300}Sistema de grabacion de npc:", bData, "seleccionar", "cancelar");
  96.     return true;
  97. }
  98.  
  99. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
  100.     new bData[1024],
  101.         bSeat,
  102.         bModel,
  103.         bVehicle,
  104.         bSkin,
  105.         bWeapons,
  106.         Float:bPos[4],
  107.         Float:p_armour,
  108.         File:bDatas;
  109.        
  110.     bSeat = GetPlayerVehicleSeat(playerid);
  111.     bVehicle = GetPlayerVehicleID(playerid);
  112.     bModel = GetVehicleModel(bVehicle);
  113.     bSkin = GetPlayerSkin(playerid);
  114.     bWeapons = GetPlayerWeapon(playerid);
  115.     GetPlayerArmour(playerid, p_armour);
  116.    
  117.     if(newkeys & KEY_YES){
  118.         if(!InfoDataBots[playerid][EditorNPC]){
  119.             if(more_bots>=MAX_NPC-GetPlayerPoolSize())
  120.                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted ya ha creado demasiados npc, o hay bastantes usuarios{FFFFFF}!.");
  121.  
  122.             ShowPlayerDialog(playerid,DIALOG_NPC+0, DIALOG_STYLE_INPUT, "{FFE300}Sistema de grabacion de npc:", "\
  123.             {FFFFFF}INFO: Escribe un nombre para el npc que vas a crear a continuacion: \n\
  124.             {CB0000}NOTA: no ir por debajo de 4, ni ir por arriba de 24, caracteres,", "aceptar", "cancelar");
  125.         }else{
  126.             if(bDataBots[more_bots][b_mode]==PLAYER_RECORDING_TYPE_ONFOOT){
  127.                 if(IsPlayerInAnyVehicle(playerid))
  128.                     return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted ha elegido el mode de grabacion {FFFFFF}a pie, {FFE300}baje del vehiculo{FFFFFF}!.");
  129.                 if(InfoDataBots[playerid][RecNPC])
  130.                     return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted ya se encuentra grabando un npc{FFFFFF}!.");
  131.                    
  132.                 InfoDataBots[playerid][RecNPC] = true;
  133.                 InfoDataBots[playerid][SaveNPC] = false;
  134.                 InfoDataBots[playerid][SelectNPC] = false;
  135.                 GetPlayerPos(playerid, bPos[0],bPos[1],bPos[2]);
  136.                 GetPlayerFacingAngle(playerid, bPos[3]);
  137.                 bDataBots[more_bots][nPos][0] = bPos[0];
  138.                 bDataBots[more_bots][nPos][1] = bPos[1];
  139.                 bDataBots[more_bots][nPos][2] = bPos[2];
  140.                 bDataBots[more_bots][nPos][3] = bPos[3];
  141.                 bDataBots[more_bots][b_skin] = bSkin;
  142.                 bDataBots[more_bots][b_weapons] = bWeapons;
  143.                 bDataBots[more_bots][b_armour] = p_armour;
  144.                 bDataBots[more_bots][b_descripction][0] ='\0';
  145.                 select_bots = 0;
  146.                
  147.                 StartRecordingPlayerData(playerid,bDataBots[more_bots][b_mode],bDataBots[more_bots][b_name]);
  148.                 format(bData,sizeof(bData),"{FFFFFF}INFO: {FFE300}grabacion del npc: {FFFFFF}%s [%d/%d], {00A700}conmenzada.", bDataBots[more_bots][b_name], more_bots, MAX_NPC-GetPlayerPoolSize()-GetPlayerPoolSize());
  149.                 SendClientMessage(playerid,-1,bData);
  150.                 SendClientMessage(playerid,-1,"{FFDC00}NOTA: Ahora todos tus movimientos seran grabados para el npc{FFFFFF}!.");
  151.             }
  152.             else if(bDataBots[more_bots][b_mode]==PLAYER_RECORDING_TYPE_DRIVER){
  153.                 if(!IsPlayerInAnyVehicle(playerid))
  154.                     return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted ha elegido el mode de grabacion {FFFFFF}en vehiculo, {FFE300}suba a un vehiculo{FFFFFF}!.");
  155.                 if(InfoDataBots[playerid][RecNPC])
  156.                     return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted ya se encuentra grabando un npc{FFFFFF}!.");
  157.                    
  158.                 InfoDataBots[playerid][RecNPC] = true;
  159.                 InfoDataBots[playerid][SaveNPC] = false;
  160.                 InfoDataBots[playerid][SelectNPC] = false;
  161.                 GetVehiclePos(bVehicle, bPos[0],bPos[1],bPos[2]);
  162.                 GetVehicleZAngle(bVehicle, bPos[3]);
  163.                 bDataBots[more_bots][nPos][0] = bPos[0];
  164.                 bDataBots[more_bots][nPos][1] = bPos[1];
  165.                 bDataBots[more_bots][nPos][2] = bPos[2];
  166.                 bDataBots[more_bots][nPos][3] = bPos[3];
  167.                 bDataBots[more_bots][b_vehicle] = bModel;
  168.                 bDataBots[more_bots][b_seat] = bSeat;
  169.                 bDataBots[more_bots][b_skin] = bSkin;
  170.                 bDataBots[more_bots][b_weapons] = bWeapons;
  171.                 bDataBots[more_bots][b_armour] = p_armour;
  172.                 bDataBots[more_bots][b_descripction][0] ='\0';
  173.                 select_bots = 0;
  174.                
  175.                 StartRecordingPlayerData(playerid,bDataBots[more_bots][b_mode],bDataBots[more_bots][b_name]);
  176.                 format(bData,sizeof(bData),"{FFFFFF}INFO: {FFE300}grabacion del npc: {FFFFFF}%s [%d/%d], {00A700}conmenzada.", bDataBots[more_bots][b_name], more_bots, MAX_NPC-GetPlayerPoolSize());
  177.                 SendClientMessage(playerid,-1,bData);
  178.                 SendClientMessage(playerid,-1,"{FFDC00}NOTA: Ahora todos tus movimientos seran grabados para el npc{FFFFFF}!.");
  179.             }
  180.         }
  181.     }
  182.    
  183.     if(newkeys & KEY_NO){
  184.         if(InfoDataBots[playerid][EditorNPC]){
  185.             if(InfoDataBots[playerid][RecNPC]){
  186.                 StopRecordingPlayerData(playerid);
  187.                 format(bData,sizeof(bData),"{FFFFFF}INFO: {FFE300}grabacion del npc: {FFFFFF}%s [%d/%d], {CB0000}detenida.", bDataBots[more_bots][b_name], more_bots, MAX_NPC-GetPlayerPoolSize());
  188.                 SendClientMessage(playerid,-1,bData);
  189.                 InfoDataBots[playerid][RecNPC] = false;
  190.                 InfoDataBots[playerid][EditorNPC] = false;
  191.                 InfoDataBots[playerid][SaveNPC] = true;
  192.                 InfoDataBots[playerid][SelectNPC] = false;
  193.                
  194.                 format(bData,sizeof(bData),"%s.pwn",bDataBots[more_bots][b_name]);
  195.                 if(fexist(bData)) fremove(bData);
  196.                 bDatas=fopen(bData, io_append);
  197.                 if(bDatas){
  198.                     format(bData,sizeof(bData),"\r\n#define RECORDING \"%s\"\r\n",bDataBots[more_bots][b_name]);
  199.                     fwrite(bDatas, bData);
  200.                     format(bData,sizeof(bData),"#define RECORDING_TYPE (%d)\r\n\r\n",bDataBots[more_bots][b_mode]);
  201.                     fwrite(bDatas, bData);
  202.                     fwrite(bDatas, " #include <a_npc>\r\n");
  203.                     fwrite(bDatas, " main(){}\r\n");
  204.                     fwrite(bDatas, " public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);\r\n\r\n");
  205.                     fwrite(bDatas, " #if RECORDING_TYPE == 1\r\n");
  206.                     fwrite(bDatas, "   public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);\r\n");
  207.                     fwrite(bDatas, "   public OnNPCExitVehicle() StopRecordingPlayback();\r\n");
  208.                     fwrite(bDatas, " #else\r\n");
  209.                     fwrite(bDatas, "   public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);\r\n");
  210.                     fwrite(bDatas, " #endif\r\n");
  211.                     fclose(bDatas);
  212.                 }
  213.                 bDataBots[more_bots][id_actors] = CreateObject(18631, bDataBots[more_bots][nPos][0],bDataBots[more_bots][nPos][1],bDataBots[more_bots][nPos][2],0,0,0);
  214.                 new asd[10];
  215.                 if(bDataBots[more_bots][b_mode]==PLAYER_RECORDING_TYPE_ONFOOT) asd="actor",\
  216.                     bDataBots[more_bots][b_actors] = CreateActor(bDataBots[more_bots][b_skin], bDataBots[more_bots][nPos][0],bDataBots[more_bots][nPos][1],bDataBots[more_bots][nPos][2], bDataBots[more_bots][nPos][3]);
  217.                 else if(bDataBots[more_bots][b_mode]==PLAYER_RECORDING_TYPE_DRIVER) asd="vehiculo",\
  218.                     bDataBots[more_bots][b_actors] = CreateVehicle(bDataBots[more_bots][b_vehicle], bDataBots[more_bots][nPos][0],bDataBots[more_bots][nPos][1],bDataBots[more_bots][nPos][2], bDataBots[more_bots][nPos][3],random(200),random(200),99999);
  219.  
  220.                 format(bData,sizeof(bData),"{FFFFFF}INFO: {FFDC00}se ha creado un '{FFFFFF}%s' {FFDC00}para simular la posicion inicial del npc grabado{FFFFFF}!.", asd);
  221.                 SendClientMessage(playerid,-1,bData);
  222.                 format(bData,sizeof(bData),"{FFFFFF}INFO: {FFE300}cantidad de npc creados hasta el momento: {FFFFFF}[%d/%d].", more_bots, MAX_NPC-GetPlayerPoolSize());
  223.                 SendClientMessage(playerid,-1,bData);
  224.             }
  225.         }
  226.     }
  227.    
  228.     if(newkeys & KEY_CROUCH){
  229.         if(!InfoDataBots[playerid][EditorNPC]){
  230.             if(InfoDataBots[playerid][SaveNPC]){
  231.                 if(more_bots == 0)
  232.                     return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFDC00}Usted no ha grabado ningun npc, hasta el momento{FFFFFF}!.");
  233.  
  234.                 format(bData,sizeof(bData),"%s.pwn","filterscripts_NPC");
  235.                 if(fexist(bData)) fremove(bData);
  236.                 bDatas=fopen(bData, io_append);
  237.                 if(bDatas){
  238.                     fwrite(bDatas, " // Sistema de grabacion de npc - By OTACON //\r\n");
  239.                     fwrite(bDatas, "#include <a_samp>\r\n\r\n");
  240.                     for(new bSlots=1; bSlots<more_bots+1; bSlots++){
  241.                         if(bDataBots[bSlots][b_mode]==PLAYER_RECORDING_TYPE_DRIVER){
  242.                             format(bData,sizeof(bData),"new bVehicle_%s; \r\n", bDataBots[bSlots][b_name]);
  243.                             fwrite(bDatas, bData);
  244.                         }
  245.                     }
  246.                     for(new bSlots=1; bSlots<more_bots+1; bSlots++){
  247.                         if(strlen(bDataBots[bSlots][b_descripction])>=4 && strlen(bDataBots[bSlots][b_descripction])<=24){
  248.                             format(bData,sizeof(bData),"new Text3D:bText_%s[MAX_PLAYERS]; \r\n", bDataBots[bSlots][b_name]);
  249.                             fwrite(bDatas, bData);
  250.                         }
  251.                     }
  252.                     fwrite(bDatas, "\r\n");
  253.                     fwrite(bDatas, "public OnFilterScriptInit(){\r\n");
  254.                     format(bData,sizeof(bData),"    SendRconCommand(\"maxnpc %d\"); \r\n", more_bots+1);
  255.                     fwrite(bDatas, bData);
  256.                     for(new bSlots=1; bSlots<more_bots+1; bSlots++){
  257.                         format(bData,sizeof(bData),"    ConnectNPC(\"%s\",\"%s\"); \r\n", bDataBots[bSlots][b_name], bDataBots[bSlots][b_name]);
  258.                         fwrite(bDatas, bData);
  259.                     }
  260.                     for(new bSlots=1; bSlots<more_bots+1; bSlots++){
  261.                         if(bDataBots[bSlots][b_mode]==PLAYER_RECORDING_TYPE_DRIVER){
  262.                             format(bData,sizeof(bData),"    bVehicle_%s = AddStaticVehicle(%d, %f,%f,%f,%f,%d,%d); \r\n", bDataBots[bSlots][b_name], bDataBots[bSlots][b_vehicle], bDataBots[bSlots][nPos][0],bDataBots[bSlots][nPos][1],bDataBots[bSlots][nPos][2],bDataBots[bSlots][nPos][3], random(200), random(200));
  263.                             fwrite(bDatas, bData);
  264.                         }
  265.                     }
  266.                     fwrite(bDatas, "    return true;\r\n");
  267.                     fwrite(bDatas, "}\r\n\r\n");
  268.                     fwrite(bDatas, "public OnPlayerSpawn(playerid){\r\n");
  269.                     fwrite(bDatas, "    if(IsPlayerNPC(playerid)){\r\n");
  270.                     fwrite(bDatas, "        new bName[MAX_PLAYER_NAME];\r\n");
  271.                     fwrite(bDatas, "        GetPlayerName(playerid, bName, sizeof(bName));\r\n");
  272.                     for(new bSlots=1; bSlots<more_bots+1; bSlots++){
  273.                         format(bData,sizeof(bData),"        if(!strcmp(bName, \"%s\")){ \r\n", bDataBots[bSlots][b_name]);
  274.                         fwrite(bDatas, bData);
  275.                         fwrite(bDatas, "            // coloca aqui las funciones para el npc\r\n");
  276.                         if(strlen(bDataBots[bSlots][b_descripction])>=4 && strlen(bDataBots[bSlots][b_descripction])<=24){
  277.                             format(bData,sizeof(bData),"            Delete3DTextLabel(bText_%s[playerid]); \r\n", bDataBots[bSlots][b_name]);
  278.                             fwrite(bDatas, bData);
  279.                             format(bData,sizeof(bData),"            bText_%s[playerid] = Create3DTextLabel(\"_\",-1, %f,%f,%f,10,-1,0);); \r\n", bDataBots[bSlots][b_name], bDataBots[bSlots][nPos][0],bDataBots[bSlots][nPos][1],bDataBots[bSlots][nPos][2]);
  280.                             fwrite(bDatas, bData);
  281.                             format(bData,sizeof(bData),"            Attach3DTextLabelToPlayer(bText_%s[playerid], playerid, 0.0, 0.0, 0.2); \r\n", bDataBots[bSlots][b_name]);
  282.                             fwrite(bDatas, bData);
  283.                             format(bData,sizeof(bData),"            Update3DTextLabelText(bText_%s[playerid], -1, \"%s\"); \r\n", bDataBots[bSlots][b_name], bDataBots[bSlots][b_descripction]);
  284.                             fwrite(bDatas, bData);
  285.                         }
  286.                         if(bDataBots[bSlots][b_armour]>0.0){
  287.                             format(bData,sizeof(bData),"            SetPlayerArmour(playerid, %f); \r\n", bDataBots[bSlots][b_armour]);
  288.                             fwrite(bDatas, bData);
  289.                         }
  290.                         format(bData,sizeof(bData),"            SetPlayerSkin(playerid, %d); \r\n", bDataBots[bSlots][b_skin]);
  291.                         fwrite(bDatas, bData);
  292.                         if(bDataBots[bSlots][b_weapons]>0){
  293.                             format(bData,sizeof(bData),"            GivePlayerWeapon(playerid, %d, 99999); \r\n", bDataBots[bSlots][b_weapons]);
  294.                             fwrite(bDatas, bData);
  295.                         }
  296.                         if(bDataBots[bSlots][b_mode]==PLAYER_RECORDING_TYPE_ONFOOT){
  297.                             format(bData,sizeof(bData),"            SetPlayerPos(playerid, %f,%f,%f); \r\n", bDataBots[bSlots][nPos][0],bDataBots[bSlots][nPos][1],bDataBots[bSlots][nPos][2]);
  298.                             fwrite(bDatas, bData);
  299.                             format(bData,sizeof(bData),"            SetPlayerFacingAngle(playerid, %f); \r\n", bDataBots[bSlots][nPos][3]);
  300.                             fwrite(bDatas, bData);
  301.                         }
  302.                         if(bDataBots[bSlots][b_mode]==PLAYER_RECORDING_TYPE_DRIVER){
  303.                             format(bData,sizeof(bData),"            PutPlayerInVehicle(playerid, bVehicle_%s, %d); \r\n", bDataBots[bSlots][b_name], bDataBots[bSlots][b_seat]);
  304.                             fwrite(bDatas, bData);
  305.                         }
  306.                         fwrite(bDatas, "        }\r\n");
  307.                     }
  308.                     fwrite(bDatas, "    }\r\n");
  309.                     fwrite(bDatas, "    return true;\r\n");
  310.                     fwrite(bDatas, "}\r\n");
  311.                     fwrite(bDatas, " // Sistema de grabacion de npc - By OTACON //\r\n");
  312.                     fclose(bDatas);
  313.  
  314.                     for(new bSlots=1; bSlots<more_bots+1; bSlots++){
  315.                         if(bDataBots[bSlots][b_mode]==PLAYER_RECORDING_TYPE_ONFOOT) DestroyActor(bDataBots[bSlots][b_actors]);
  316.                         else if(bDataBots[bSlots][b_mode]==PLAYER_RECORDING_TYPE_DRIVER) DestroyVehicle(bDataBots[bSlots][b_actors]);
  317.                         DestroyObject(bDataBots[bSlots][id_actors]);
  318.                         bDataBots[bSlots][nPos][0] = 0.0;
  319.                         bDataBots[bSlots][nPos][1] = 0.0;
  320.                         bDataBots[bSlots][nPos][2] = 0.0;
  321.                         bDataBots[bSlots][nPos][3] = 0.0;
  322.                         bDataBots[bSlots][b_vehicle] = -1;
  323.                         bDataBots[bSlots][b_seat] = -1;
  324.                         bDataBots[bSlots][b_mode] = -1;
  325.                         bDataBots[bSlots][b_skin] = -1;
  326.                         bDataBots[bSlots][b_weapons] = -1;
  327.                         bDataBots[bSlots][b_name][0] ='\0';
  328.                         bDataBots[bSlots][b_armour] = 0.0;
  329.                         bDataBots[bSlots][b_descripction][0] = '\0';
  330.                         Delete3DTextLabel(bDataBots[bSlots][bText]);
  331.                     }
  332.                     InfoDataBots[playerid][RecNPC] = false;
  333.                     InfoDataBots[playerid][EditorNPC] = false;
  334.                     InfoDataBots[playerid][SaveNPC] = false;
  335.                     InfoDataBots[playerid][SelectNPC] = false;
  336.                     more_bots = 0;
  337.                     select_bots = 0;
  338.  
  339.                     SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Sistema de grabacion de npc, {CB0000}apagado{FFFFFF}!.");
  340.                     SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Sistema de grabacion de npc, {FFFFFF}reiniciado{FFFFFF}!.");
  341.                     CallLocalFunction("OnPlayerCommandText","is",playerid,"/npc");
  342.                 }
  343.             }
  344.         }
  345.     }
  346.     return true;
  347. }
  348.  
  349. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
  350.     new bData[300],
  351.         Float:bPos[4],
  352.         bWeapon[32],
  353.         bTexto[24];
  354.     switch(dialogid){
  355.    
  356.         case DIALOG_NPC+0:{
  357.             if(response){
  358.                 if(!sscanf(inputtext, "s[24]", bTexto)){
  359.                     if(strlen(bTexto)>=4 && strlen(bTexto)<=24){
  360.                         more_bots++;
  361.                         format(bDataBots[more_bots][b_name],24,"%s",bTexto);
  362.                         format(bData,sizeof(bData),"{FFFFFF}INFO: {FFE300}usted ha establecido el nombre: {FFFFFF}%s {FFE300}para el npc: {FFFFFF}%d.", bDataBots[more_bots][b_name], more_bots);
  363.                         SendClientMessage(playerid,-1,bData);
  364.                         SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Ahora selecciona el modo en que grabaras el npc{FFFFFF}!.");
  365.  
  366.                         ShowPlayerDialog(playerid,DIALOG_NPC+1, DIALOG_STYLE_MSGBOX, "{FFE300}Sistema de grabacion de npc:", "\
  367.                         {FFFFFF}INFO: Ahora selecciona el modo en que grabaras el npc: ", "a pie", "en vehiculo");
  368.                     }else{
  369.                         ShowPlayerDialog(playerid,DIALOG_NPC+0, DIALOG_STYLE_INPUT, "{FFE300}Sistema de grabacion de npc:", "\
  370.                         {FFFFFF}INFO: Escribe un nombre para el npc que vas a crear a continuacion: \n\
  371.                         {CB0000}NOTA: no ir por debajo de 4, ni ir por arriba de 24, caracteres,", "aceptar", "cancelar");
  372.                     }
  373.                 }else{
  374.                     ShowPlayerDialog(playerid,DIALOG_NPC+0, DIALOG_STYLE_INPUT, "{FFE300}Sistema de grabacion de npc:", "\
  375.                     {FFFFFF}INFO: Escribe un nombre para el npc que vas a crear a continuacion: \n\
  376.                     {CB0000}NOTA: no ir por debajo de 4, ni ir por arriba de 24, caracteres,", "aceptar", "cancelar");
  377.                 }
  378.             }else CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  379.         }
  380.        
  381.         case DIALOG_NPC+1:{
  382.             if(response){
  383.                 bDataBots[more_bots][b_mode] = PLAYER_RECORDING_TYPE_ONFOOT;
  384.                 InfoDataBots[playerid][EditorNPC] = true;
  385.                 SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}usted ha establecido el modo de grabacion {FFFFFF}a pie.");
  386.                 SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Sistema de grabacion de npc, {00A700}encendido{FFFFFF}!.");
  387.             }else{
  388.                 bDataBots[more_bots][b_mode] = PLAYER_RECORDING_TYPE_DRIVER;
  389.                 InfoDataBots[playerid][EditorNPC] = true;
  390.                 SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}usted ha establecido el modo de grabacion {FFFFFF}en vehiculo.");
  391.                 SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Sistema de grabacion de npc, {00A700}encendido{FFFFFF}!.");
  392.             }
  393.         }
  394.        
  395.         case DIALOG_NPC+2:{
  396.             if(!response) CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  397.         }
  398.  
  399.         case DIALOG_NPC+3:{
  400.             if(response){
  401.                 switch(listitem){
  402.                     case 0:{
  403.                         if(select_bots == 0){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  404.                                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted no ha seleccionado ningun npc grabado, hasta el momento{FFFFFF}!.");}
  405.                         if(bDataBots[select_bots][b_mode]==PLAYER_RECORDING_TYPE_DRIVER){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  406.                                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Este npc no esta grabado a pie{FFFFFF}!.");}
  407.                                
  408.                         ShowPlayerDialog(playerid,DIALOG_NPC+4, DIALOG_STYLE_INPUT, "{FFE300}Sistema de grabacion de npc:", "\
  409.                         {FFFFFF}INFO: Escribe una breve descripcion para el npc grabado seleccionado: \n\
  410.                         {CB0000}NOTA: no ir por debajo de 4, ni ir por arriba de 24, caracteres,", "aceptar", "cancelar");
  411.                     }
  412.                     case 1:{
  413.                         if(select_bots == 0){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  414.                                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted no ha seleccionado ningun npc grabado, hasta el momento{FFFFFF}!.");}
  415.                         if(bDataBots[select_bots][b_mode]==PLAYER_RECORDING_TYPE_DRIVER){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  416.                                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Este npc no esta grabado a pie{FFFFFF}!.");}
  417.                                
  418.                         if(bDataBots[select_bots][b_armour]>0.0) format(bData,sizeof(bData),"{FFFFFF}INFO: estado de armadura: {00A700}tiene armadura.{FFFFFF}");
  419.                         else format(bData,sizeof(bData),"{FFFFFF}INFO: estado de armadura: {CB0000}no tiene armadura.{FFFFFF}");
  420.                         ShowPlayerDialog(playerid,DIALOG_NPC+5, DIALOG_STYLE_MSGBOX, "{FFE300}Sistema de grabacion de npc:", bData, "aceptar", "cancelar");
  421.                     }
  422.                     case 2:{
  423.                         if(select_bots == 0){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  424.                                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted no ha seleccionado ningun npc grabado, hasta el momento{FFFFFF}!.");}
  425.                         if(bDataBots[select_bots][b_mode]==PLAYER_RECORDING_TYPE_DRIVER){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  426.                                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Este npc no esta grabado a pie{FFFFFF}!.");}
  427.                                
  428.                         GetWeaponName(bDataBots[select_bots][b_weapons], bWeapon, sizeof(bWeapon));
  429.                         format(bData,sizeof(bData),"{FFFFFF}\n\t\t * visualizando armamento: [ %s ] \n\n\
  430.                         \t\t{FFE300}>>: selecciona la opcion que prefieras: \n\
  431.                         opcion - armamento '>>' \n\
  432.                         opcion - armamento '<<' \n\
  433.                         opcion - armamento 'random'  \n", bWeapon);
  434.                         ShowPlayerDialog(playerid, DIALOG_NPC+6, DIALOG_STYLE_LIST, "{FFE300}Sistema de grabacion de npc:", bData, "seleccionar", "finalizar");
  435.                     }
  436.                     case 3:{
  437.                         if(select_bots == 0){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  438.                                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted no ha seleccionado ningun npc grabado, hasta el momento{FFFFFF}!.");}
  439.                         if(bDataBots[select_bots][b_mode]==PLAYER_RECORDING_TYPE_DRIVER){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  440.                                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Este npc no esta grabado a pie{FFFFFF}!.");}
  441.                                
  442.                         format(bData,sizeof(bData),"{FFFFFF}\n\t\t * visualizando vestimenta: [ %d / 311 ] \n\n\
  443.                         \t\t{FFE300}>>: selecciona la opcion que prefieras: \n\
  444.                         opcion - vestimenta '>>' \n\
  445.                         opcion - vestimenta '<<' \n\
  446.                         opcion - vestimenta 'random'  \n",bDataBots[select_bots][b_skin]);
  447.                         ShowPlayerDialog(playerid, DIALOG_NPC+7, DIALOG_STYLE_LIST, "{FFE300}Sistema de grabacion de npc:", bData, "seleccionar", "finalizar");
  448.                     }
  449.                     case 4:{
  450.                         if(select_bots == 0){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  451.                                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Usted no ha seleccionado ningun npc grabado, {FFFFFF}!.");}
  452.                         if(bDataBots[select_bots][b_mode]==PLAYER_RECORDING_TYPE_ONFOOT){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  453.                                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}Este npc no esta grabado en vehiculo{FFFFFF}!.");}
  454.  
  455.                         format(bData,sizeof(bData),"{FFFFFF}\n\t\t * visualizando vehiculo: [ %d / 609 ] \n\n\
  456.                         \t\t{FFE300}>>: selecciona la opcion que prefieras: \n\
  457.                         opcion - vehiculo '>>' \n\
  458.                         opcion - vehiculo '<<' \n\
  459.                         opcion - vehiculo 'random'  \n",bDataBots[select_bots][b_vehicle]);
  460.                         ShowPlayerDialog(playerid, DIALOG_NPC+8, DIALOG_STYLE_LIST, "{FFE300}Sistema de grabacion de npc:", bData, "seleccionar", "finalizar");
  461.                     }
  462.                     case 5:{
  463.                         if(more_bots == 0){CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");\
  464.                                 return SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFDC00}Usted no ha grabado ningun npc, hasta el momento{FFFFFF}!.");}
  465.  
  466.                         InfoDataBots[playerid][SelectNPC] = true;
  467.                         SelectObject(playerid);
  468.                         SendClientMessage(playerid,-1,"{FFFFFF}INFO: {FFE300}ahora selecciona a un npc para su edicion{FFFFFF}!.");
  469.                         SendClientMessage(playerid,-1,"{FFDC00}NOTA: para cambiar la camara cuando estas en modo edicion,");
  470.                         SendClientMessage(playerid,-1,"{FFDC00}manten la tecla 'BARRA' y mueve el 'mouse' para cambiarla!.");
  471.                     }
  472.                     case 6: CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  473.                 }
  474.             }else CallLocalFunction("OnPlayerCommandText","is",playerid,"/npc");
  475.         }
  476.  
  477.         case DIALOG_NPC+4:{
  478.             if(response){
  479.                 if(!sscanf(inputtext, "s[24]", bTexto)){
  480.                     if(strlen(bTexto)>=4 && strlen(bTexto)<=24){
  481.                         format(bDataBots[select_bots][b_descripction],24,"%s",bTexto);
  482.                         Delete3DTextLabel(bDataBots[select_bots][bText]);
  483.                         bDataBots[select_bots][bText] = Create3DTextLabel(\"_",-1, bDataBots[select_bots][nPos][0],bDataBots[select_bots][nPos][1],bDataBots[select_bots][nPos][2],10,-1,0);
  484.                         Update3DTextLabelText(bDataBots[select_bots][bText], -1, bDataBots[select_bots][b_name]);
  485.                        
  486.                         format(bData,sizeof(bData),"{FFFFFF}INFO: {FFDC00}texto de la descripcion: {FFFFFF}'%s' para el {FFFFFF}'npc id:%d'FFFFFF}!.", bDataBots[select_bots][b_descripction],select_bots);
  487.                         SendClientMessage(playerid,-1,bData);
  488.                         CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  489.                     }else{
  490.                         ShowPlayerDialog(playerid,DIALOG_NPC+4, DIALOG_STYLE_INPUT, "{FFE300}Sistema de grabacion de npc:", "\
  491.                         {FFFFFF}INFO: Escribe una breve descripcion para el npc grabado seleccionado: \n\
  492.                         {CB0000}NOTA: no ir por debajo de 4, ni ir por arriba de 24, caracteres,", "aceptar", "cancelar");
  493.                     }
  494.                 }else{
  495.                     ShowPlayerDialog(playerid,DIALOG_NPC+4, DIALOG_STYLE_INPUT, "{FFE300}Sistema de grabacion de npc:", "\
  496.                     {FFFFFF}INFO: Escribe una breve descripcion para el npc grabado seleccionado: \n\
  497.                     {CB0000}NOTA: no ir por debajo de 4, ni ir por arriba de 24, caracteres,", "aceptar", "cancelar");
  498.                 }
  499.             }else CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  500.         }
  501.        
  502.         case DIALOG_NPC+5:{
  503.             if(response){
  504.                 if(bDataBots[select_bots][b_armour]<=0.0) bDataBots[select_bots][b_armour] = 100.0;
  505.                 else bDataBots[select_bots][b_armour] = 0.0;
  506.  
  507.                 if(bDataBots[select_bots][b_armour]>0.0) format(bData,sizeof(bData),"{FFFFFF}INFO: estado de armadura: {00A700}tiene armadura.{FFFFFF}");
  508.                 else format(bData,sizeof(bData),"{FFFFFF}INFO: estado de armadura: {CB0000}no tiene armadura.{FFFFFF}");
  509.                 ShowPlayerDialog(playerid,DIALOG_NPC+5, DIALOG_STYLE_MSGBOX, "{FFE300}Sistema de grabacion de npc:", bData, "aceptar", "cancelar");
  510.             }else CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  511.         }
  512.        
  513.         case DIALOG_NPC+6:{
  514.             if(response){
  515.                 switch(listitem){
  516.                     case 0..2: CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  517.                     case 3:{
  518.                         bDataBots[select_bots][b_weapons]++;
  519.                         switch(bDataBots[select_bots][b_weapons]){
  520.                             case 19,20,21: bDataBots[select_bots][b_weapons] = 22;
  521.                         }
  522.                     }
  523.                     case 4:{
  524.                         bDataBots[select_bots][b_weapons]--;
  525.                         switch(bDataBots[select_bots][b_weapons]){
  526.                             case 19,20,21: bDataBots[select_bots][b_weapons] = 18;
  527.                         }
  528.                     }
  529.                     case 5:{
  530.                         new rand = random(46);
  531.                         switch(rand){
  532.                             case 0..46:{
  533.                                 switch(rand){
  534.                                     case 19,20,21: bDataBots[select_bots][b_weapons] = 22;
  535.                                     default: bDataBots[select_bots][b_weapons] = rand;
  536.                                 }
  537.                             }
  538.                         }
  539.                     }
  540.                 }
  541.                 if(bDataBots[select_bots][b_weapons]>=46) bDataBots[select_bots][b_weapons] = 46;
  542.                 else if(bDataBots[select_bots][b_weapons]<=0) bDataBots[select_bots][b_weapons] = 0;
  543.                
  544.                 GetWeaponName(bDataBots[select_bots][b_weapons], bWeapon, sizeof(bWeapon));
  545.                 format(bData,sizeof(bData),"{FFFFFF}\n\t\t * visualizando armamento: [ %s ] \n\n\
  546.                 \t\t{FFE300}>>: selecciona la opcion que prefieras: \n\
  547.                 opcion - armamento '>>' \n\
  548.                 opcion - armamento '<<' \n\
  549.                 opcion - armamento 'random'  \n", bWeapon);
  550.                 ShowPlayerDialog(playerid, DIALOG_NPC+6, DIALOG_STYLE_LIST, "{FFE300}Sistema de grabacion de npc:", bData, "seleccionar", "finalizar");
  551.             }else CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  552.         }
  553.        
  554.         case DIALOG_NPC+7:{
  555.             if(response){
  556.                 switch(listitem){
  557.                     case 0..2: CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  558.                     case 3: bDataBots[select_bots][b_skin]++;
  559.                     case 4: bDataBots[select_bots][b_skin]--;
  560.                     case 5: bDataBots[select_bots][b_skin]=random(311);
  561.                 }
  562.                 if(bDataBots[select_bots][b_skin]>=311) bDataBots[select_bots][b_skin] = 311;
  563.                 else if(bDataBots[select_bots][b_skin]<=0) bDataBots[select_bots][b_skin] = 0;
  564.  
  565.                 GetActorPos(bDataBots[select_bots][b_actors], bPos[0],bPos[1],bPos[2]);
  566.                 GetActorFacingAngle(bDataBots[select_bots][b_actors], bPos[3]);
  567.                 DestroyActor(bDataBots[select_bots][b_actors]);
  568.                 bDataBots[select_bots][b_actors] = CreateActor(bDataBots[select_bots][b_skin], bPos[0],bPos[1],bPos[2],bPos[3]);
  569.                
  570.                 format(bData,sizeof(bData),"{FFFFFF}\n\t\t * visualizando vestimenta: [ %d / 311 ] \n\n\
  571.                 \t\t{FFE300}>>: selecciona la opcion que prefieras: \n\
  572.                 opcion - vestimenta '>>' \n\
  573.                 opcion - vestimenta '<<' \n\
  574.                 opcion - vestimenta 'random'  \n",bDataBots[select_bots][b_skin]);
  575.                 ShowPlayerDialog(playerid, DIALOG_NPC+7, DIALOG_STYLE_LIST, "{FFE300}Sistema de grabacion de npc:", bData, "seleccionar", "finalizar");
  576.             }else CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  577.         }
  578.        
  579.         case DIALOG_NPC+8:{
  580.             if(response){
  581.                 switch(listitem){
  582.                     case 0..2: CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  583.                     case 3: bDataBots[select_bots][b_vehicle]++;
  584.                     case 4: bDataBots[select_bots][b_vehicle]--;
  585.                     case 5:{
  586.                         new rand = random(610);
  587.                         switch(rand){
  588.                             case 400..609: bDataBots[select_bots][b_vehicle] = rand;
  589.                         }
  590.                     }
  591.                 }
  592.                 if(bDataBots[select_bots][b_vehicle]>=609) bDataBots[select_bots][b_vehicle] = 609;
  593.                 else if(bDataBots[select_bots][b_vehicle]<=400) bDataBots[select_bots][b_vehicle] = 400;
  594.                
  595.                 GetVehiclePos(bDataBots[select_bots][b_actors], bPos[0],bPos[1],bPos[2]);
  596.                 GetVehicleZAngle(bDataBots[select_bots][b_actors], bPos[3]);
  597.                 DestroyVehicle(bDataBots[select_bots][b_actors]);
  598.                 bDataBots[select_bots][b_actors] = CreateVehicle(bDataBots[select_bots][b_vehicle], bPos[0],bPos[1],bPos[2],bPos[3],random(200),random(200),99999);
  599.                
  600.                 format(bData,sizeof(bData),"{FFFFFF}\n\t\t * visualizando vehiculo: [ %d / 609 ] \n\n\
  601.                 \t\t{FFE300}>>: selecciona la opcion que prefieras: \n\
  602.                 opcion - vehiculo '>>' \n\
  603.                 opcion - vehiculo '<<' \n\
  604.                 opcion - vehiculo 'random'  \n",bDataBots[select_bots][b_vehicle]);
  605.                 ShowPlayerDialog(playerid, DIALOG_NPC+8, DIALOG_STYLE_LIST, "{FFE300}Sistema de grabacion de npc:", bData, "seleccionar", "finalizar");
  606.             }else CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  607.         }
  608.     }
  609.     return false;
  610. }
  611.  
  612. public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ){
  613.     new bData[200];
  614.     if(type==SELECT_OBJECT_GLOBAL_OBJECT){
  615.         if(InfoDataBots[playerid][SelectNPC]){
  616.             select_bots = objectid;
  617.             CancelEdit(playerid);
  618.             InfoDataBots[playerid][SelectNPC] = false;
  619.             format(bData,sizeof(bData),"{FFFFFF}INFO: {FFDC00}Usted ha seleccionado al {FFFFFF}npc id:%d' {FFDC00}para su edicion{FFFFFF}!.", select_bots);
  620.             SendClientMessage(playerid,-1,bData);
  621.             CallLocalFunction("OnPlayerCommandText","is",playerid,"/npcedit");
  622.         }
  623.     }
  624.     return true;
  625. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement