Jump to content
  • 0

restriction for item


myserver

Question


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  45
  • Reputation:   0
  • Joined:  08/27/18
  • Last Seen:  

the normal player have a @item but he/she can have a restriction item.

sample

 

normal player she/he used the command @item Yggdrasil Berry amout   cannot use.

but the gm she/he can used that command 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 1

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1677
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

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

atcommand level

 

-	script	atcmd_noitem	-1,{
OnInit:
	bindatcmd("item",strnpcinfo(3)+"::OnAtcommand",0,99);
	setarray .item_restrict,607,501;	
end;
OnAtcommand:
	.@itemid = atoi(.@atcmd_parameters$[0]);
	if(!getgmlevel()){
		if(inarray(.item_restrict,.@itemid) != -1){
			message strcharinfo(0),"You cannot create this item.";
			end;
		}	
	}
	if(getitemname(.@itemid) != "null"){
		.@quantity = atoi( .@atcmd_parameters$[1] );
		if ( .@quantity < 1 ) .@quantity = 1;
		getitem .@itemid,.@quantity;
	}
end;
}

 

Edited by sader1992
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  45
  • Reputation:   0
  • Joined:  08/27/18
  • Last Seen:  

i got error from the 1st choice

1.png

 

 

Spoiler

//By Capuche

-    script    atcmd_noitem    -1,{
OnInit:
    bindatcmd "item",strnpcinfo(3)+"::OnAtcommand";
    setarray .item_restrict,
        607, //1st item to be restricted
        501; //2nd item to be restricted
    .item_restrict_size = getarraysize( .item_restrict );
    end;
OnAtcommand:
    .@gmlevel = getgmlevel();
    if( .@gmlevel && .@atcmd_numparameters ){
        .@itemid = atoi( .@atcmd_parameters$[0] );
        if( .@gmlevel < 99 ){
            for( .@i = 0; .@i < .item_restrict_size; .@i++ )
                if( .@itemid == .item_restrict[.@i] ){
                    message strcharinfo(0),"You cannot create this item.";
                    end;
                }
        }
        if( getitemname( .@itemid ) != "null" ){
            .@quantity = atoi( .@atcmd_parameters$[1] );
            if ( .@quantity < 1 ) .@quantity = 1;
            getitem .@itemid,.@quantity;
        }
    }
    end;

}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  183
  • Reputation:   15
  • Joined:  06/10/12
  • Last Seen:  

change 

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

by:

bindatcmd "item", "atcmd_noitem::OnAtcommand";

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  45
  • Reputation:   0
  • Joined:  08/27/18
  • Last Seen:  

same error sir

 

1.png

 

i used this script there are no error but the normal playerhe cannot use @item any item from ratemyserver

 

 

-    script    atcmd_noitem    -1,{
OnInit:
    bindatcmd "item", "atcmd_noitem::OnAtcommand";
    setarray .item_restrict,
        607, //1st item to be restricted
        501; //2nd item to be restricted
    .item_restrict_size = getarraysize( .item_restrict );
    end;
OnAtcommand:
    .@gmlevel = getgmlevel();
    if( .@gmlevel && .@atcmd_numparameters ){
        .@itemid = atoi( .@atcmd_parameters$[0] );
        if( .@gmlevel < 0 ){
            for( .@i = 0; .@i < .item_restrict_size; .@i++ )
                if( .@itemid == .item_restrict[.@i] ){
                    message strcharinfo(0),"You cannot create this item.";
                    end;
                }
        }
        if( getitemname( .@itemid ) != "null" ){
            .@quantity = atoi( .@atcmd_parameters$[1] );
            if ( .@quantity < 1 ) .@quantity = 1;
            getitem .@itemid,.@quantity;
        }
    }
    end;

}

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  45
  • Reputation:   0
  • Joined:  08/27/18
  • Last Seen:  

On 9/4/2018 at 2:29 AM, sader1992 said:

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

atcommand level

 


-	script	atcmd_noitem	-1,{
OnInit:
	bindatcmd("item",strnpcinfo(3)+"::OnAtcommand",0,99);
	setarray .item_restrict,607,501;	
end;
OnAtcommand:
	.@itemid = atoi(.@atcmd_parameters$[0]);
	if(!getgmlevel()){
		if(inarray(.item_restrict,.@itemid) != -1){
			message strcharinfo(0),"You cannot create this item.";
			end;
		}	
	}
	if(getitemname(.@itemid) != "null"){
		.@quantity = atoi( .@atcmd_parameters$[1] );
		if ( .@quantity < 1 ) .@quantity = 1;
		getitem .@itemid,.@quantity;
	}
end;
}

 

same issue the normal player cannot use the @item any item. the command is not working from the normal player

 

 

when i paste to renewal i got error 

1.png

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