AJPzone 0 Posted May 19, 2014 Hi can i request a script that gives item on all player on the specific map. not on the npc map. Quote Share this post Link to post Share on other sites
0 Patskie 88 Posted May 19, 2014 - 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 Quote Share this post Link to post Share on other sites
0 AJPzone 0 Posted May 20, 2014 Working! Thank you! (Salamat) Patskie Quote Share this post Link to post Share on other sites
0 Hadeszeus 15 Posted June 12, 2014 Is it possible to not use OnPCLoginEvent? Instead use specific map load event to get the .player id? Quote Share this post Link to post Share on other sites
Hi can i request a script that gives item on all player on the specific map. not on the npc map.
Share this post
Link to post
Share on other sites