Leellenõrzõd térbeli pozíció alapján hogy közel van e mondjuk X = 40, Y = 40, Z = 10
IsPlayerRangeOfPoint(....) -al, és ha ennél a poziciónál van, elindítod a kapu mozgatását.
#include <a_samp>
#include <zcmd> // ha nincs ilyened töltsd le
CMD:nyit(playerid)
{
if(IsPlayerRangeOfPoint(playerid, x, y, z, távolság)) return MoveObject(....);
else if(IsPlayerRangeOfPoint(playerid, x, y, z, távolság)) return MoveObject(....);
else if(IsPlayerRangeOfPoint(playerid, x, y, z, távolság)) return MoveObject(....);
else if(IsPlayerRangeOfPoint(playerid, x, y, z, távolság)) return MoveObject(....);
return 1;
}
Remélem érted a gondolkodásmenetem.
Üdv. ;)
ahogy írta :D
Mód eleje, vége... de ne fügvényeken belül ;)
de ebben hiba van xD
stock IsPlayerRangeOfPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
ez nem kéne ide?
de ebben hiba van xD
stock IsPlayerRangeOfPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
ez nem kéne ide?
Az IsPlayerRangeOfPoint függvény, már a \"a_players\" függvénykönyvtárba szerepel.
Tehát ez a kód, amit Te írtál felesleges. :D