Author Topic: MessageBoxYesNo Help  (Read 1799 times)

I am making something for my JailBreak map where instead of taking them all the way to the clear, they
can just ask if they can clear their things. Here is the code:
Code: [Select]
function serverCmdClear(%client,%input)
{
%targ = findClientByName(%input);
announce(%client.name@"\c6 is asking\c3 "@%targ.name@"\c6 if they can clear their tools!");
commandToClient(%targ,'messageBoxYesNo',"Clear Tools?",""@%client.name@" is telling you to clear your tools. If you say yes, your tools will be cleared.",'saidyes10159132','saidno1928732');
}
function serverCmdsaidyes10159132(%client)
{
announce(%client.name@"\c6 said\c2 yes\c6 for their tools to be cleared!");
%client.player.clearTools(1);
}
function serverCmdsaidno1928732(%client)
{
announce(%client.name@"\c6 said<color:FF0000> no\c6 for their tools to be cleared!");
}
I made it so that if they say yes, then their tools will be cleared.
But the problem is, I don't know how to make it tell if they clicked
on no. Help please.

You cannot make an action happen when you press no.

.. IIRC

You cannot make an action happen when you press no.

.. IIRC
Dang. That's disappointing.

Code: [Select]
function serverCmdClear(%client,%input)
{
%targ = findClientByName(%input);
if(!isobject(%targ))
return;
announce(%client.name@"\c6 is asking\c3 "@%targ.name@"\c6 if they can clear their tools!");
commandToClient(%targ,'messageBoxYesNo',"Clear Tools?",""@%client.name@" is telling you to clear your tools. If you say yes, your tools will be cleared.",'acceptclear');
%targ.hasclearprompt = 1;
}
function serverCmdacceptclear(%client)
{
if(!%client.hasclearprompt)
return;
announce(%client.name@"\c6 said\c2 yes\c6 for their tools to be cleared!");
%client.player.clearTools(1);
%client.hasclearprompt = 0;
}
function serverCmdMessageBoxNo(%client)
{
if(!%client.hasclearprompt)
return;
announce(%client.name@"\c6 said<color:FF0000> no\c6 for their tools to be cleared!");
%client.hasclearprompt = 0;
}
« Last Edit: April 15, 2013, 04:15:50 PM by Zeblote »

Code: [Select]
function serverCmdClear(%client,%input)
{
%targ = findClientByName(%input);
if(!isobject(%targ))
return;
announce(%client.name@"\c6 is asking\c3 "@%targ.name@"\c6 if they can clear their tools!");
commandToClient(%targ,'messageBoxYesNo',"Clear Tools?",""@%client.name@" is telling you to clear your tools. If you say yes, your tools will be cleared.",'acceptclear');
%targ.hasclearprompt = 0;
}
function serverCmdaccepclear(%client)
{
if(!%client.hasclearprompt)
return;
announce(%client.name@"\c6 said\c2 yes\c6 for their tools to be cleared!");
%client.player.clearTools(1);
%client.hasclearprompt = 0;
}
function serverCmdMessageBoxNo(%client)
{
if(!%client.hasclearprompt)
return;
announce(%client.name@"\c6 said<color:FF0000> no\c6 for their tools to be cleared!");
%client.hasclearprompt = 0;
}
It isn't working, but I think I know the problem. Unless you created the problem on purpose

You cannot make an action happen when you press no.

.. IIRC
I thought you could? I'm pretty sure I've done it before... you put the method names as the last two arguments I believe

Code: [Select]
function doBox(%cl)
{
commandToClient(%cl, 'messageBoxYesNo', "Click something", "yes or no", "doYes", "doNo");
}

function doYes()
{
//something
}

function doNo()
{
//something else
}

I'm probably wrong but whatev

It isn't working, but I think I know the problem. Unless you created the problem on purpose
Woops I'm a handicap

I'm probably wrong but whatev
Quote from: changelog, 10 to 11
  • Added clientCmds for messageboxYesNo and messageBoxOKCancel
    • clientCmdMessageBoxOKCancel(%title, %message, %okServerCmd)
      %okServerCmd is a tagged string that will be sent as a commandtoserver of the user clicks "ok". If they click "Cancel" commandToServer('MessageBoxCancel'); will be sent.
    • clientCmdMessageBoxYesNo(%title, %message, %yesServerCmd)
      %yesServerCmd is a tagged string that will be sent as a commandtoserver of the user clicks "yes". If they click "no" commandToServer('MessageBoxNo'); will be sent.


Woops I'm a handicap

So does this mean I have to restart it all? :P

Code: [Select]
function serverCmdClear(%client,%input)
{
%targ = findClientByName(%input);
if(!isobject(%targ))
return;
announce(%client.name@"\c6 is asking\c3 "@%targ.name@"\c6 if they can clear their tools!");
commandToClient(%targ,'messageBoxYesNo',"Clear Tools?",""@%client.name@" is telling you to clear your tools. If you say yes, your tools will be cleared.",'acceptclear');
%targ.hasclearprompt = 1;
}
function serverCmdaccepclear(%client)
{
if(!%client.hasclearprompt)
return;
announce(%client.name@"\c6 said\c2 yes\c6 for their tools to be cleared!");
%client.player.clearTools(1);
%client.hasclearprompt = 0;
}
function serverCmdMessageBoxNo(%client)
{
if(!%client.hasclearprompt)
return;
announce(%client.name@"\c6 said<color:FF0000> no\c6 for their tools to be cleared!");
%client.hasclearprompt = 0;
}
Now when I click 'No", it works, but when I click "Yes", nothing happens.
I am looking at the code myself and I don't see the problem in it

It's not working because of a typo.

It's not working because of a typo.
I SEE IT DGDFGDFDFGFDFDFHDGDF

Oh god I made 2 faults in that small code
sdfafasfaf
shame

Oh god I made 2 faults in that small code
sdfafasfaf
shame
Haha well thanks anyways