View previous topic :: View next topic |
Author |
Message |
Nul_Char
Joined: 11 Jan 2005 Posts: 4
|
Posted: Sat Mar 19, 2005 18:30 Post subject: DM's based upon database |
|
|
I remember somewhere I saw a message that talk about using NWNX to allow DM login's. Then it would boot people that try to login as DM, however not on the list. Does someone have this script?
Thanks!
Nul_Char |
|
Back to top |
|
|
Lokey
Joined: 02 Jan 2005 Posts: 158
|
Posted: Sun Mar 20, 2005 6:28 Post subject: |
|
|
I'd use public cd key over account name (trivial to use someone else's account, sadly). Then simply check if they're a DM on enter, and compare the cdkey to what you have in your database, if not found boot them. _________________ Neversummer PW NWNx powered mayhem |
|
Back to top |
|
|
Liberty Valance
Joined: 06 Jan 2005 Posts: 21 Location: A Persistent World West2
|
Posted: Sun Mar 20, 2005 21:02 Post subject: |
|
|
that'd be me... it's an easy task to change it to CD key if you want... however, i trust my DMs to be savvy enough to make a password that's hard to guess, and not give it out to anyone. this way, they can log in at a friend's house or whatever, and aren't restricted to logging in from their home computer. also, it's much easier to find their login name (just talk to them), as opposed to having to write a script to grab their public CD key
Here's how mine works...
you may want to make some modifications - mine uses a table called "dmauth" with two columns, "isdm" and "playername"
Code: |
int GetStatus(object oEnteringPC) {
int iStatus = 0;
// pull status from the DB, if there is no entry for the player, will return zero
SQLExecDirect("SELECT `isdm` FROM `dmauth` WHERE `playername`='" + GetPCPlayerName(oEnteringPC) + "'");
if (SQLFetch() != SQL_ERROR) {
iStatus = StringToInt(SQLGetData(1));
} else {
// there was an error executing the SQL statement (DB down?)
// return error code indicating such
iStatus = -1;
}
return iStatus;
}
void main {}
{
// Your onClientEnter code may already have an object for GetEnteringObject(); if you wish to use that object instead,
// simply remove this line and replace all instances of "oEnteringPC" in this sample main() with your object name
object oEnteringPC = GetEnteringObject();
int isRealDM = GetStatus(oEnteringPC);
// There was a problem with the SQL query - boot the player, to prevent potential issues
//with unusual characters in login name or other such exploits
if (isRealDM == -1) {
DelayCommand(0.1, WriteTimestampedLogEntry("Player " +
GetPCPlayerName(oEnteringPC) + " - invalid SQL query in GetStatus() in onClientEnter event"));
DelayCommand(1.0, BootPC(oEnteringPC));
}
// If GetStatus() did not return 1 but player is attempting to log in as DM, they aren't authorized. Boot them.
if (GetIsDM(oEnteringPC) && isRealDM != 1) {
// Log it for posterity
DelayCommand(0.1, WriteTimestampedLogEntry("Player " +
GetPCPlayerName(oEnteringPC) + " attempted to log in" +
" as DM, without authorization, from " + GetPCIPAddress(oEnteringPC) + "!"));
DelayCommand(1.0, BootPC(oEnteringPC));
return;
}
//...
// Your on client enter code here
//...
}
|
enjoy! _________________ A Persistent World West2 | APWW2 Forums
Wirehead Studios |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|