[HELP]Problem with gates
#1

hello i tryed to script some gate's but i am little noob and i dident understand so much but i think you guys can help me i making thease gates for my server and to release some gate's on the samp here is the code

Quote:

PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
new Floatldpos[3], Float:temppos[3];
GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
temppos[0] = (oldpos[0] -X);
temppos[1] = (oldpos[1] -Y);
temppos[2] = (oldpos[2] -Z);
if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
{
return true;
}
return false;
}

new c_gate;

c_gate = CreateObject(2669,1245.2478,-767.1913,92.0703,349.5082,1250.0586,-767.1960,92.0638,266.4016);

new OpenGate[MAX_PLAYERS];
SetTimer("CheckGate", 500, true);
forward CheckGate();
public CheckGate()
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(!IsPlayerConnected(i)) continue;
if(PlayerToPoint(10.0, i, 1250.0586,-767.1960,92.0638,266.4016) && OpenGate[i] == 0)
{
MoveObject(c_gate, 1245.2478,-767.1913,92.0703);
OpenGate[i] = 1;
}
else if(!PlayerToPoint(10.0, i, -767.1960,92.0638,266.4016) && OpenGate[i] == 1)
{
MoveObject(c_gate, -767.1960,92.0638,266.4016);
OpenGate[i] = 0;
}
}
}

((sorry for my bad english and the code is from wiki))
Reply
#2

in OnGameModiInit a timer with SetTimer("Kapilar",500,1);

I use this for Otomatic gates
Код:
public Kapilar(playerid)
{
		if(PlayerToPoint(7.0, playerid, 172.8482,654.4478,3.8090))  // Change the hole kode to your own koordinates ..
		{
			MoveObject(Kapi[1], 179.10, 642.13, 9.86, 4.0); // For OPEN the doors
			MoveObject(Kapi[2], 171.40, 640.17, 9.86, 4.0); // For OPEN the doors
		}
		else
		{
			MoveObject(Kapi[1], 179.10, 642.13, 2.86, 4.0); // For CLOSE the doors
			MoveObject(Kapi[2], 171.40, 640.17, 2.86, 4.0); // For CLOSE the doors
		}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)