Problem - Barrier..
#1

Hello.

I have a problem with my barrier.
It looks like i can't move it, destroy it, rotate it or in other words - do anything with it.

I want it to open by using a command with animation or not, but nothing works.
I've tried basically everything and i can't seem to understand what i am doing wrong.

Can any of you help me out? Thanks

The code looks as following:
Код:
forward ScrapyardBarrierClosed();
new Scrapyard_BarrierOpen;
new Scrapyard_BarrierClosed;


public OnGameModeInit()
{

Scrapyard_BarrierClosed = CreateObject(968, -1207.1535, -1056.7249, 128.4134, 0, 270, 0); // Scrapyard Barriere Turn

	return 1;
}


public ScrapyardBarrierClosed()
{

  DestroyObject( Scrapyard_BarrierOpen );
  SetObjectPos(Scrapyard_BarrierClosed, -1207.1535, -1056.7249, 128.4134); 
  return 1;
}


if(!strcmp("/buyscrapticket",cmdtext))
	{
	if(IsPlayerInRangeOfPoint(playerid,5,-1210.7212,-1061.7201,128.2656))
	{
	SetObjectPos(Scrapyard_BarrierClosed, -1207.1535, -1056.7249, 0);
	Scrapyard_BarrierOpen = CreateObject(968, -1207.1535, -1056.7249, 128.4134, 0.000, 0.000, 0.000);
 	SetTimer("ScrapyardBarrierClosed", 10000, 0);
 	SendClientMessage(playerid, COLOR_YELLOW,"You have bought a ticket to enter the Scrapyard.");
 	SendClientMessage(playerid, COLOR_BRIGHTRED,"The gate closes in 10 seconds.");
	}else{
	SendClientMessage(playerid, COLOR_YELLOW,"You have to be near the guards at the Scrapyard to buy a ticket.");
	}

  return 1;
}
I appreciate any help i can get.
Reply
#2

Can nobody help me with my problem here?
Reply
#3

use MoveObject
Reply
#4

I appreciate your post, but i already did try that.
Anyways i just tried it again, in hope for it to work - but no


I replaced the SetObjectPos with MoveObject, modified it to x, y, z, time.
Changed the Z value with around +10.


Here's the result:

It moves a barrier from its original position, and puts it +10 up.
But for some reason, it looks like it makes another barrier when i do moveobject and then i get 3 barriers..


The rest works as a dream. a new barrier creates as it was indicated it was open, and then it destroys after 10 seconds.
Reply
#5

Why do you create 'barrier open' object if you already move 'barrier closed' away? Make it with MoveObject, and if it still doesnt work, post your code.
You are really making it look more difficult than it actually is. Make ONE variable for storing barrier id, use ONE CreateObject to create it on ModeInit. And open it and close with ONE MoveObject each. If you complicate things like this it's more difficult to find bug. And if MoveObject didnt work for you why didnt you post that first before you messed things up with some strange walkarounds that don't even work?
Reply
#6

Just to make myself clear, i quote my first post:
It looks like i can't move it, destroy it, rotate it or in other words - do anything with it.


I've tried everything. moving it but it simply just make another barrier. i see my barrier move, but there's suddenly another one at it's original place that just wont move.

I tried to setobjectpos, rotate, move and even destroy, but i guess barriers are just bugged?
Reply
#7

Quote:
Originally Posted by Faith
I've tried everything. moving it but it simply just make another barrier. i see my barrier move, but there's suddenly another one at it's original place that just wont move.
check when CreateObject is called. If you post your code, i'll show you your bug. Otherwise I can't help you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)