Jump to content
  • 0
MikZ

inarray to hercules

Question

Good day!

May I request to convert this script to hercules please.

-	script	GlobalMvP::GlobalMvP	-1,{
OnNPCKillEvent:
	if(inarray(getd(".MVP_" + strcharinfo(3)),killedrid) != -1){
		query_sql "SELECT `name` FROM `mvp` WHERE `char_id`="+getcharid(0)+"",.@name$;
		if ( .@name$ == "" ) { query_sql "INSERT INTO `mvp` (`char_id`,`name`,`kills`,`points`) VALUES (" + getcharid(0) + ",'" + escape_sql(strcharinfo(0)) + "',1,1)"; end; }
		query_sql "UPDATE `mvp` SET `kills` = (`kills` + 1), `points` = (`points` +1) WHERE `char_id`=" + getcharid(0);
	}
end;
	function AddMvP {
		for(.@i=1;.@i<getargcount();.@i++){
			setd ".MVP_" + getarg(0) + "[" + .@i + "]",getarg(.@i);
		}
		return;
	}

OnInit:
	query_sql("CREATE TABLE IF NOT EXISTS `mvp` (`char_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL DEFAULT '0', `kills` int(11) unsigned NOT NULL DEFAULT '0',`points` int(11) unsigned NOT NULL DEFAULT '0', `level` int(11) unsigned NOT NULL DEFAULT '0', KEY `char_id` (`char_id`), KEY `kills` (`kills`), KEY `points` (`level`), KEY `level` (`level`)) ENGINE=MyISAM");
	freeloop(1);
		//AddMvP(<"MAP_NAME">,<MVP ID>{,<MVP ID>});
		//you can add as much as you want mvp ids
		AddMvP("prontera",1002);
		AddMvP("payon",1002,1003,1004);
		AddMvP("geffen",1546);
	freeloop(0);
end;
}

 

Error found:

[Error]: script error in file '(DIRECT INPUT)' line 3 column 10 
    parse_simpleexpr: unmatched ')' 
     1: { 
     2: OnNPCKillEvent: 
*    3:         if(inarray(getd(".MVP_" + strcharinfo(3)),killedrid) != -1){ 

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.