Moving Gate [Help]
#1

hey all,

just a quick problem i'm getting some errors while trying to create this movable gate.

( the 'xxx' 'X' errors i can fix, just the rest i have troubles with)

Errors
Код HTML:
C:\Users\Brandon\Downloads\automatic.pwn(40) : warning 215: expression has no effect
C:\Users\Brandon\Downloads\automatic.pwn(49) : warning 215: expression has no effect

Script
pawn Код:
40 -                    Open{0} == false;
49 -                            Open{0} == true;
Reply
#2

show me the whole thing please
and should me your new for Open but try this first Open[0] if it doesnt work should me the more info
Reply
#3

Try Open[MAX_GATES] == false
Reply
#4

I did have the whole script up, but i edited it and deleted it cause i fixed some other errors i originally had posted


pawn Код:
//automatic

//Change the coordinate by yourself

#define FILTERSCRIPT

#include <a_samp>
#include <foreach>//Download this include if you don't have one

#define MAX_GATES 1

new Gate[MAX_GATES],
    bool:Open[MAX_GATES];

new GateTimer[MAX_GATES];

forward GateMovement1();
forward GateMovement2();
forward GateMovement3();

public OnFilterScriptInit()
{
    Gate[0] = CreateObject(980, -2126.5476, -80.8152, 37.1033, -2116.7076, -80.8152, 37.1033, 250.0);
    GateTimer[0] = SetTimer("GateMovement1",5000,1)
 ;
    return 1;
}

public GateMovement1()
{
    switch(Open{0})
    {
        case true:
        {
            foreach(Player,i)
            {
                if(IsPlayerInRangeOfPoint(i,10,-2116.7076, -80.8152, 37.1033)) return 1;
            }
            MoveObject(Gate[0],-2126.5476, -80.8152, 37.1033,1000);
            Open{0} == false;
        }
        case false:
        {
            foreach(Player,i)
            {
                if(IsPlayerInRangeOfPoint(i,10,-2116.7076, -80.8152, 37.1033))
                {
                    MoveObject(Gate[0],-2126.5476, -80.8152, 37.1033,1000);
                    Open{0} == true;
                    return 1;
                }
            }
        }
    }
    return 1;
}
Reply
#5

The whole code shown makes no sense at all. Not when used standalone. You are using a double assignment (which is a check) and end it with a semicolon. Also, the fish hooks are only to indicate a block of code. I take it you want to set a variable which has to be done like this:

array[delimiter] = value;

In your case: open[0] = true; // indicating that the array open, the first item is set to true.
Reply
#6

Please read my post above^
Reply
#7

hmmm well i told u put Open[0] if that didnt work well try what newbie told you
Reply
#8

Quote:
Originally Posted by MrPlatinum
Посмотреть сообщение
Please read my post above^
Yes, it is still there. Read my post and fix your damn code. It is your code, I gave you the explanation on what is wrong, now it is your job to go and fix it.
Reply
#9

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
Also, the fish hooks are only to indicate a block of code.
Wrong. They are also used to access the index of a char array. But for it to work correctly the array size must also be declared with the char keyword. e.g.:
pawn Код:
bool:Open[MAX_GATES char];
Open{0} = true;
Reply
#10

Quote:
Originally Posted by Vince
Посмотреть сообщение
Wrong. They are also used to access the index of a char array. But for it to work correctly the array size must also be declared with the char keyword. e.g.:
pawn Код:
bool:Open[MAX_GATES char];
Open{0} = true;
Yea I just heard that on IRC as well. I just don't see this guy working with an array of chars anytime soon though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)