Jump to content
  • 0
AJPzone

give items

Question

4 answers to this question

Recommended Posts

  • 0
-	script	Sample	-1,{	OnInit:		bindatcmd "giveitems",strnpcinfo( 3 )+"::OnCommnad",99,99;		end;	OnPCLoginEvent:		.players[ getarraysize( .players ) ] = getcharid( 3 );		end;	OnPCLogoutEvent:		for ( .@i = 0; .@i < getarraysize( .players ); .@i++ ) {			if ( getcharid( 3 ) == .players[ .@i ] )				deletearray .players[ .@i ], 1;		}		end;	OnCommnad:		if ( .@atcmd_numparameters < 2 )			message strcharinfo( 0 ),"Usage: @giveitems <item id> <item amount>";		else {			.@id = atoi( .@atcmd_parameters$[ 0 ] );			.@amount = atoi( .@atcmd_parameters$[ 1 ] );			.@map$ = strcharinfo( 3 );			.@origin = getcharid( 3 );			.c = 0;			if ( getitemname( .@id ) == "null" ) {				message strcharinfo( 0 ),"Ivalid item id";				end;			}			for ( .@i = 0; .@i < getarraysize( .players ); .@i++ ) {				if ( attachrid( .players[ .@i ] ) ) {					if ( strcharinfo( 3 ) == .@map$ && !getgmlevel() ) {						getitem .@id, .@amount;						.c++;					}				}			}			attachrid( .@origin );			message strcharinfo( 0 ),"Gave items to " + .c + " character" + ( .c > 1 ? "s" : "" );		}		end;}

Try :3

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.