error 001: expected token: ";", but found "public" HELP ME ASAP THANKS
#1

Quote:

#include <a_samp>
new gate;
new bool:gateopen;
new playerid

public OnFilterScriptInit() // Alternatively, use OnGameModeInit if you implement it in your gamemode
{
SetTimer("GateCheck", 800, true); //This is used to create the timer. The "GateCheck" is the callback we'll be using,
// the '800' is the amount of milliseconds between each call and the 'true' indicates that this timer is looping endlessly
gate = (969,1549.59997559,-1623.00000000,12.60000038,0.00000000,0.00000000,27 0.00000000);
//'gate = CreateObject(...);' = Assigns the object id of the gate to the 'gate' variable
//16442 = object model id < change it to the model id you use for your gate
// 1549.59997559,-1623.00000000,12.60000038 = coordinates of the gate
// 0.00000000,0.00000000,270.00000000 = Rotation of the gate.
return 1;
}


forward GateCheck();
public GateCheck()
{
for(new i; i < MAX_PLAYERS; i++) { // Start the loop
//Check if any player is in the area. Replace '8.0, 3.0, 10.0' with your own coordinates of your closed gate.
if(IsPlayerInRangeOfPoint(playerid, 15.0, 1549.59997559, -1623.00000000, 12.6000003) {
if(gateopen == false) { // If the gate isn't open...
//Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate.
MoveObject(gate, 1549.59997559, -1623.00000000, 9.60000038, 3.5);
gateopen = true; // Setting this to true indicates it's open(ing)
}
return; //This closes the callback
}
}
//This is called if nobody has been found near the gate. Obviously, because 'return' would fully close the function and this wouldn't be used then.
if(gateopen == true) { //If the gate IS open, but there's no one near..
// Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed.
MoveObject(gate, 1549.59997559, -1623.00000000, 12.60000038, 3.5);
gateopen = false; //This indicates the gate is closed again. Or at least, closing.
}
}

But iam getting this error

Quote:

C:\Users\jacquie\Desktop\Next Generation Roleplay New Fixed\Next Generation Roleplay New Fixed\Next Generation Roleplay FIXED\filterscripts\Automaticgate.pwn(6) : error 001: expected token: ";", but found "public"
C:\Users\jacquie\Desktop\Next Generation Roleplay New Fixed\Next Generation Roleplay New Fixed\Next Generation Roleplay FIXED\filterscripts\Automaticgate.pwn(10) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Reply
#2

Quote:

#include <a_samp>
new gate;
new bool:gateopen;
new playerid; <----- i forgot to add the semi colon i figured it out sorry guys

I figured it out sorry guys
Reply
#3

Use [pawn] SCRIPT [ /pawn]
Reply
#4

pawn Код:
new playerid;
and
pawn Код:
gate = CreateObject(969,1549.59997559,-1623.00000000,12.60000038,0.00000000,0.00000000,27 0.00000000);
Reply
#5

Try:
pawn Код:
#include <a_samp>
new gate;
new bool:gateopen;

public OnFilterScriptInit()
{
    SetTimer("GateCheck", 800, true);
    gate = CreateObject(969,1549.59997559,-1623.00000000,12.60000038,0.0, 0.0, 96.0, 250.0);
    return 1;
}

forward GateCheck();
public GateCheck()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(i, 15.0, 1549.59997559, -1623.00000000, 12.6000003))
        {
            if(gateopen == false)
            {
                MoveObject(gate, 1549.59997559, -1623.00000000, 9.60000038, 3.5);
                gateopen = true;
                return 1;
            }
            if(gateopen == true)
            {
                MoveObject(gate, 1549.59997559, -1623.00000000, 12.60000038, 3.5);
                gateopen = false;
                return 1;
            }
        }
    }
    return 1;
}
Reply
#6

also make a bit well seem your script because its a bit confusing with the lot "//"comments there..
Reply
#7

Quote:
Originally Posted by ******
Посмотреть сообщение
You are REALLY not going to want to make "playerid" a global variable - many callbacks have that as a local parameter and declaring it global will not do what you think I suspect.
+1
WTF MAN ?
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
Are you complaining that there are TOO MANY comments? Most people like comments, see something I wrote in the last few minutes:

pawn Код:
hook OnPlayerConnect(playerid)
{
    // -2 means unknown.
    YSI_g_sPlayerYID[playerid] = -2;
    broadcast _Player_IsLoggedIn(playerid);
    if (existproperty(8, YSIM_LOG_IN))
    {
        new
            yid = getproperty(8, YSIM_LOG_IN);
        if (yid != -1)
        {
            // This DOES NOT use "broadcast" as it's local only.
            Player_DoLogin(playerid, yid);
        }
        deleteproperty(8, YSIM_LOG_IN);
    }
    else
    {
        // Can do checking in here to see if they just rejoined.
        //YSI_g_sPlayerYID[playerid] = -1;
        if (Player_RefreshPossible(ReturnPlayerName(playerid), YSI_g_sPossibleData[playerid]) == e_POSSIBLE_ERROR_NONE)
        {
            // The player is registered, default to using the selected language
            // even though they're not registered.  Note that we may need some
            // bi-lingual text using both this language and the server default
            // language until we ascertain that this is in fact the player in
            // question and not just someone with the same name, so that they
            // stand a greater chance of understanding that this username is
            // taken and that they may need to leave and re-join (or add in-game
            // name change so they don't even need to leave and return).
            Langs_SetPlayerLanguage(playerid, YSI_g_sPossibleData[playerid][E_POSSIBLE_USER_LANG]);
        }
    }
}

hook OnPlayerDisconnect(playerid, reason)
{
    if (YSI_g_sPlayerYID[playerid] != -1)
    {
        // DO NOT broadcast this in case it's just because of one script being
        // unloaded, not the player actually leaving (and thus do everything in
        // different scripts separately).
        Player_DoLogout(playerid, YSI_g_sPlayerYID[playerid]);
    }
    YSI_g_sPlayerYID[playerid] = -2;
}
And I didn't even bother with function-header comments on these ones:

pawn Код:
/*----------------------------------------------------------------------------*\
Function:
    Player_RemoveEntry
Params:
    name[] - Item to remove.
Return:
    -
Notes:
    Wrapper for Player_AddToBuffer for removing data.
\*----------------------------------------------------------------------------*/


stock Player_RemoveEntry(name[])
{
    INI_RemoveEntry(YSI_g_sPlayerWriteFile, name);
}
In both cases the ratio of literate lines of code to descriptive lines of comments are about 1:1 (don't know if this is fluke or not).
yes but your script you show is more tidier than his ... its very well structed i mean as a dome not as a script..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)