GTA Közösség - A magyar GTA fórum

San Andreas Multiplayer (SA-MP) => SA-MP: Szerverfejlesztés => Segítségkérés => A témát indította: roland222 - 2010. december 25. - 13:02:50

Cím: több azonos parancs
Írta: roland222 - 2010. december 25. - 13:02:50
na az lenne a kérdésem hogy hogyan lehet megoldani azt h többször is fellehet használni 1 parancsot pl kapuknál? mert nálam hiába csak a kapu közelében lehet kinyitni a kaput pl /nyit al de ha csinálok még 1 kaput azt is /nyittal az nem müxik
valaki tudna nekem 1 ilyet írni hogy ha értitek? xd
Cím: több azonos parancs
Írta: jana4 - 2010. december 25. - 13:54:10
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.  ;)
Cím: több azonos parancs
Írta: roland222 - 2010. december 30. - 11:12:45
és ezt hova kell?
Cím: több azonos parancs
Írta: Yeaseiro - 2010. december 30. - 11:17:11
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?
Cím: több azonos parancs
Írta: Csabesz - 2010. december 30. - 13:55:39
Idézetet írta: Orbit date=1293704231\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"4892\" data-ipsquote-contentclass=\"forums_Topic
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