Moveobject trouble -
Vilt™ - 25.08.2010
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/enter", true, 10)==0)
{
if(IsPlayerInRangeOfPoint(playerid,3.0,1552.4473,-1674.9888,16.1953))
{
SendClientMessage(playerid,0x00ABFFFF,"Welcome to the LAPD");
SetPlayerInterior(playerid, 14);
SetPlayerPos(playerid,1550.9105,-1683.8849,1723.1050);
return 1;
}
}
if(strcmp(cmdtext, "/exit", true, 10)==0)
{
if(IsPlayerInRangeOfPoint(playerid,3.0,1550.9105,-1683.8849,1723.1050))
{
SetPlayerPos(playerid,1552.4473,-1674.9888,17);
return 1;
}
}
if(strcmp(cmdtext, "/Gate", true, 10)==0)
{
if(IsPlayerInRangeOfPoint(playerid,10.0,1596.4467,-1637.9670,14.6039))//Garage
{
MoveObject(PDgarage,1597.9567,-1637.9670,14.6039,1.5);//Garage
}
else
{
MoveObject(PDgarage,1589.4362,-1637.9670,14.6039,1.5);//Garageclose
}
return 1;
}
return 0;
}
The problem is, when i do /gate. it opens. when I want to do /gate again, It doesn't close while it should. Did I forgot something?
Re: Moveobject trouble -
AndriusZ* - 25.08.2010
if(strcmp(cmdtext, "/Gate", true, 10)==0)
try to change:
if(strcmp(cmdtext, "/Gate", true, 5)==0)
Re: Moveobject trouble -
Toni - 25.08.2010
You need to create a var, and set it to 1, when you do /gate (to open).
pawn Код:
if(!strcmp(cmdtext, "/gate", true))
{
if(var == 1)
{
//Close Object
}
else if(var == 0)
{
//close object
}
Re: Moveobject trouble -
Vilt™ - 25.08.2010
I have the var: PDgarage=Createobject(myobject, Float:X, Float:Y, Float:Z, Float:Speed);
Can I use that as var, or do I have to create a new var or something.
pawn Код:
public OnPlayerCommandText
}
if(strcmp(cmdtext, "/Gate", true))
{
if(IsPlayerInRangeOfPoint(playerid,10.0,1596.4467,-1637.9670,14.6039))
{
if(PDgarage == 1)//Garage
{
MoveObject(PDgarage,1597.9567,-1637.9670,14.6039,1.5);//Garage
}
else if(PDgarage == 0)
{
MoveObject(PDgarage,1589.4362,-1637.9670,14.6039,1.5);//Garageclose
}
return 1;
}
}
return 0;
}
it compiles, but it still doesn't work. Can someone maybe fix it or something?
Re: Moveobject trouble -
Toni - 26.08.2010
Create a new var, 'PDgarage' is already assigned to a
object not a value, so you can't use both in 1.
Make a new one like, new gateopenclose = 0;
Re: Moveobject trouble -
Vilt™ - 28.08.2010
It works now, but now i have another thing, the spot where you do /gate, moves wo the position of the opened gate, how to fix that?
Re: Moveobject trouble -
Thebest96 - 28.08.2010
You need put, in the CLOSED gates COORDINATES the gate coordinates