Gate Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Gate Help (
/showthread.php?tid=344270)
Gate Help -
Josip_Hrnjak - 20.05.2012
i found this on samp wiki... and i have few questions..
do i need command for this, or no? I think that this doesnt need command
And how can i make that gate opens only for members of some faction, eg.
so here is the code
This goes to top of script:
This too:
Код:
forward CheckGate();
This goes to OnGameModeInit:
Код:
mygate = CreateObject(object_ID, closed_X, closed_Y, closed_Z, closed_rad_X, closed_rad_Y, closed_rad_Z)
Код:
public CheckGate()
{
new mygate_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0,closed_X,closed_Y,closed_Z))mygate_status=1;
}
if(mygate_status)MoveObject(mygate, open_X, open_Y, open_Z,Moving Speed);
else MoveObject(mygate, closed_X, closed_Y, closed_Z, Moving Speed);
}
But where i put that gate opens only for members... And is this right?
Re: Gate Help -
Faisal_khan - 20.05.2012
Yeah you don't need commands for this.
For a faction to open the gate to this:
pawn Код:
public CheckGate()
{
new mygate_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0,closed_X,closed_Y,closed_Z))mygate_status=1;
}
if (GetPlayerTeam(playerid) == /*Your faction here*/
{
if(mygate_status)MoveObject(mygate, open_X, open_Y, open_Z,Moving Speed);
else MoveObject(mygate, closed_X, closed_Y, closed_Z, Moving Speed);
}
else
{
return 1;
}
}
Re: Gate Help -
Josip_Hrnjak - 20.05.2012
Thanks
Re: Gate Help -
Faisal_khan - 20.05.2012
Shit I missed a bracket:
pawn Код:
public CheckGate()
{
new mygate_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0,closed_X,closed_Y,closed_Z))mygate_status=1;
}
if (GetPlayerTeam(playerid) == /*Your faction here*/)//This was my missing bracket.
{
if(mygate_status)MoveObject(mygate, open_X, open_Y, open_Z,Moving Speed);
else MoveObject(mygate, closed_X, closed_Y, closed_Z, Moving Speed);
}
else
{
return 1;
}
}
Wish you luck!
Re: Gate Help -
Josip_Hrnjak - 20.05.2012
Thanks