Jump to content

sootil

Members
  • Content Count

    4
  • Joined

  • Last visited

Posts posted by sootil


  1. On 4/11/2020 at 11:03 PM, Patskie said:

    - script asdfh FAKE_NPC,{ OnCmd: if (!.@atcmd_numparameters || .@atcmd_numparameters != 2) { message strcharinfo(0), "Usage: @itemshower <item_id> <item_quantity>"; end; } .@item = atoi(.@atcmd_parameters$[0]); .@q = atoi(.@atcmd_parameters$[1]); if (!.@q || getitemname(.@item) == "null") { message strcharinfo(0), "Invalid item/amount"; end; } getmapxy .@map$, .@x, .@y, UNITTYPE_PC; .@i = 0; while (.@i < .@q) { do { .@a = rand(.@x, .@x+200); .@b = rand(.@y, .@y+200); } while (!checkcell(.@map$, .@a, .@b, cell_chkpass)); makeitem .@item, 1, .@map$, .@a, .@b; .@i++; } end; OnInit: bindatcmd "itemshower", strnpcinfo(3) + "::OnCmd", 99, 99, true; end; }

    
    -	script	asdfh	FAKE_NPC,{
    	OnCmd:
    		if (!.@atcmd_numparameters || .@atcmd_numparameters != 2) {
    			message strcharinfo(0), "Usage: @itemshower <item_id> <item_quantity>";
    			end;
    		}
    		.@item = atoi(.@atcmd_parameters$[0]);
    		.@q = atoi(.@atcmd_parameters$[1]);
    		if (!.@q || getitemname(.@item) == "null") {
    			message strcharinfo(0), "Invalid item/amount";
    			end;
    		}
    		getmapxy .@map$, .@x, .@y, UNITTYPE_PC;
    		.@i = 0;
    		while (.@i < .@q) {
    			do {
    				.@a = rand(.@x, .@x+200);
    				.@b = rand(.@y, .@y+200);
    			} while (!checkcell(.@map$, .@a, .@b, cell_chkpass));
    			makeitem .@item, 1, .@map$, .@a, .@b;
    			.@i++;
    		}
    		end;
    		
    	OnInit:
    		bindatcmd "itemshower", strnpcinfo(3) + "::OnCmd", 99, 99, true;
    		end;
    }


     

    Good day Sir! I'm just wondering is this the same as Giving out items in an entire map? or just the players around the GM? Please enlighten me. I'm looking for a command that will give out items to every players online in a specific map. Newbie here! Thanks you so much!


  2. On 5/1/2019 at 12:10 AM, Luciar said:

    Thanks for trying to help the OP. However, this script isn’t written correctly.

    The OnInit label inherently does not have an attached RID, using detachrid() is pointless.

    You then use a for loop without any defined action: syntax for(index set; condition; increment) { action }
    Note that you are missing the action portion of the for loop.

    The OnPCLoginEvent label inherently DOES have an RID attached (namely, the player that just logged in). There is no need to use attachrid here.

    If you were to fix all of the issues I listed above, your script would distribute the items to all accounts as you have not implemented any check to ensure the account ID is within the specified range described by the OP.

    Thanks for this Sir, Can u share the correct one? The one that will work. Newbie here. Thanks for the help in advance!

     

×
×
  • Create New...

Important Information

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