Jump to content
  • 0

Help on this .diff error for PCSkillUseEvent


eezclide

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  12
  • Reputation:   0
  • Joined:  05/31/14
  • Last Seen:  

ive been tryin to figure our what's the prob here. Im not that good yet in scripting

 

/**
* Jezznar
* getskillname (skillid);
**/
BUILDIN_FUNC(getskillname)
 {
    int skill_id;
    char *skill_name;
        //get input skill_id
        if (!script_hasdata(st, 2)) {
        script_pushconststr(st, "null");
        return SCRIPT_CMD_SUCCESS;
        
    }
        skill_id = script_getnum(st, 2);
    
        if (!skill_get_index(skill_id)) {
        ShowError("script:conv_str: Unknown skill_id supplied.\"\n");
        script_pushconststr(st, "null");
        return SCRIPT_CMD_SUCCESS;
        
    }
    skill_name = (char *)aMalloc(SKILL_NAME_LENGTH * sizeof(char));
    memcpy(skill_name, skill_db[skill_get_index(skill_id)]->desc, SKILL_DESC_LENGTH);
    script_pushstr(st, skill_name);
    
        return SCRIPT_CMD_SUCCESS;
    }
 

image.png.2496d27d24a9316e0a8d062c67f956ef.png

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

try

BUILDIN_FUNC(getskillname)
{
	int skill_id;
	//get input skill_id
	if (!script_hasdata(st, 2)) {
		script_pushconststr(st, "null");
		return SCRIPT_CMD_SUCCESS;

	}
	skill_id = script_getnum(st, 2);
	if (!skill_get_index(skill_id)) {
		ShowError("script:conv_str: Unknown skill_id supplied.\"\n");
		script_pushconststr(st, "null");
		return SCRIPT_CMD_SUCCESS;
	}
	script_pushstr(st, skill_db.find(skill_id)->desc);
	return SCRIPT_CMD_SUCCESS;
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...