undefined symbol: objectid
#1

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if (newkeys & KEY_SUBMISSION)
  {
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 1596.950439, -1638.030151, 12.927757))
    {
      if(Gates[objectid] == 0)
      {
        Gates[objectid] = 1;
        SendClientMessageToAll(0xFF8040FF, "LSPD Gates Opening");
        MoveObject(LSGATE, 1589.042725, -1638.030151, 12.927757, 2);
            }
        }
    }
    else if (newkeys & KEY_JUMP)
    {
      if(IsPlayerInRangeOfPoint(playerid, 10.0, 1596.950439, -1638.030151, 12.927757))
      {
            if(Gates[objectid] == 1)
            {
              Gates[objectid] = 0;
              SendClientMessageToAll(0xFF8040FF, "LSPD Gates Closing");
              MoveObject(LSGATE, 1596.950439, -1638.030151, 12.927757, 2);
            }
        }
    }
    return 1;
}
Simple problem i know but, Ive never done this before, So how would i do that,
I know playerid and vehicleid but first time ever with objectid
Reply
#2

Not sure if this will work properly or not, but try adding objectid onto OnPlayerKeyStateChange

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys, objectid)
Reply
#3

Quote:
Originally Posted by Kevin Fallow / KevKo
Not sure if this will work properly or not, but try adding objectid onto OnPlayerKeyStateChange

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys, objectid)
No that will not work at all.
---------------------------------------------
Why did you assign a array to the Gates?
Reply
#4

To check if there open or not, And its used in some other bits also
Reply
#5

Quote:
Originally Posted by Torran
To check if there open or not, And its used in some other bits also
dont do that, it wont work at all...

Just do
Код:
Gates = 0;
remove the [objectid] and the array.
Reply
#6

you need a variable that contains the id of the gate

pawn Код:
new object;


you need it defined by CreateObject

pawn Код:
object = CreateObject(...);


you move it with the id

pawn Код:
MoveObject(object, ...);


and a variable to check if its open or not
Reply
#7

Quote:
Originally Posted by Vetle
you need a variable that contains the id of the gate

pawn Код:
new object;
you need it defined by CreateObject

pawn Код:
object = CreateObject(...);
you move it with the id

pawn Код:
MoveObject(object, ...);
I know that, And ive done that, Thats not the problem,
As for Comptons Eazy E,

Will that work? Like for checking if its open or closed
Reply
#8

Quote:
Originally Posted by Torran
Quote:
Originally Posted by Vetle
you need a variable that contains the id of the gate

pawn Код:
new object;
you need it defined by CreateObject

pawn Код:
object = CreateObject(...);
you move it with the id

pawn Код:
MoveObject(object, ...);
I know that, And ive done that, Thats not the problem,
As for Comptons Eazy E,

Will that work? Like for checking if its open or closed
Yes,

Код:
new object = 0; // I guess 0 means it's closed for you right?
Then when you open the gate:
Код:
object = 1;
So let me remake the code for you mate

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if (newkeys & KEY_SUBMISSION)
  {
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 1596.950439, -1638.030151, 12.927757))
    {
      if(Gates == 0)
      {
      	Gates = 1;
      	SendClientMessageToAll(0xFF8040FF, "LSPD Gates Opening");
      	MoveObject(LSGATE, 1589.042725, -1638.030151, 12.927757, 2);
			}
		}
	}
	else if (newkeys & KEY_JUMP)
	{
	  if(IsPlayerInRangeOfPoint(playerid, 10.0, 1596.950439, -1638.030151, 12.927757))
	  {
			if(Gates == 1)
			{
			  Gates = 0;
			  SendClientMessageToAll(0xFF8040FF, "LSPD Gates Closing");
			  MoveObject(LSGATE, 1596.950439, -1638.030151, 12.927757, 2);
			}
		}
	}
	return 1;
}
Try that.
Reply
#9

Ok, I got in a car, Went to gate, Pressed "2"
I got the message saying opening,
It come the gate bout half a quarter,
Then i got the mesage closing, And it closed again,
Why?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)