Jump to content
  • 0

Help about this function


Question

Posted

I'm planning to make an item that gives immunity for a player that lasts a minute and can only be used on a specific map (i use ein_dun02)

getmapxy(@mapname$,@mapx,@mapy,0)
if(@mapname$ == "ein_dun02") {
attachnpctimer getcharid(3);
atcommand "@battleignore";
dispbottom "Item effect will last 1 minute or upon logging out.";
initnpctimer;
}
OnTimer60000:
OnTimerQuit:
atcommand "@battleignore";
end;

But i think something is wrong in which item effect will stack... x_x Someone can edit my code to make free of exploit?

3 answers to this question

Recommended Posts

Posted

  • 'initnpctimer' can only run one object. You're looking for 'addtimer'.
  • Instead of 'getmapxy', you can use strcharinfo(3) to retrieve map info.
  • You didn't write any 'end' after the condition and are missing a semicolon, plus OnTimerQuit is never called. o.o

/* Item script */
if (strcharinfo(3) != "ein_dun02") end;
if (@battleignore) {
dispbottom "You can only run one instance of this item.";
end;
} else
set @battleignore,1;
addtimer 60000,"battleignore::OnStop";
atcommand "@battleignore";
dispbottom "Item effect will last 1 minute or upon logging out.";
end;

-	script	battleignore	-1,{
OnStop:
atcommand "@battleignore";
set @battleignore,0;
end;
}

  • Upvote 1
Posted (edited)

What about to use sc_invincible instead? I find it more practical..

sc_start	sc_invincible	60000;

Edit: I hope that bonus wasn't been nerfed or deleted.

Edited by Ryokem

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...