View previous topic :: View next topic |
Author |
Message |
GAC
Joined: 01 Mar 2011 Posts: 7
|
Posted: Thu Mar 03, 2011 2:00 Post subject: |
|
|
Sorry, but it won't compile, but then again it's been years since Abraxsis wrote this . . .
Abraxsis wrote: |
Code: |
1 // Added by Abraxsis Aug 04, 2008
2 // Is the speaker a DM?
3 object oPC = GetPCSpeaker( );
4 if( GetIsDM(oPC ) != TRUE ) {
5 object oPCTest = GetFirstPC( );
6 string sTestPCName = GetPCPlayerName( oPC);
7 int nFound = FALSE;
8 while( GetIsObjectValid( oPCTest) && ( ! nFound)) {
9 if( GetPCPlayerName( oPCTest) == sTestPCName) {
10 if( GetIsDM( oPCTest)) {
11 nFound = TRUE;
12 } else {
13 SendMessageToPC( oPC,"This is too much power for mere mortals!");
14 return FALSE;
15 }
16 }
17 oPCTest=GetNextPC( );
18 }
19 }
20 // End Is the speaker a DM?
|
|
Script1.nss (4): ERROR: INVALID DECLARATION TYPE |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Wed Mar 09, 2011 15:15 Post subject: |
|
|
try this
Code: |
1 // Added by Abraxsis Aug 04, 2008
2 // Is the speaker a DM?
3 object oPC = GetPCSpeaker( );
4 if(!GetIsDM(oPC)) {
5 object oPCTest = GetFirstPC( );
6 string sTestPCName = GetPCPlayerName( oPC);
7 int nFound = FALSE;
8 while( GetIsObjectValid( oPCTest) && ( ! nFound)) {
9 if( GetPCPlayerName( oPCTest) == sTestPCName) {
10 if( GetIsDM( oPCTest)) {
11 nFound = TRUE;
12 } else {
13 SendMessageToPC( oPC,"This is too much power for mere mortals!");
14 return FALSE;
15 }
16 }
17 oPCTest=GetNextPC( );
18 }
19 }
20 // End Is the speaker a DM?
|
Not entirely sure why it would be throwing up an error.
but for IF Statements where it is returning a true or false statement, you are able to shorten the statement by using the ! operator. |
|
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
|