Jump to content

Question

8 answers to this question

Recommended Posts

Posted (edited)

Try this;

prontera,200,180,4	script	Prize Sender Test	123,{
if(!getgmlevel())end;
set .@itemtoonlineplayers$,strcharinfo(0);

mes "Input Item ID";
	Input .@item;
	if (getitemname(.@item) == "null") {
		mes "Invalid Item ID";
		close;
	}

mes "Input Amount";
	input .@inum;
	if( .@inum <= 0  ) {
		mes "Invalid Amount";
		close;
	}

	while( .@V < $PlayerNumber ){
		set .@V,.@V+1;
		message getd("$RecordAID"+.@V),"[[[ System ]]] : "+.@itemtoonlineplayers$+" give you "+getitemname(.@item)+"x"+.@inum;
		getitem .@item,.@inum,getd("$RecordAID"+.@V);
	}

close;
}

-	script	PrizeSenderEvent	-1,{
OnInit:
	if(!getusers(1))while($PlayerNumber)setd "$RecordAID"+(set($PlayerNumber,

$PlayerNumber-1)+1),0;
	end;

OnPCLoginEvent:
	setd "$RecordAID"+set(@AIDNumber,set($PlayerNumber,$PlayerNumber+1)),getcharid(3);
	end;

OnPCLogoutEvent:
	setd "$RecordAID"+@AIDNumber,getd("$RecordAID"+(set(.@AIDNumber,set($PlayerNumber,

$PlayerNumber-1)+1)));
	attachrid getd("$RecordAID"+@AIDNumber);
	setd "$RecordAID"+@AIDNumber,0;
	set @AIDNumber,.@AIDNumber;

}
Edited by Anakid
Posted

Set the prizes first.

 

    setarray .Package1[0],501,1,502,2,503,3;
    setarray .Package2[0],601,5,602,10;
    setarray .Package3[0],607,10;

Talk to the npc then input the player name then select the package.

After that; the player need to talk to the NPC to get the reward.

Posted

	mes "Input an item ID.";

input .@item;

if (getitemname(.@item) == "null") {

mes "Invalid item "+.@item+".";

close;

}

mes "Input an amount.";

input .@amount;

if (.@amount == 0 || .@amount > 30000) {

mes "Invalid amount "+.@amount+".";

close;

}

mes " ";

mes "Giving "+.@amount+"x "+getitemname(.@item)+" to all players.";

close2;

set .@size, query_sql("SELECT `account_id` FROM `char` WHERE `online` = 1",.@aid);

for(set .@i,0; .@i<.@size; set .@i,.@i+1) {

getitem .@item,.@amount,.@aid[.@i];

}

end;

Posted

prontera,200,180,4    script    Prize Sender Test    123,{
if(!getgmlevel())end;
set .@itemtoonlineplayers$,strcharinfo(0);

    mes "Input an item ID.";
    input .@item;
    if (getitemname(.@item) == "null") {
        mes "Invalid item "+.@item+".";
        close;
    }
    mes "Input an amount.";
    input .@amount;
    if (.@amount == 0 || .@amount > 30000) {
        mes "Invalid amount "+.@amount+".";
        close;
    }
    mes " ";
    mes "Giving "+.@amount+"x "+getitemname(.@item)+" to all players.";
    close2;
    set .@size, query_sql("SELECT `account_id` FROM `char` WHERE `online` = 1",.@aid);
    for(set .@i,0; .@i<.@size; set .@i,.@i+1) {
        getitem .@item,.@amount,.@aid[.@i];
    }
    end;

 

not working with me

both didn't work

no no its working

thannks guys ^_^

Posted

@Anakid: For the record, you really should not use that method of storing names; there's absolutely no reason to use permanent variables for every player (they'll slow down the server by constantly syncing with your `mapreg` table). Performing a single query is far more efficient.

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