SA-MP Forums Archive
[HELP] Admin area - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Admin area (/showthread.php?tid=276543)



[HELP] Admin area - Kalzifer - 14.08.2011

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.



Re: [HELP] Admin area - Grim_ - 14.08.2011

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;
}



Re: [HELP] Admin area - RowdyrideR - 14.08.2011

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 */
        }
    }
}



Re: [HELP] Admin area - Kalzifer - 14.08.2011

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(


Re: [HELP] Admin area - RowdyrideR - 14.08.2011

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


Re: [HELP] Admin area - Grim_ - 14.08.2011

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.


Re: [HELP] Admin area - Kalzifer - 14.08.2011

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.


Re: [HELP] Admin area - Kalzifer - 14.08.2011

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)


Re: [HELP] Admin area - RowdyrideR - 14.08.2011

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


Re: [HELP] Admin area - Wesley221 - 14.08.2011

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