Jump to content
  • 0

Question

Posted
-	script	hourly_reward_main	-1,{
	
	OnInit:
		setarray .itemid,6379,522,12412,604,12221,16774,12103,12710,14296,14601,7929,12202,12203,12204,12205,12206,12207,7959;
		setarray .amount,10,100,1,10,1,2,2,3,2,5,2,2,2,2,2,2,2,2;

		.itemid_size = getarraysize( .itemid );
		end;
		
	OnMinute00:
		query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY RAND() LIMIT 1",.@aid,.@name$ );
		if ( .@aid ) {
			.@i = rand( .itemid_size );
			getitem .itemid[.@i],.amount[.@i],.@aid;
			announce "Krizazone Server - Lucky Player ["+.@name$+"] has receive ["+.amount[.@i]+"x "+getitemname( .itemid[.@i] )+"]!!",bc_all;
		}
		end;
}

i need help here
this script send to all player online and all marchents autotrade
i want make it to send to all player online not marchents autotrade
any help ?

4 answers to this question

Recommended Posts

  • 0
Posted (edited)

since you are using sql to get the player name

you can get the vinding too from sql in vendings table

check if the player id = vinding

if not = give him the items

if it's = search for another player

it would be hard a little

 

however

there is this command >>

if(checkvending() == 0) {//not vinding}

if(checkvending() ==1){//vinding}

 

i would suggest seen this if you want to change your script

 

 

 

Edited by sader1992
  • Upvote 1
  • 0
Posted
1 hour ago, Hossam said:

-	script	hourly_reward_main	-1,{
	
	OnInit:
		setarray .itemid,6379,522,12412,604,12221,16774,12103,12710,14296,14601,7929,12202,12203,12204,12205,12206,12207,7959;
		setarray .amount,10,100,1,10,1,2,2,3,2,5,2,2,2,2,2,2,2,2;

		.itemid_size = getarraysize( .itemid );
		end;
		
	OnMinute00:
		query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY RAND() LIMIT 1",.@aid,.@name$ );
		if ( .@aid ) {
			.@i = rand( .itemid_size );
			getitem .itemid[.@i],.amount[.@i],.@aid;
			announce "Krizazone Server - Lucky Player ["+.@name$+"] has receive ["+.amount[.@i]+"x "+getitemname( .itemid[.@i] )+"]!!",bc_all;
		}
		end;
}

i need help here
this script send to all player online and all marchents autotrade
i want make it to send to all player online not marchents autotrade
any help ?

Hi please try this I'm not on my PC.

-	script	hourly_reward_main	-1,{
OnInit:
	setarray .itemid,6379,522,12412,604,12221,16774,12103,12710,14296,14601,7929,12202,12203,12204,12205,12206,12207,7959;
	setarray .amount,10,100,1,10,1,2,2,3,2,5,2,2,2,2,2,2,2,2;
	.itemid_size = getarraysize( .itemid );
	end;
		
OnMinute00:
	.@size = query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY RAND() LIMIT 1",.@aid,.@name$ );
	for( .@i = 0; .@i < .@size; .@i++ ) {
		if( checkvending( .@name$[.@i] ) || checkchatting( .@name$[.@i] ) ) end;
	else if( .@aid )
		.@i = rand( .itemid_size );
		getitem .itemid[.@i],.amount[.@i],.@aid;
		announce "Krizazone Server - Lucky Player ["+.@name$+"] has received "+.amount[.@i]+" x "+getitemname( .itemid[.@i] )+".",0;
	}
	end;
}

Let me know if it's working.

  • 0
Posted
15 hours ago, Kaze said:

Hi please try this I'm not on my PC.


-	script	hourly_reward_main	-1,{
OnInit:
	setarray .itemid,6379,522,12412,604,12221,16774,12103,12710,14296,14601,7929,12202,12203,12204,12205,12206,12207,7959;
	setarray .amount,10,100,1,10,1,2,2,3,2,5,2,2,2,2,2,2,2,2;
	.itemid_size = getarraysize( .itemid );
	end;
		
OnMinute00:
	.@size = query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY RAND() LIMIT 1",.@aid,.@name$ );
	for( .@i = 0; .@i < .@size; .@i++ ) {
		if( checkvending( .@name$[.@i] ) || checkchatting( .@name$[.@i] ) ) end;
	else if( .@aid )
		.@i = rand( .itemid_size );
		getitem .itemid[.@i],.amount[.@i],.@aid;
		announce "Krizazone Server - Lucky Player ["+.@name$+"] has received "+.amount[.@i]+" x "+getitemname( .itemid[.@i] )+".",0;
	}
	end;
}

Let me know if it's working.

Thank you
I will try it and I will tell you if it workThank you I will try it and I will tell you if it workss

  • 0
Posted
On 6/30/2017 at 4:20 PM, Kaze said:

Hi please try this I'm not on my PC.


-	script	hourly_reward_main	-1,{
OnInit:
	setarray .itemid,6379,522,12412,604,12221,16774,12103,12710,14296,14601,7929,12202,12203,12204,12205,12206,12207,7959;
	setarray .amount,10,100,1,10,1,2,2,3,2,5,2,2,2,2,2,2,2,2;
	.itemid_size = getarraysize( .itemid );
	end;
		
OnMinute00:
	.@size = query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY RAND() LIMIT 1",.@aid,.@name$ );
	for( .@i = 0; .@i < .@size; .@i++ ) {
		if( checkvending( .@name$[.@i] ) || checkchatting( .@name$[.@i] ) ) end;
	else if( .@aid )
		.@i = rand( .itemid_size );
		getitem .itemid[.@i],.amount[.@i],.@aid;
		announce "Krizazone Server - Lucky Player ["+.@name$+"] has received "+.amount[.@i]+" x "+getitemname( .itemid[.@i] )+".",0;
	}
	end;
}

Let me know if it's working.

not work

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