Jump to content
  • 0

Requesting @item (bindatcmd) w/ Password system


Limestone

Question


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.03
  • Content Count:  647
  • Reputation:   16
  • Joined:  11/21/11
  • Last Seen:  

hi folks! i just want to request a bindcmd script that if a GM use @item for the first time, the script will show a menu Setup password, Change password, cancel

 

then after i set a password, when i use @item again. i will input the password i made, then after that i will put the item_id, amount.

 

thanks!

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

-	script	item_cmd	-1,{
OnInit:
	bindatcmd "item",strnpcinfo(3)+"::OnAtcommand",60,60;// your min gmlevel
	end;
OnAtcommand:
	.@amount = atoi( .@atcmd_parameters$[1] );
	.@amount = .@amount < 1 ? 1 : .@amount;
	.@myname$ = strcharinfo(0);
	if ( .@atcmd_numparameters == 0 ) {
		message .@myname$, "Please enter an item name or ID (usage: @item <item name/ID> <quantity>).";
		message .@myname$, "@item failed.";
		end;
	}
	if ( countstr( .@atcmd_parameters$[0], ":" ) ) {
		explode( .@dummy$, .@atcmd_parameters$[0], ":" );
		.@size = getarraysize( .@dummy$ );
		while( .@i < .@size ) {
			.@item_id[.@i] = atoi( .@dummy$[.@i] );
			if ( .@item_id[.@i] == 0 && getstrlen( .@dummy$[.@i] ) > 2 )
				.@count = !searchitem( .@item_id[.@i],.@dummy$[.@i] );
			if ( .@count || getiteminfo( .@item_id[.@i],0 ) == -1 ) {
				message .@myname$, "Invalid item ID or name.";
				message .@myname$, "@item failed.";
				end;
			}
			.@count = 0;
			.@i++;
		}
	}
	else {
		.@item_id = atoi( .@atcmd_parameters$[0] );
		if ( .@item_id == 0 && getstrlen( .@atcmd_parameters$[0] ) > 2 )
			.@count = !searchitem( .@item_id,.@atcmd_parameters$[0] );
		if ( .@count || getiteminfo( .@item_id,0 ) == -1 ) {
			message .@myname$, "Invalid item ID or name.";
			message .@myname$, "@item failed.";
			end;
		}
		.@size = 1;
	}
	if ( #item_cmd_password$ == "" ) {
	L_password:
		message .@myname$, "Please set your @item password (length must be between 4-10).";
		if ( input( .@tmp$, 4,10 ) != 0 ) {
			message .@myname$, "The length must be between 4-10.";// => cancel
			end;
		}
		message .@myname$, "Your @item password is now : "+ .@tmp$;
		#item_cmd_password$ = .@tmp$;
	}
	else {
		message .@myname$, "Your @item password ?";
		input .@tmp$;
		if ( .@tmp$ != #item_cmd_password$ ) {
			message .@myname$, "Wrong password.";
			end;
		}
		if ( select( "Continue", "Change password" ) == 2 )
			goto L_password;
	}
	while( .@j < .@size ) {
		getitem .@item_id[.@j], .@amount;
		.@j++;
	}
	message .@myname$, "Item created.";
	end;
}

it supports item name/ID and multi item name/ID

@item <item name/ID>{:<item name/ID>:...} {<amount>}

/item <item name>

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.03
  • Content Count:  647
  • Reputation:   16
  • Joined:  11/21/11
  • Last Seen:  

Thank you so much capuche! <3 <3 <3

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

the script can be done with atcommand too

-	script	item_cmd	-1,{
OnInit:
	bindatcmd "item",strnpcinfo(3)+"::OnAtcommand",60,60;// your min gmlevel
	end;
OnAtcommand:
	.@myname$ = strcharinfo(0);
	if ( #item_cmd_password$ == "" ) {
	L_password:
		message .@myname$, "Please set your @item password (length must be between 4-10).";
		if ( input( .@tmp$, 4,10 ) != 0 ) {
			message .@myname$, "The length must be between 4-10.";// => cancel
			end;
		}
		message .@myname$, "Your @item password is now : "+ .@tmp$;
		#item_cmd_password$ = .@tmp$;
	}
	else {
		message .@myname$, "Your @item password ?";
		input .@tmp$;
		if ( .@tmp$ != #item_cmd_password$ ) {
			message .@myname$, "Wrong password.";
			end;
		}
		if ( select( "Continue", "Change password" ) == 2 )
			goto L_password;
	}
	atcommand "@item "+ .@atcmd_parameters$[0] +" "+ .@atcmd_parameters$[1];
	end;
}

but it was fun to make the script without it

both working

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.03
  • Content Count:  647
  • Reputation:   16
  • Joined:  11/21/11
  • Last Seen:  

hi capuche, sometimes when i try to use this command, im stuck up. my one server uses hercules, can you make compatible for herc? thanks!

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

The second version should work on hercules

http://rathena.org/board/topic/87702-requesting-item-bindatcmd-w-password-system/?p=223987

However what do you mean by 'stuck'? do you have any error on your mapserv?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.03
  • Content Count:  647
  • Reputation:   16
  • Joined:  11/21/11
  • Last Seen:  

i dont have errors in map server, i dont know why it doesnt works in hercules.

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