Jump to content

Question

Posted

Hellow Guys !!!  can i request a gm script commands ?


Only gm lvl 99 can use

@mailall -<idname><Amount> and all players online will receive a mail from me?

Example:
@mailall 607 20


@guildmail - <idname><Amount><guildname>  guild chose will be mail ?

9 answers to this question

Recommended Posts

Posted


- script atcmd_mail -1,{

OnInit:

bindatcmd "mailall",strnpcinfo(3)+"::OnMailall",99,99;

bindatcmd "guildmail",strnpcinfo(3)+"::OnGuildmail",99,99;

end;

OnMailall:

.name$ = strcharinfo(0);

if ( getiteminfo( atoi( .@atcmd_parameters$[0] ),0 ) == -1 ) {

message .name$, "invalid item id";

end;

}

if ( atoi( .@atcmd_parameters$[1] ) < 1 )

.@atcmd_parameters$[1] = "1";

query_sql( "INSERT INTO `mail` (send_name,dest_id,title,message,nameid,amount,identify,zeny,time) select "+

"'no-reply',"+

"`char_id`"+

",'GM reward',"+

"'You got a mail from "+ .name$ +"',"+

.@atcmd_parameters$[0] +","+ .@atcmd_parameters$[1] +",0,0,UNIX_TIMESTAMP(NOW()) from `char` where online = 1 and char_id != "+ getcharid(0) );

addrid 0;

if ( strcharinfo(0) != .name$ )

message strcharinfo(0), "You got a mail from "+ .name$;

end;

OnGuildmail:

.name$ = strcharinfo(0);

if ( getiteminfo( atoi( .@atcmd_parameters$[0] ),0 ) == -1 ) {

message .name$, "invalid item id";

end;

}

if ( atoi( .@atcmd_parameters$[1] ) < 1 )

.@atcmd_parameters$[1] = "1";

query_sql "select guild_id from guild where name = '"+ escape_sql( .@atcmd_parameters$[2] ) +"'", .@guild_id;

if ( .@guild_id == 0 ) {

message .name$, "wrong guild name";

end;

}

query_sql( "INSERT INTO `mail` (send_name,dest_id,title,message,nameid,amount,identify,zeny,time) select "+

"'no-reply',"+

"`char`.`char_id`"+

",'GM reward',"+

"'You got a mail from "+ .name$ +"',"+

.@atcmd_parameters$[0] +","+ .@atcmd_parameters$[1] +",0,0,UNIX_TIMESTAMP(NOW()) from `char` "+

"where guild_id = "+ .@guild_id +" and online = 1 and char_id != "+ getcharid(0) );

addrid 3,0, .@guild_id;

if ( strcharinfo(0) != .name$ )

message strcharinfo(0), "You got a mail from "+ .name$;

end;

}

Posted

You can try searching for a similar thread like that in the forums.

 

I'll try to give you an idea..

 

You can achieve this also by executing an SQL query on your database.

Posted
-	script	atcmd_mail	-1,{
OnInit:
	bindatcmd "mailall",strnpcinfo(3)+"::OnMailall",99,99;
	bindatcmd "guildmail",strnpcinfo(3)+"::OnGuildmail",99,99;
	end;
OnMailall:
	.name$ = strcharinfo(0);
	if ( getiteminfo( atoi( .@atcmd_parameters$[0] ),0 ) == -1 ) {
		message .name$, "invalid item id";
		end;
	}
	if ( atoi( .@atcmd_parameters$[1] ) < 1 )
		.@atcmd_parameters$[1] = "1";
	query_sql( "INSERT INTO `mail` (send_name,dest_id,title,message,nameid,amount,identify,zeny,time) select "+
		  "'no-reply',"+
		  "`char_id`"+
		  ",'GM reward',"+
		  "'You got a mail from "+ .name$ +"',"+
		  .@atcmd_parameters$[0] +","+ .@atcmd_parameters$[1] +",0,0,UNIX_TIMESTAMP(NOW()) from `char` where online = 1 and char_id != "+ getcharid(0) );
	addrid 0;
	if ( strcharinfo(0) != .name$ )
		message strcharinfo(0), "You got a mail from "+ .name$;
	end;
OnGuildmail:
	.name$ = strcharinfo(0);
	if ( getiteminfo( atoi( .@atcmd_parameters$[0] ),0 ) == -1 ) {
		message .name$, "invalid item id";
		end;
	}
	if ( atoi( .@atcmd_parameters$[1] ) < 1 )
		.@atcmd_parameters$[1] = "1";
	query_sql "select guild_id from guild where name = '"+ escape_sql( .@atcmd_parameters$[2] ) +"'", .@guild_id;
	if ( .@guild_id == 0 ) {
		message .name$, "wrong guild name";
		end;
	}
	query_sql( "INSERT INTO `mail` (send_name,dest_id,title,message,nameid,amount,identify,zeny,time) select "+
		  "'no-reply',"+
		  "`char`.`char_id`"+
		  ",'GM reward',"+
		  "'You got a mail from "+ .name$ +"',"+
		  .@atcmd_parameters$[0] +","+ .@atcmd_parameters$[1] +",0,0,UNIX_TIMESTAMP(NOW()) from `char` "+
		"where guild_id = "+ .@guild_id +" and online = 1 and char_id != "+ getcharid(0) );
	addrid 3,0, .@guild_id;
	if ( strcharinfo(0) != .name$ )
		message strcharinfo(0), "You got a mail from "+ .name$;
	end;
}

Hi sir,

i got a problem @mailall is working but once my player Opened their mail no items :(

Posted

It seems working for me. I got the mail and the item in the mail. The player of the guild must be online for @guildmail and the player must relog to see the mail

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