Auto 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: Auto gate help (
/showthread.php?tid=572904)
Auto gate help -
Toxik - 02.05.2015
hey guys .. well im a puree noob
How can i make the gate open when Player> "[Cro]Mexi69" get close them ?
pawn Код:
#include <a_samp>
new Mexi69;
public OnGameModeInit()
{
Mexi69 = CreateObject(976, );
SetTimer("Mexi", 1000, 1);
}
forward Mexi();
public Mexi()
{
new open;
for(new i=GetMaxPlayers(); i > -1; i--)
{
if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 2.0, , , ))
{
open = 1;
MoveObject(Mexi69, 318.5770, -1190.4686, 75.4311, 2.0);
break;
}
}
if(!open)
MoveObject(Mexi69, , , , 2.0);
}
ANYONE ?
Re: Auto gate help -
Kimossab - 02.05.2015
If it's just for that player, then I sugest just starting the timer when he connects and save the id in a variable. Then in the timer simply check if that id is close to the gate. If it's true then open the gate. Simple and efficient.
Re: Auto gate help -
Toxik - 02.05.2015
well thanks i will try
btw
can u post me some codes to be sure
so i learn some Shit
Re: Auto gate help -
Kimossab - 02.05.2015
pawn Код:
new gatepid, timer;
public OnPlayerConnect(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
if(!strcmp(pName,"[Cro]Mexi69")
{
gatepid=playerid;
timer = SetTimer("Mexi", 1000, 1);
}
}
forward Mexi();
public Mexi()
{
if(!IsPlayerConnected(gatepid))
{
KillTimer(timer);
return 0;
}
if(IsPlayerInRangeOfPoint(i, 2.0, , , ))
MoveObject(Mexi69, 318.5770, -1190.4686, 75.4311, 2.0);
}
codes weren't tested, but it should be something like that.