Jump to content
  • 0

help me with npc get point invite player


superblackcat

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  1
  • Reputation:   0
  • Joined:  06/22/12
  • Last Seen:  

hello guy..can someone help make the script npc that give point to player that invite other player

the person that have been invite need to put the name of person that invite them..can someone help me please..thank you

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

@superblackcat

So two ways I might do it...
One where both players need to be online and the referrer needs to claim the referral.

prontera,100,100,5	script	refer a friend	100,{
	switch(select("Add Referral:Claim Referral")) {
		case 1:
			if(referrer$ != "") {
				mes "You've already set a referrer.";
				close;
			}
			mes "Input the character name of the person who referred you. (This cannot be changed so make sure it's correct!)";
			next;
			input .@player_name$;
			mes "Is this correct?";
			mes .@player_name$;
			next;
			if(select("Yes:No") == 1) {
				referrer$ = .@player_name$;
				mes "Congratulations the referrer has been set!";
			}
			break;
		case 2:
			mes "Enter the name of the person you referred.";
			next;
			input .@player_name$;
			.@cid = convertpcinfo(.@player_name$, CPC_CHAR);
			if(.@cid <= 0) {
				mes "Make sure you've entered that persons name correctly and that they are online.";
				close;
			}
			.@referrer$ = getvar(referrer$, .@cid);
			.@ref_claimed = getvar(ref_claimed$, .@cid);
			if(.@referrer$ == strcharinfo(0) && !.@ref_claimed) {
				getvar(ref_claimed$, .@cid) = True;
				getitem 501, 1;
				mes "That's great!";
			} else {
				mes "Hmm... It doesn't seem like you referred that person.";
			}
			break;
	}
	close;
}

 

Another where only the referral needs to submit the referrer and the referrer gets a mailed reward.

prontera,100,100,5	script	refer a friend	100,{
	if(referrer$ != "") {
		mes "You've already set a referrer.";
		close;
	}
	mes "Input the character name of the person who referred you. (This cannot be changed so make sure it's correct!)";
	next;
	input .@player_name$;
	mes "Is this correct?";
	mes .@player_name$;
	next;
	if(select("Yes:No") == 1) {
		.@len = query_sql("SELECT `char_id` FROM `char` WHERE `name` = '"+escape_sql(.@player_name$)+"';", .@cid);
		if(.@len > 0) {
			referrer$ = .@player_name$;
			.@charid = .@cid;
			.@sender$ = strcharinfo(0);
			.@title$ = "Referral Reward!";
			.@body$ = "Thanks for being awesome!";
			.@zeny = 10000;
			mail .@charid, .@sender$, .@title$, .@body$, .@zeny;
			mes "Congratulations the referrer has been set!";
		} else {
			mes "They don't seem to exist.";
		}
	}
	close;
}

 

Link to comment
Share on other sites

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.

×
×
  • Create New...