Help ! Convert the source

rodney2210

New member
Messages
4
Points
0
Hello, I would like to ask help from you guys this command to convert the SRC to reconcile with the current hercules emulator:

+/* ====================================================== *
+ * @cloneskill [Hold]
+ *  <> Permite ao jogador plagiar qualquer habilidade
+ * Uso:
+ *  <>  @cloneskill <id/nome da habilidade> <nível> <tipo>
+ * tipo:
+ *  <>  0 = Copiada através da habilidade Plágio
+ *  <>  1 = Copiada através da habilidade Mimetismo
+ * ------------------------------------------------------ */
+ACMD_FUNC(cloneskill)
+{
+  char name[255];
+  int id, lvl, type = 0, oldskreg;
+  nullpo_retr(-1, sd);
+
+  if (!message || !*message || (
+    sscanf(message, ""%99[^"]" %d %d", name, &lvl, &type) < 2 &&
+    sscanf(message, "%99s %d %d", name, &lvl, &type) < 2 ))
+  {
+    clif_displaymessage(fd, "Você precisa inserir ID e Nível da habilidade.");
+    return -1;
+  }
+
+  if(!(id = skill_name2id(name)) && !(id = skill_get_index(atoi(name))))
+  {
+    clif_displaymessage(fd, "Nome ou ID da habilidade são inválidos.");
+    return -1;
+  }
+
+  if(oldskreg = pc_readglobalreg(sd, ((type) ? "REPRODUCE_SKILL" : "CLONE_SKILL")))
+  {
+    sd->status.skill[oldskreg].id = 0;
+    sd->status.skill[oldskreg].lv = 0;
+    sd->status.skill[oldskreg].flag = 0;
+    clif_deleteskill(sd, oldskreg);
+  }
+
+  sd->status.skill[id].id = id;
+  sd->status.skill[id].lv = lvl;
+  sd->status.skill[id].flag = SKILL_FLAG_PLAGIARIZED;
+  if(type)
+    sd->reproduceskill_id = id;
+  else
+    sd->cloneskill_id = id;
+
+  pc_setglobalreg(sd, ((type) ? "REPRODUCE_SKILL" : "CLONE_SKILL"), id);
+  pc_setglobalreg(sd, ((type) ? "REPRODUCE_SKILL_LV" : "CLONE_SKILL_LV"), lvl);
+
+  clif_addskill(sd, id);
+
+  sprintf(atcmd_output,"Habilidade: '%s' | Nível: '%d' | Utilizando: '%s'", skill_get_name(id), lvl, ((type) ? "Mimetismo" : "Plágio"));
+  clif_displaymessage(fd, atcmd_output);
+
+  return 0;
+}
+
 /**
  * Fills the reference of available commands in atcommand DBMap
  **/
@@ -8796,6 +8852,7 @@
     ACMD_DEF(skillid),
     ACMD_DEF(useskill),
     ACMD_DEF(displayskill),
+    ACMD_DEF(cloneskill),
     ACMD_DEF(snow),
     ACMD_DEF(sakura),
     ACMD_DEF(clouds),
 
Thanks from now!

 
Last edited by a moderator:
Code:
/* ====================================================== * * @cloneskill [Hold] *    <> Permite ao jogador plagiar qualquer habilidade * Uso: *    <>    @cloneskill <id/nome da habilidade> <nível> <tipo> * tipo: *    <>    0 = Copiada através da habilidade Plágio *    <>    1 = Copiada através da habilidade Mimetismo * ------------------------------------------------------ */ACMD(cloneskill){    char name[255];    int id, lvl, type = 0, oldskreg;    if (!message || !*message || (         sscanf(message, ""%99[^"]" %d %d", name, &lvl, &type) < 2 &&         sscanf(message, "%99s %d %d", name, &lvl, &type) < 2 )       )    {        clif->message(fd, "Voce precisa inserir ID e Nivel da habilidade.");        return false;    }    if(!(id = skill->name2id(name)) && !(id = skill->get_index(atoi(name))))    {        clif->message(fd, "Nome ou ID da habilidade sao invalidos.");        return false;    }    if(oldskreg = pc_readglobalreg(sd,script->add_str( ((type) ? "REPRODUCE_SKILL" : "CLONE_SKILL"))))    {        sd->status.skill[oldskreg].id = 0;        sd->status.skill[oldskreg].lv = 0;        sd->status.skill[oldskreg].flag = 0;        clif->deleteskill(sd, oldskreg);    }    sd->status.skill[id].id = id;    sd->status.skill[id].lv = lvl;    sd->status.skill[id].flag = SKILL_FLAG_PLAGIARIZED;    if(type)        sd->reproduceskill_id = id;    else        sd->cloneskill_id = id;    pc_setglobalreg(sd, script->add_str( ((type) ? "REPRODUCE_SKILL" : "CLONE_SKILL")), id);    pc_setglobalreg(sd, script->add_str( ((type) ? "REPRODUCE_SKILL_LV" : "CLONE_SKILL_LV")), lvl);    clif->addskill(sd, id);    sprintf(atcmd_output,"Habilidade: '%s' | Nivel: '%d' | Utilizando: '%s'", skill->get_name(id), lvl, ((type) ? "Mimetismo" : "Plagio"));    clif->message(fd, atcmd_output);    return true;}
Code:
ACMD_DEF(cloneskill),
 
Last edited by a moderator:
/* ====================================================== * * @cloneskill [Hold] * <> Permite ao jogador plagiar qualquer habilidade * Uso: * <> @cloneskill <id/nome da habilidade> <nível> <tipo> * tipo: * <> 0 = Copiada através da habilidade Plágio * <> 1 = Copiada através da habilidade Mimetismo * ------------------------------------------------------ */ACMD(cloneskill){ char name[255]; int id, lvl, type = 0, oldskreg; if (!message || !*message || ( sscanf(message, ""[^"]" %d %d", name, &lvl, &type) < 2 && sscanf(message, "s %d %d", name, &lvl, &type) < 2 )) { clif->message(fd, "Voce precisa inserir ID e Nivel da habilidade."); return false; } if(!(id = skill->name2id(name)) && !(id = skill->get_index(atoi(name)))) { clif->message(fd, "Nome ou ID da habilidade sao invalidos."); return false; } if(oldskreg = pc_readglobalreg(sd,script->add_str( ((type) ? "REPRODUCE_SKILL" : "CLONE_SKILL")))) { sd->status.skill[oldskreg].id = 0; sd->status.skill[oldskreg].lv = 0; sd->status.skill[oldskreg].flag = 0; clif->deleteskill(sd, oldskreg); } sd->status.skill[id].id = id; sd->status.skill[id].lv = lvl; sd->status.skill[id].flag = SKILL_FLAG_PLAGIARIZED; if(type) sd->reproduceskill_id = id; else sd->cloneskill_id = id; pc_setglobalreg(sd, script->add_str( ((type) ? "REPRODUCE_SKILL" : "CLONE_SKILL")), id); pc_setglobalreg(sd, script->add_str( ((type) ? "REPRODUCE_SKILL_LV" : "CLONE_SKILL_LV")), lvl); clif->addskill(sd, id); sprintf(atcmd_output,"Habilidade: '%s' | Nivel: '%d' | Utilizando: '%s'", skill->get_name(id), lvl, ((type) ? "Mimetismo" : "Plagio")); clif->message(fd, atcmd_output); return true;}
Code:
ACMD_DEF(cloneskill),
I write @cloneskill put the id and the level of skill, but even so the skill that failed.

example:

@cloneskill 89 10

skill has failed

 
I write @cloneskill put the id and the level of skill, but even so the skill that failed.

example:

@cloneskill 89 10

skill has failed
Sorry, fixed typo try again

bjmGDum0.jpg
 
Last edited by a moderator:
Back
Top