- 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