Jump to content
  • 0

help using addrid on script


ajaytrix

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  84
  • Reputation:   0
  • Joined:  03/29/12
  • Last Seen:  

-	script	trial	-1,{
OnInit:
	bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
	end;
OnAtcommand:
	addrid(1);
	end;
}

 

Is this correct? I want to make @test command by using "addrid" to give items to all players within the map, server,guild,party, just like @itemmap.

Anyone help me with this one? 

Link to comment
Share on other sites

16 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:  

It's better to check if the item id exist and if the amount > 0

also about getitem the values must be integer values

A sample

-    script    trial    -1,{
OnInit:
    bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
    end;
OnAtcommand:
    if ( .@atcmd_numparameters != 2 ) {
        message .@myname$, "Usage: "+ .@atcmd_command$ +" <item id> <amount>";
        end;
    }
    .atoi_id = atoi( .@atcmd_parameters$[0] );
    .atoi_amount = atoi( .@atcmd_parameters$[1] );
    .@myname$ = strcharinfo(0);
    if ( getiteminfo( .atoi_id,0 ) == -1 ) {
        message .@myname$, "Requesting to send an non-existing item ("+ .atoi_id +"). "+ .@atcmd_command$ +" failed.";
        end;
    }
    else if ( .atoi_amount < 1 ) {
        message .@myname$, "You can't send "+ .atoi_amount +" item. "+ .@atcmd_command$ +" failed.";
        end;
    }
    addrid(1);
    getitem .atoi_id, .atoi_amount;
    end;
}


getiteminfo + atoi

 

EDIT : fix an error

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  567
  • Reputation:   18
  • Joined:  04/15/13
  • Last Seen:  

yes, check the guide here

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  


-    script    trial    -1,{

OnInit:

    bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";

    end;

OnAtcommand:

    addrid(1);

    getitem <id>,<amount>;

end;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  84
  • Reputation:   0
  • Joined:  03/29/12
  • Last Seen:  

-    script    trial    -1,{
OnInit:
    bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
    end;
OnAtcommand:
    addrid(1);
    getitem <id>,<amount>;
    end;
}

xmr3bc.png

 

I don't know what to put in line 7. the "<" What should I put sir? :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  567
  • Reputation:   18
  • Joined:  04/15/13
  • Last Seen:  

it should be like this 

 

getitem 501,100

 

it gives 100pcs Apple's on all the players on the map

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  84
  • Reputation:   0
  • Joined:  03/29/12
  • Last Seen:  

 

it should be like this 

 

getitem 501,100

 

it gives 100pcs Apple's on all the players on the map

 

So meaning @test is just for only specific items? I cannot make it in game like:

@test 607 1

@test 671 1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

 

>>it should be like this 

 

getitem 501,100

 

it gives 100pcs Apple's on all the players on the map

 

So meaning @test is just for only specific items? I cannot make it in game like:

@test 607 1

@test 671 1

 

If you want it that way, you can try this : 

// @test <item id> <amount>
-    script    trial    -1,{
OnInit:
        bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
        end;
OnAtcommand:
        if ( .@atcmd_numparameters != 2 ) end;
        addrid(1);
        getitem .@atcmd_parameters$[0], .@atcmd_parameters$[1];
        end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  84
  • Reputation:   0
  • Joined:  03/29/12
  • Last Seen:  

-    script    trial    -1,{
OnInit:
    bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
    end;
OnAtcommand:
    if ( .@atcmd_numparameters != 2 ) {
        message .@myname$, "Usage: "+ .@atcmd_command$ +" <item id> <amount>";
        end;
    }
    .atoi_id = atoi( .@atcmd_parameters$[0] );
    .atoi_amount = atoi( .@atcmd_parameters$[1] );
    .@myname$ = strcharinfo(0);
    if ( getiteminfo( .atoi_id,0 ) == -1 ) {
        message .@myname$, "Requesting to send an non-existing item ("+ .atoi_id +"). "+ .@atcmd_command$ +" failed.";
        end;
    }
    else if ( .atoi_amount < 1 ) {
        message .@myname$, "You can't send "+ .atoi_amount +" item. "+ .@atcmd_command$ +" failed.";
        end;
    }
    addrid(1);
    getitem .atoi_id, .atoi_amount;
    end;
}

@sir Capuche, can you please put a getgmlevel command? 

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:  


OnAtcommand:

if( getgmlevel() < 90 ) end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  84
  • Reputation:   0
  • Joined:  03/29/12
  • Last Seen:  

Thank you for 

Ma'am Yoona

 

Sir Patskie

 

Sir Emistry

And specially 

Sir Capuche

 

Thank you again! :D 

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:  

or

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

bindatcmd "test",strnpcinfo(3)+"::OnAtcommand",60,60;
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  567
  • Reputation:   18
  • Joined:  04/15/13
  • Last Seen:  

or

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

bindatcmd "test",strnpcinfo(3)+"::OnAtcommand",60,60;

 

Excuse me Capuche, i tried to use the script but i have a question.. why is it that when i tried to use it again? its not working anymore.. just once?

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:  

I don't understand your question. May you reformulate it?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  567
  • Reputation:   18
  • Joined:  04/15/13
  • Last Seen:  

I don't understand your question. May you reformulate it?

 

oh, sorry:)

 

 

My question, why is it that when i use the command for the second time it wont work :(

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:  

Try the final version. Check if you have any error on your mapserv.

-	script	trial	-1,{
OnInit:
	bindatcmd "test",strnpcinfo(3)+"::OnAtcommand",60,60;
	end;
OnAtcommand:
	if ( .@atcmd_numparameters != 2 ) {
		message .@myname$, "Usage: "+ .@atcmd_command$ +" <item id> <amount>";
		end;
	}
	.atoi_id = atoi( .@atcmd_parameters$[0] );
	.atoi_amount = atoi( .@atcmd_parameters$[1] );
	.@myname$ = strcharinfo(0);
	if ( getiteminfo( .atoi_id,0 ) == -1 ) {
		message .@myname$, "Requesting to send an non-existing item ("+ .atoi_id +"). "+ .@atcmd_command$ +" failed.";
		end;
	}
	else if ( .atoi_amount < 1 ) {
		message .@myname$, "You can't send "+ .atoi_amount +" item. "+ .@atcmd_command$ +" failed.";
		end;
	}
	addrid(1);
	getitem .atoi_id, .atoi_amount;
	end;
}
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...