SA-MP Forums Archive
derby? 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: derby? help (/showthread.php?tid=537448)



derby? help - Champ - 15.09.2014

Hello,
I am about to create a derby system. I would need your help in some stuff related to derby.
How would I detect if a person touches or fell on the ground or sea and after detecting, perform the given action ?
Thank You.


Re: derby? help - SilentSoul - 15.09.2014

You should use this function which checks if the player in water ( if your map is related to water )
pawn Код:
stock IsPlayerInWater(playerid)
{
    new Float:x,Float:y,Float:pz;
    GetPlayerPos(playerid,x,y,pz);
    if ((IsPlayerInArea(playerid, 2032.1371, 1841.2656, 1703.1653, 1467.1099) && pz <= 9.0484)
    || (IsPlayerInArea(playerid, 2109.0725, 2065.8232, 1962.5355, 10.8547) && pz <= 10.0792)
    || (IsPlayerInArea(playerid, -492.5810, -1424.7122, 2836.8284, 2001.8235) && pz <= 41.06)
    || (IsPlayerInArea(playerid, -2675.1492, -2762.1792, -413.3973, -514.3894) && pz <= 4.24)
    || (IsPlayerInArea(playerid, -453.9256, -825.7167, -1869.9600, -2072.8215) && pz <= 5.72)
    || (IsPlayerInArea(playerid, 1281.0251, 1202.2368, -2346.7451, -2414.4492) && pz <= 9.3145)
    || (IsPlayerInArea(playerid, 2012.6154, 1928.9028, -1178.6207, -1221.4043) && pz <= 18.45)
    || (IsPlayerInArea(playerid, 2326.4858, 2295.7471, -1400.2797, -1431.1266) && pz <= 22.615)
    || (IsPlayerInArea(playerid, 2550.0454, 2513.7588, 1583.3751, 1553.0753) && pz <= 9.4171)
    || (IsPlayerInArea(playerid, 1102.3634, 1087.3705, -663.1653, -682.5446) && pz <= 112.45)
    || (IsPlayerInArea(playerid, 1287.7906, 1270.4369, -801.3882, -810.0527) && pz <= 87.123)
    || (pz < 1.5)
    )
    {
    return 1;
    }
    return 0;
}
and of course you need a timer and a loop to check if there's any player in water. else if you need to detect if the players fall into ground, you'll need to check the height, GetPlayerPos(playerid,x,y,z); then you should check if the height is bigger than the height you want if(z > here) ... the action you would take is up to you, you may re-spawn him or kick him from the event.


Re: derby? help - AroseKhanNiazi - 15.09.2014

that's what i also want to know
edit thanks silent


Re: derby? help - PaYkOK - 15.09.2014

You could use MapAndreas https://sampforum.blast.hk/showthread.php?tid=120013


Re: derby? help - Champ - 15.09.2014

ok thanks bro