Jump to content
  • 0
Eross

How to add parameter on a custom command ??

Question

Hi im trying to create a custom command using bindatcmd .. How to make it like @navto <character name> ???? Thankyou in advance !

Quote

-    script    unit_walk    -1,{
OnInit:
bindatcmd("navto","unit_walk::OnNavigate");
end;

OnNavigate:    
        atcommand "@navto " [email protected]_parameters$[0];
    if (isloggedin(getcharid(0,[email protected]_parameters$[0])) != 1) { message strcharinfo(0), "Target player is offline or do not exist."; }
    sleep2 1; 
    unitwalkto getcharid(3),getcharid(3,[email protected]_parameters$[0]);
}

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Well you can get the full command used with something like:

OnNavigate:
	[email protected]$ = implode([email protected]_parameters$, " ");

	if (isloggedin(getcharid(3, [email protected]$)) != 1) {
		message strcharinfo(0), "Target player '" + [email protected]$ + "' is offline or do not exist.";
	}

	sleep2 1;
	unitwalkto getcharid(3), getcharid(3, [email protected]$);
	end;

Though, unitwalkto is very limited and will most likely fail in most scenarios.

  • Upvote 1
Link to comment
Share on other sites

  • 0
15 hours ago, BeWan said:

@atcmd_parameters$[0] = @navto 
@atcmd_parameters$[1] = strcharinfo(0)

What if character has more spaces on name ?? first parameter I think only goes in first name like ex: BLOOD ... but the 2nd goes to BATH so thats 1st and 2nd parameter BLOOD BATH ... what if theres a player whos name is like "O O O O O O" ??? 

Link to comment
Share on other sites

  • 0
1 minute ago, Origami said:

What if character has more spaces on name ?? first parameter I think only goes in first name like ex: BLOOD ... but the 2nd goes to BATH so thats 1st and 2nd parameter BLOOD BATH ... what if theres a player whos name is like "O O O O O O" ??? 

make a condition.

if player enter the name correct, convert the name into charid

  • Upvote 1
Link to comment
Share on other sites

  • 0
On 5/27/2021 at 9:51 PM, BeWan said:

make a condition.

if player enter the name correct, convert the name into charid

Okay thankyou sir ! very helpful ! Cheers

 

On 5/27/2021 at 10:40 PM, Tokei said:

Well you can get the full command used with something like:

OnNavigate:
	[email protected]$ = implode([email protected]_parameters$, " ");

	if (isloggedin(getcharid(3, [email protected]$)) != 1) {
		message strcharinfo(0), "Target player '" + [email protected]$ + "' is offline or do not exist.";
	}

	sleep2 1;
	unitwalkto getcharid(3), getcharid(3, [email protected]$);
	end;

Though, unitwalkto is very limited and will most likely fail in most scenarios.

omg thankyou so much sir !!!! 

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

Important Information

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