12.07.2012, 00:56
Was wondering if anyone would be willing to make a movable gate at a spot on my server. If u can do it ILL pm u the details and REP++++++.
#include <a_samp>
new
gate,
playaName[25],
gateStatus = 0;
public OnFilterScriptInit()
{
gate = CreateObject(987, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/gate", true))
{
GetPlayerName(playerid, playaName, 24);
if(!strcmp(playaName,"SAMP_Player",true))
{
if(!gateStatus)
{
MoveObject(gate, 0.0, 0.0, -3.0, 2.5);
gateStatus = 1;
return 1;
}
else
{
MoveObject(gate, 0.0, 0.0, 0.0, 2.5);
gateStatus = 0;
return 1;
}
}
}
return 1;
}
#include <a_samp>
//****** Add these just under your includes. (#include) ******
new gate1, gate2;
new bool:Gate1Open;
new bool:Gate2Open;
//************************************************************
public OnFilterScriptInit() //Or OnGameModeInit() if you're using a gamemode.
{
gate1 = CreateObject(980, 2097.51, 1720.01, 12.64, 0.00, 0.00, 63.00);
gate2 = CreateObject(980, 2088.80, 1645.47, 12.43, 0.00, 0.00, 90.00);
Gate1Open = false;
Gate2Open = false;
SetTimer("Gate1Check", 1000, true);
SetTimer("Gate2Check", 1000, true);
return 1;
}
//Add these public functions at the bottom of your script.
forward Gate1Check();
public Gate1Check()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 5, 2097.51, 1720.01, 12.64))
{
new GateName[MAX_PLAYER_NAME];
GetPlayerName(i, GateName, MAX_PLAYER_NAME);
if(strcmp(GateName, "Zach7", false) == 0)
{
if(Gate1Open == false)
{
MoveObject(gate1, 2097.51, 1720.01, 6, 4, 0, 0, 63);
Gate1Open = true;
}
}
}
else
{
if(Gate1Open == true)
{
MoveObject(gate1, 2097.51, 1720.01, 12.64, 4, 0, 0, 63);
Gate1Open = false;
}
}
}
}
return 1;
}
forward Gate2Check();
public Gate2Check()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 5, 2088.80, 1645.47, 12.43))
{
new GateName[MAX_PLAYER_NAME];
GetPlayerName(i, GateName, MAX_PLAYER_NAME);
if(strcmp(GateName, "Zach7", false) == 0)
{
if(Gate2Open == false)
{
MoveObject(gate2, 2088.80, 1645.47, 6, 4, 0, 0, 90);
Gate2Open = true;
}
}
}
else
{
if(Gate2Open == true)
{
MoveObject(gate2, 2088.80, 1645.47, 12.43, 4, 0, 0, 90);
Gate2Open = false;
}
}
}
}
return 1;
}