[HELP] Admin area
#1

Please help to solve this problem:
I found it in "useful snippets" but something went wrong while compiling.

Here's the code that I found already with my coords:

Код:
 SetTimer("AreaCheck", 1000, 1);

// The function

AreaCheck();
{
    for(new i=0; i<MAX_PLAYERS; i++ ) {
        if(IsPlayerConnected(i) && IsPlayerInArea(i, 1097.29, 1177.29, 1204.25, 1354.55) && !IsPlayerAdmin(i)) // CHECK: If the player is a admin, if the player is in the area
        { // He's not.
            SendClientMessage(i, YOURCOLOR, "You are not allowed to enter the ADMIN area.");
            /* Do with him whatever
                you want */
        }
    }
}
So that's what I got after compiling:
Код:
C:\Documents and Settings\Admin\Рабочий стол\Сервер 0.3с тест (новый)\gamemodes\uchiha_drift.pwn(884) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Admin\Рабочий стол\Сервер 0.3с тест (новый)\gamemodes\uchiha_drift.pwn(884) : error 001: expected token: ")", but found ";"
C:\Documents and Settings\Admin\Рабочий стол\Сервер 0.3с тест (новый)\gamemodes\uchiha_drift.pwn(889) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Admin\Рабочий стол\Сервер 0.3с тест (новый)\gamemodes\uchiha_drift.pwn(889) : warning 215: expression has no effect
C:\Documents and Settings\Admin\Рабочий стол\Сервер 0.3с тест (новый)\gamemodes\uchiha_drift.pwn(889) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Admin\Рабочий стол\Сервер 0.3с тест (новый)\gamemodes\uchiha_drift.pwn(889) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Admin\Рабочий стол\Сервер 0.3с тест (новый)\gamemodes\uchiha_drift.pwn(889) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#2

There's nothing wrong with the code you presented there. My assumption would be you didn't place the SetTimer function into a callback/function of it's own. I would guess that it should be placed under OnGameMode/FilterScriptInit callback.

pawn Код:
public OnGameModeInit( )
{
   // current code
   SetTimer( "AreaCheck", 1000, 1 );
   return 1;
}
Reply
#3

on the top of your script add

Код:
forward AreaCheck;
then

Код:
public OnGameModeInit( )
{
   SetTimer( "AreaCheck", 1000, 1 );
   return 1;
}
anywhere:

Код:
public AreaCheck();
{
    for(new i=0; i<MAX_PLAYERS; i++ ) {
        if(IsPlayerConnected(i) && IsPlayerInArea(i, 1097.29, 1177.29, 1204.25, 1354.55) && !IsPlayerAdmin(i)) // CHECK: If the player is a admin, if the player is in the area
        { // He's not.
            SendClientMessage(i, YOURCOLOR, "You are not allowed to enter the ADMIN area.");
            /* Do with him whatever
                you want */
        }
    }
}
Reply
#4

Quote:
Originally Posted by Grim_
Посмотреть сообщение
There's nothing wrong with the code you presented there. My assumption would be you didn't place the SetTimer function into a callback/function of it's own. I would guess that it should be placed under OnGameMode/FilterScriptInit callback.

pawn Код:
public OnGameModeInit( )
{
   // current code
   SetTimer( "AreaCheck", 1000, 1 );
   return 1;
}
That didn't help(
Reply
#5

ow and the
Код:
SetTimer( "AreaCheck", 1000, 1 );
add it anywhere u want like under a cmd....etc
Reply
#6

Quote:
Originally Posted by Kalzifer
Посмотреть сообщение
That didn't help(
Thank you for being VERY descriptive in your response.

Seriously, how can you expect me to assist you further based on that response? What do you mean by 'that didn't help'? Did you save and compile? Was the function already somewhere else? When (if) you moved it, did you delete the other one? Come on...

Also show the lines of code the errors are on.
Reply
#7

Quote:
Originally Posted by RowdyrideR
Посмотреть сообщение
ow and the
Код:
SetTimer( "AreaCheck", 1000, 1 );
add it anywhere u want like under a cmd....etc
u won't believe - that didn't help as well.
Reply
#8

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Thank you for being VERY descriptive in your response.

Seriously, how can you expect me to assist you further based on that response? What do you mean by 'that didn't help'? Did you save and compile? Was the function already somewhere else? When (if) you moved it, did you delete the other one? Come on...

Also show the lines of code the errors are on.
Ok, but maybe there's another....easier way of doing what I want? just not to allow someone enter territory (watch coords)
Reply
#9

he's getting rude? lol
so it's a fail from your cmd
GL..
Reply
#10

Its probably because of this line:
pawn Код:
public AreaCheck(); // <----
{
}
A public doesnt need a ';' at the end.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)