Jump to content
  • 0

R > Command


PewN

Question


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

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

Link to comment
Share on other sites

22 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

change

npc_click(sd,nd);

to

clif_cashshop_show(sd,nd);

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

can you upload the whole script? Didn't really get your point.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

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;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

Didn't know that Euphy. That's a better way though. Cool. :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

here

when he type @donate [ callfunc "donate"; ]

http://pastebin.com/raw.php?i=vk8M1tpE

Edited by bVersatile
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

- 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);

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

- 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);

?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

the

clif_cashshop_show(sd,nd);

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

how about this?


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

Edited by bVersatile
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

@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;
}
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

@Euphy

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

@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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

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

You don't need any src edits. It's ToastOfDoom's command, you can read more about it here:

http://www.eathena.ws/board/index.php?showtopic=272578

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

@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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

i love yours :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

It works the same way xD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

When you update, you have to recompile, too...

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