Jump to content
  • 0

R > Command


Question

Posted

i have a request :D can anyone give who know more about src?

like if he type @donate [ He will call a cashshop npc ]

then this is my cash shop

- cashshop donation -1,20200:50,20201:100

22 answers to this question

Recommended Posts

Posted
Index: atcommand.c
===================================================================
--- atcommand.c (revision 16424)
+++ atcommand.c (working copy)
@@ -8580,6 +8580,19 @@
 return 0;
}

+/*==========================================
+ * @donate
+ *------------------------------------------*/
+ACMD_FUNC(donate)
+{
+ struct npc_data *nd = npc_name2id("donate");
+
+ nullpo_retr(-1, sd);
+ 
+ npc_click(sd,nd);
+ return 0;
+}
+
/**
 * Fills the reference of available commands in atcommand DBMap
 **/
@@ -8590,6 +8603,7 @@
  * Command reference list, place the base of your commands here
  **/
 AtCommandInfo atcommand_base[] = {
+ ACMD_DEF(donate),
 ACMD_DEF2("warp", mapmove),
 ACMD_DEF(where),
 ACMD_DEF(jumpto),

  • Upvote 1
Posted (edited)

wow thx i will try it :D

@clydelion. not showing when i type the command but my src is success! no error

my cash shop

-<tab>cashshop<tab>donate<tab>-1,20200:10,20201:50

Edited by bVersatile
Posted (edited)

change

npc_click(sd,nd);

to

clif_cashshop_show(sd,nd);

wow Great! nice. this is my dreams command on my server :D thx!

last request clydelion

how can i do it call a script like when i type @donate [ he will callfunc a npc ]

like this

function<tab>script<tab>donate<tab>{
switch(select("Upper:Middle:Lower")){
       case 1:
                close2;
                callshop "donate";

       bl;ahlbah
}

Edited by bVersatile
Posted

Use atcommand events, if you're updated.

*bindatcmd "command","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};

*bindatcmd("command","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>});

This command will bind a NPC event label to an atcommand. Upon execution of

the atcommand, the user will invoke the NPC event label.

Example:

When a user types the command "@test", an angel effect will be shown.

- script atcmd_example -1,{

OnInit:

bindatcmd("test","atcmd_example::OnAtcommand");

end;

OnAtcommand:

specialeffect2 338;

end;

}

Posted

- script donate -1,{
OnCommand:
switch(select("Upper:Mid:Lower")){
 case 1:
 close2;
 callshop "dupper",1;
 end;
 case 2:
 close2;
 callshop "dmid",1;
 end;
 case 3:
 close2;
 callshop "dlow",1;
 end;

}
}

change the npc call part in atcommand.c to

npc_event(sd,"donate::OnCommand",0);

Posted

- script donate -1,{
OnCommand:
switch(select("Upper:Mid:Lower")){
 case 1:
 close2;
 callshop "dupper",1;
 end;
 case 2:
 close2;
 callshop "dmid",1;
 end;
 case 3:
 close2;
 callshop "dlow",1;
 end;

}
}

change the npc call part in atcommand.c to

npc_event(sd,"donate::OnCommand",0);

what i will change here?

struct npc_data *nd = npc_name2id("donate");

or this

clif_cashshop_show(sd,nd);

?

Posted

@clydelion: So the way to do it without src would be~

-    script    donate    -1,{
OnInit: bindatcmd("donate","donate::OnCommand"); end;
OnCommand:
switch(select("Upper:Mid:Lower")){
case 1:
	close2;
	callshop "dupper",1;
	end;
case 2:
	close2;
	callshop "dmid",1;
	end;
case 3:
	close2;
	callshop "dlow",1;
	end;
}
}

Posted

@clydelion: So the way to do it without src would be~

-	script	donate	-1,{
OnInit: bindatcmd("donate","donate::OnCommand"); end;
OnCommand:
switch(select("Upper:Mid:Lower")){
case 1:
	close2;
	callshop "dupper",1;
	end;
case 2:
	close2;
	callshop "dmid",1;
	end;
case 3:
	close2;
	callshop "dlow",1;
	end;
}
}

i will use it on other commands thx euphy :D

Posted

@Euphy

Do you still need to add @donate to src then it binds on it or bindatcmd creates a new command?

nothing happens clyd

@Euphy

Do you still need to add @donate to src then it binds on it or bindatcmd creates a new command?

nothing happens clyd

Posted (edited)

try Euphy's suggestion

-<tab>script<tab>donate<tab>-1,{
OnInit: bindatcmd("donate","donate::OnCommand"); end;
OnCommand:
switch(select("Upper:Mid:Lower")){
	case 1:
			close2;
			callshop "dupper",1;
			end;
	case 2:
			close2;
			callshop "dmid",1;
			end;
	case 3:
			close2;
			callshop "dlow",1;
			end;
}
}

remove donate in atcommand.c

Edited by clydelion
Posted (edited)

try Euphy's suggestion

-<tab>script<tab>donate<tab>-1,{
OnInit: bindatcmd("donate","donate::OnCommand"); end;
OnCommand:
switch(select("Upper:Mid:Lower")){
	case 1:
			close2;
			callshop "dupper",1;
			end;
	case 2:
			close2;
			callshop "dmid",1;
			end;
	case 3:
			close2;
			callshop "dlow",1;
			end;
}
}

remove donate in atcommand.c

cuz i want if he type @commands

the donate there will show right!

It works the same way xD

not working. when i type @donate. unknown command :(

2sai92b.jpg

this is what i said it error on bindatcmd :( im using it on rathena trunk 16113 :(

i download the latest ra trunk 16538. and i got a problem.

the call shop. call an other shop not my shop. :( i already change it but it the same:(

Edited by bVersatile

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