Full Version : page command
xmlspawner >>Scripting Support >>page command
<< Prev | Next >>
ambak- 02-19-2006
ohh yes i forgot it.i fix it ok but the final problem is for the use of this command.you know that a player can only page one at a time.if he have a page in quee than he cant page the second one.but with this command they can page unlimited pages?how can i add a check to see if the mobile has a page in quee and warn him .
ArteGordon- 02-19-2006
add an if statement that checks for
PageQueue.CheckAllowedToPage( from )
ambak- 02-19-2006

CODE
using System; using System.Text; using Server; using Server.Items; using Server.Gumps;
using Server.Network;
using System.Collections;
using Server.Mobiles;
using Server.Multis;
namespace Server.Engines.Help
{
public class PageatCommand
{
public static void Initialize()
{
Server.Commands.Register( "p", AccessLevel.Player, new CommandEventHandler( PageatCommand_OnCommand ) );
}
public static void PageatCommand_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
if ( from.Region is Server.Regions.Jail )
{
from.SendMessage( "you cant do this.", 0x35, true ); // You'll need a better jailbreak plan then that!
}
else if PageQueue.CheckAllowedToPage( from )
{
from.SendMessage( "zaten pagein var lavuk.", 0x35, true ); // You'll need a better jailbreak plan then that!
}
else
{
from.SendGump( new PagePromptGump( from, PageType.Question) );
}
}
}
}

CODE
- Error: Scripts\Custom\pageat.cs: CS1003: (line 27, column 9) Syntax error, '( ' expected - Error: Scripts\Custom\pageat.cs: CS1026: (line 27, column 45) ) expected

ArteGordon- 02-19-2006

CODE
else if PageQueue.CheckAllowedToPage( from )

the syntax for an if statement requires parentheses
if( condition ) code
You might want to take a look at a c# tutorial since many of these errors are basic syntax issues.
http://www.softsteel.co.uk/tutorials/cSharp/cIndex.html
http://www.csharp-station.com/Tutorial.aspx
http://www.functionx.com/csharp/index.htm
ambak- 02-19-2006

CODE
using System; using System.Text; using Server; using Server.Items; using Server.Gumps;
using Server.Network;
using System.Collections;
using Server.Mobiles;
using Server.Multis;
namespace Server.Engines.Help
{
public class PageatCommand
{
public static void Initialize()
{
Server.Commands.Register( "p", AccessLevel.Player, new CommandEventHandler( PageatCommand_OnCommand ) );
}
public static void PageatCommand_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
if ( from.Region is Server.Regions.Jail )
{
from.SendMessage( "you cant do this.", 0x35, true ); // You'll need a better jailbreak plan then that!
}
else if ( PageQueue.CheckAllowedToPage( from ) )
{
from.SendMessage( "zaten pagein var lavuk.", 0x35, true ); // You'll need a better jailbreak plan then that!
}
else
{
from.SendGump( new PagePromptGump( from, PageType.Question) );
}
}
}
}

ok now it works.
but i have no page in quee and it always says you have already page in quee when use the command
ArteGordon- 02-19-2006
if you want it to behave like the normal help gump, look at how it is done in helpgump.cs in the EventSink_HelpRequest method that is called when you press the help button
ambak- 02-19-2006
it works like it but i think i have something wrong with the if statements
ArteGordon- 02-19-2006

CODE
else if ( PageQueue.CheckAllowedToPage( from ) ) { from.SendMessage( "zaten pagein var lavuk.", 0x35, true ); // You'll need a better jailbreak plan then that! }

this code says that if you are allowed to page, then it sends that message
ambak- 02-19-2006
so i think it will be like this am i right?

CODE
using System; using System.Text; using Server; using Server.Items; using Server.Gumps;
using Server.Network;
using System.Collections;
using Server.Mobiles;
using Server.Multis;
namespace Server.Engines.Help
{
public class PageatCommand
{
public static void Initialize()
{
Server.Commands.Register( "p", AccessLevel.Player, new CommandEventHandler( PageatCommand_OnCommand ) );
}
public static void PageatCommand_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
if ( from.Region is Server.Regions.Jail )
{
from.SendMessage( "you cant do this.", 0x35, true ); // You'll need a better jailbreak plan then that!
}
else if ( PageQueue.CheckAllowedToPage( from ) )
{
from.SendGump( new PagePromptGump( from, PageType.Question) );
}
else
{
from.SendMessage( "you already have page.", 0x35, true ); // You'll need a better jailbreak plan then that!
}
}
}
}

ambak- 02-19-2006
ok.i cant handle this.i give up :/