Jump to content
  • 0

restriction for item


Question

Posted

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 

6 answers to this question

Recommended Posts

  • 0
Posted

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;

}

 

  • 0
Posted

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;

}

  • 1
Posted (edited)
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
  • 0
Posted
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

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