I need the ability to boot players afer a configurable amount of time and only in certain areas.
Can anyone help.
Booting Players
Débuté par
Madasahatter
, juil. 03 2011 07:33
#1
Posté 03 juillet 2011 - 07:33
#2
Posté 03 juillet 2011 - 08:42
void BootPlayerHandler (object oPC) {
SendMessageToPC(oPC,"Booting...");
if (GetIsObjectValid(oPC)) BootPC(oPC);
}
void BootPlayer (object oPC, string sMessage) {
SendMessageToPC(oPC,"Sorry, you are about to be booted: " + sMessage);
DelayCommand(13.0f,BootPlayerHandler(oPC));
}
you can call BootPlayer from your area's OnEnter event or any other logic that decides to boot them.
EDIT: Added check for valid player object to avoid crashes.
SendMessageToPC(oPC,"Booting...");
if (GetIsObjectValid(oPC)) BootPC(oPC);
}
void BootPlayer (object oPC, string sMessage) {
SendMessageToPC(oPC,"Sorry, you are about to be booted: " + sMessage);
DelayCommand(13.0f,BootPlayerHandler(oPC));
}
you can call BootPlayer from your area's OnEnter event or any other logic that decides to boot them.
EDIT: Added check for valid player object to avoid crashes.
Modifié par eeriegeek, 05 juillet 2011 - 03:34 .
#3
Posté 04 juillet 2011 - 04:53
Sorry I forgot to mention only boot when inactive for a configurable about of time and only in certain areas.
#4
Posté 04 juillet 2011 - 06:17
carefull eeriegeek,
FunkySwerve wrote...
Yes. If you boot a character that's already left the server, it will crash. Use a wrapper when booting:void DoBoot(object oPC) { if (GetIsObjectValid(oPC)) { BootPC(oPC); } }Funky
#5
Posté 05 juillet 2011 - 03:38
Thanks Lightfoot, I added a check to the sample code. I did test a number of times on my server without the check for a valid PC object (Linux 1.69 w/ NWNX) but was unable to crash it with this method. Still, better safe than sorry, there may be other configurations or under heavy loads it may be more of a problem.
#6
Posté 05 juillet 2011 - 03:33
The problem only occurs if you boot someone that's already been booted or left. You can often get away with booting without a validity check, but it'll bite you sooner or later. Afaik this is still a problem in 1.69, but I could be wrong.eeriegeek wrote...
Thanks Lightfoot, I added a check to the sample code. I did test a number of times on my server without the check for a valid PC object (Linux 1.69 w/ NWNX) but was unable to crash it with this method. Still, better safe than sorry, there may be other configurations or under heavy loads it may be more of a problem.
Funky





Retour en haut






