Jump to content
  • 0

Unjail without delete item when wrong name.


kronobr

Question


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.02
  • Content Count:  71
  • Reputation:   0
  • Joined:  06/24/19
  • Last Seen:  

prontera,150,114,4	script	God Connection	811,{
mes "You can bring to life a old friend if you have a God item gift.";
next;
if (countitem(6293) < 1) end;
input .@input$;
delitem 6293,1;
set @success, atcommand ("@unjail "+.@input$);
if(!@success) { mes "Something's wrong, maybe the player doesn't exist.";
}
mes "Done!";
close;
}

Hi ,I need help to delete the item only if the player spells the other's name correctly for UNjail. Currently, if he misses the name, he loses the item anyway because the unjail fails.

Thanks you all

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  32
  • Reputation:   29
  • Joined:  09/16/20
  • Last Seen:  

On 9/14/2020 at 6:10 PM, kronobr said:

prontera,150,114,4	script	God Connection	811,{
mes "You can bring to life a old friend if you have a God item gift.";
next;
if (countitem(6293) < 1) end;
input .@input$;
delitem 6293,1;
set @success, atcommand ("@unjail "+.@input$);
if(!@success) { mes "Something's wrong, maybe the player doesn't exist.";
}
mes "Done!";
close;
}

Hi ,I need help to delete the item only if the player spells the other's name correctly for UNjail. Currently, if he misses the name, he loses the item anyway because the unjail fails.

Thanks you all

prontera,150,114,4	script	God Connection	811,{
mes "You can bring to life a old friend if you have a God item gift.";
next;
if (countitem(6293) < 1) end;
input .@input$;
set @success, atcommand ("@unjail "+.@input$);
if(!@success) { mes "Something's wrong, maybe the player doesn't exist.";
} else{
mes "Done!";
delitem 6293,1;
close;
}
}

The items delete because you put delitem after the input, so is obviusly what the item delete if the name is fails or is correctly. Try this.

Edited by EveeX
Error syntax
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.02
  • Content Count:  71
  • Reputation:   0
  • Joined:  06/24/19
  • Last Seen:  

2 hours ago, EveeX said:

prontera,150,114,4	script	God Connection	811,{
mes "You can bring to life a old friend if you have a God item gift.";
next;
if (countitem(6293) < 1) end;
input .@input$;
set @success, atcommand ("@unjail "+.@input$);
if(!@success) { mes "Something's wrong, maybe the player doesn't exist.";
}
mes "Done!";
close;
} else{
	delitem 6293,1;
}

The items delete because you put delitem after the input, so is obviusly what the item delete if the name is fails or is correctly. Try this.

I need the item be deleted only If name exist.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  32
  • Reputation:   29
  • Joined:  09/16/20
  • Last Seen:  

1 hour ago, kronobr said:

I need the item be deleted only If name exist.

prontera,150,114,4	script	God Connection	811,{
mes "You can bring to life a old friend if you have a God item gift.";
next;
if (countitem(6293) < 1) end;
input .@input$;
set @success, atcommand ("@unjail "+.@input$);
                        
	if(!@success) // Name no exist
    {
    	mes "Something's wrong, maybe the player doesn't exist.";
	} else{ // Name Exists and delete item 6293.
		mes "Done!";
        delitem 6293,1;
		close;
	}                        
}

Try this.

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

also the player must be online

try this

prontera,150,114,4	script	God Connection	811,{
	mes "You can bring to life a old friend if you have a God item gift.";
	if(select("use:close") == 2)
		end;
	input .@pname$;
	getunits(BL_PC,.@names$);
	if(inarray(.@names$,.@pname$) == -1){
		mes "Player does not exist or offline";
		mes "Player must be online!";
		end;
	}
	if(countitem(6293) < 1){
		mes "you don't have " + getitemname(6293);
		mes "you need 1 " + getitemname(6293);
		end;
	}
	if(atcommand("@unjail "+.@pname$)){
		delitem 6293,1;
		mes "your friend is now released!";
		end;
	}
	mes "something went wrong!";
	mes "contact the GM!";
	end;                  
}

 

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