Hey all, one more question then my server will be up!
How do i go about making it so the characters in my server are automatically saved every 2 mins. Without showing the text "Character Saved" Or, if not possible then it is fine to show the text.
As before, i am not good at scripting such ... so please be thorough and step by step. I appreciate ANY replies.
Thank you!
Auto Saving Characters!
Débuté par
WindAngel
, avril 15 2011 03:02
#1
Posté 15 avril 2011 - 03:02
#2
Posté 15 avril 2011 - 07:50
There are several ways to go about this and some of it depends on what you are doing in your mod.
Here's one version you could do so long as your are not allowing players to have anything other than the default player appearances. It keeps polymorphed characters from being saved to prevent a bug. You would implement it into your OnModuleLoad script:
//Put this on the top of our OnModuleLoad script or make it a separate include.
const float DELAY = 120.0f; //2 minutes
void ExportAllPlayers()
{
object oPC = GetFirstPC();
while ( GetIsObjectValid(oPC))
{
if(GetAppearanceType(oPC) > 6)
{
SendMessageToPC(oPC, "Your character can not be saved while polymorphed");
}
else
{
ExportSingleCharacter(oPC);
SendMessageToPC(oPC, "Your character has been saved");
}
oPC = GetNextPC();
}
DelayCommand(DELAY, ExportAllPlayers());
}
//OnModuleLoad example...
void main()
{
//stuff
//more stuff
//lots of other stuff
DelayCommand(120.0, ExportAllPlayers());//Add this line to your OnModuleLoad script
}
Hope it helps. Good luck.
Here's one version you could do so long as your are not allowing players to have anything other than the default player appearances. It keeps polymorphed characters from being saved to prevent a bug. You would implement it into your OnModuleLoad script:
//Put this on the top of our OnModuleLoad script or make it a separate include.
const float DELAY = 120.0f; //2 minutes
void ExportAllPlayers()
{
object oPC = GetFirstPC();
while ( GetIsObjectValid(oPC))
{
if(GetAppearanceType(oPC) > 6)
{
SendMessageToPC(oPC, "Your character can not be saved while polymorphed");
}
else
{
ExportSingleCharacter(oPC);
SendMessageToPC(oPC, "Your character has been saved");
}
oPC = GetNextPC();
}
DelayCommand(DELAY, ExportAllPlayers());
}
//OnModuleLoad example...
void main()
{
//stuff
//more stuff
//lots of other stuff
DelayCommand(120.0, ExportAllPlayers());//Add this line to your OnModuleLoad script
}
Hope it helps. Good luck.
Modifié par GhostOfGod, 15 avril 2011 - 07:51 .





Retour en haut






