Jump to content
  • 0

Freebie IP Problem ( want to give freebie again )


mmjgold

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   0
  • Joined:  07/03/13
  • Last Seen:  

hi
 
I use this npc
izlude,136,146,4 script Gift NPC 865,{
   query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`= '" + getcharid(3) + "'", .@lip$);
mes "[welcome]";
mes "will give u a gift once ";

  if(!#Freebie && ( getd("$" + .@lip$ + "_ASD") == 0 )) {
mes "sure ?";
next;
switch(select("good bye")) {
case 1:
getitem 677,20;
getitem 674,2;
getitem 4043,4;
break;



}
set #Freebie, 1;
setd "$" + .@lip$ + "_ASD", getd("$" + .@lip$ + "_ASD") + 1;
close;
}
OnInit:
waitingroom "Gift",0;
end;
}

 

 

and its work great

 

but when I want to give player new Freebie, I can't because NPC save his IP

 

where can I rest IP so NPC give player new Freebie again ?

 

thank you

Edited by Emistry
Please use CODEBOX.
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   345
  • Joined:  02/26/12
  • Last Seen:  

something like that:

(not tested)

Added extra command for GM called @reset_gift, this command will show menu for GM where GM can enter player name for reseting IP & #Freebies variable.

izlude, 136, 146, 4 script Gift NPC 865, {
	query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`= '" + getcharid(3) + "'", .@last_ip$);
	mes "[welcome]";
	mes "will give u a gift once ";
	if (!#Freebie && ( getd("$" + .@last_ip$ + "_ASD") == 0 )) {
		mes "sure ?";
		next;
		switch (select("good bye")) {
		case 1:
			getitem 677, 20;
			getitem 674, 2;
			getitem 4043, 4;
			break;
		}
		set #Freebie, 1;
		setd "$" + .@last_ip$ + "_ASD", getd("$" + .@last_ip$ + "_ASD") + 1;
		close;
	}

OnInit:
	waitingroom "Gift", 0;
	bindatcmd "reset_gift", strnpcinfo(3) + "::OnCommandReset", 99, 99;
	end;

OnCommandReset:
	if ( getgmlevel() < 90 )
		end;

	mes "Enter player name (player must be online) :";
	input .@PlayerName$;

	// checking, if player Online.
	if (isloggedin(getcharid(3, .@PlayerName$)) {
		setd "$" + .@last_ip$ + "_ASD", 0;	// setted variable with player IP to 0
		set #Freebie, 0, getcharid(0,.@PlayerName$);	// here we set #Freebie variable for entered player to 0
		mes "Done!";
		close;
	} else {
		mes "Player not found.";
		close;
	}
	end;
}
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  520
  • Reputation:   64
  • Joined:  11/19/11
  • Last Seen:  

Idk if this what you mean.

 

Change this line.

if(!#Freebie && ( getd("$" + .@lip$ + "_ASD") == 0 )) {

to  (it will give freebies in every new account)

if(!#Freebie) {

And remove this lines.

query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`= '" + getcharid(3) + "'", .@last_ip$);
    
setd "$" + .@last_ip$ + "_ASD", getd("$" + .@last_ip$ + "_ASD") + 1;

If you wan't to give freebies again in specific account you can use the given script above.

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