Jump to content
  • 0

atcommand in item


OnNplay

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  141
  • Reputation:   15
  • Joined:  01/08/12
  • Last Seen:  

The script will be placed in the item. Closer to this purpose is Megaphone.

I want selected item will make @item for the selected account id.

When the character of the account id click on it will get input box.

The input box will collect the item name or item code and quantity.

So the character will get the item.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

Just call a function inside the item. Make it an usable item.

{ callfunc "getItem__"; },{},{}

then the function itself..

function    script    getItem__    {

mes "input the ID";
input .@id;

//Code to check if the input is avaible/correct

mes "input the amount";
input .@amount;

//Code to check if the input is avaible/correct

getitem .@id, .@amount;
return;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  592
  • Reputation:   31
  • Joined:  11/14/11
  • Last Seen:  

Ryokem i know this is offtopic but how about

putting a custom item if double click a @command > @autoattack will be used but the with expiration time

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

Yeah, you can add a timer and setting that kinf of command too, exactly in the same way.

Something like...

function	script	command__	{

attachnpctimer getcharid(3);
atcommand "@autoattack";
initnpctimer;
return;

OnTimer60000: //60 seconds
OnTimerQuit:
atcommand "@autoattack";
   end;
}

Note that you have to be careful to use an @command in the OnTimerQuit label, 'cause the player already logged out but it may be still able to run the command.

Edited by Ryokem
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  592
  • Reputation:   31
  • Joined:  11/14/11
  • Last Seen:  

so the problem in the command script is that it can be exploited??

it will delete the item right if its usable?.. thanks

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

Yeah, it will delete the item if you set that the item expires after being used.

And I personally try not to use atcommand command inside scripts unless it's really the only choice I have, mostly 'cause of server runtime.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  141
  • Reputation:   15
  • Joined:  01/08/12
  • Last Seen:  

Thank you. This is really help.

How about with checking account no.

Example, I want it only serve account no. 2000004

other than this account no. the script will be not activated.

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

Thank you. This is really help.

How about with checking account no. example 2000004

if( getcharid(3) == 2000004 ){
 // do what you want here...
}

reference getcharid

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  141
  • Reputation:   15
  • Joined:  01/08/12
  • Last Seen:  

function	script	getItem__	{if( getcharid(3) == 2000004 ){

mes "input the ID";
input .@id;

mes "input the amount";
input .@amount;

getitem .@id, .@amount;
return;
}}

//Code to check if the input is avaible/correct

//Code to check if the input is avaible/correct

Any one please help this fine tuning.

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