SA-MP Forums Archive
Detecting if im close to a locker point - 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: Detecting if im close to a locker point (/showthread.php?tid=372845)



Detecting if im close to a locker point - RLGaming - 28.08.2012

Ok, so I have a pLockers and I made a dialog CMD where if I click the one on the list, it sets Dynamic 3D text at my location, how can I make it so if you do /lockers it check if your in-range of where I put the 3D text?


I understand this might be a bit hard, but +rep and a big hug to anyone that helps me :/

please and thank you


Re: Detecting if im close to a locker point - HuSs3n - 28.08.2012

when you create the 3D Text, save the X,Y,Z position in a variable
then in your cmd ,use IsPlayerInRangeOfPoint to check if you are near that point

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: Detecting if im close to a locker point - RLGaming - 28.08.2012

I already have it saved, but if it's near a point like: ifinrange or whatever is for co-ordinates?

Could someone write out an example please?


Re: Detecting if im close to a locker point - RLGaming - 28.08.2012

anyone please


Re: Detecting if im close to a locker point - RLGaming - 28.08.2012

Basically I made a pLockerPoint - So, how would I make it so if inplayer range of pLockerPoint then make it load the locker but if he's not in range of where the locker point is, it wouldnt load

+rep to anyone that can help! thanks!


Re: Detecting if im close to a locker point - RLGaming - 28.08.2012

someone? Please!


Re: Detecting if im close to a locker point - iGetty - 29.08.2012

Only thing I can think of is;

if(IsPlayerInRangeOfPoint(playerid, Float:range, Float, Float:y, Float:z))

under OnPlayerUpdate.


Re: Detecting if im close to a locker point - Socan - 29.08.2012

Give us the bit of script you use for the command you want at the lcker


Re: Detecting if im close to a locker point - tallerin - 29.08.2012

Heres an example of how to do it. sounds like you only need the if(!PlayerInRangeOfPoint part so use it with your x y z cords the first # 2.2 is the range to be within change it to your range you want them to be in for the dialog to open the next 3 # are your x y z cords. The !PlayerInRangeOfPoint(playerid,range,x,y,z prevents them from opening the locker from anywhere they want so when there at diff cords they will get the msg you aren't near your locker, but when they are at the set cords it will open the dialog.

pawn Code:
CMD:locker(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(IsACop(playerid))
    {
        if(!IsPlayerInRangeOfPoint(playerid, 2.2,256.2174,77.3295,1004.0344)) return SendClientMessage(playerid, COLOR_GREY, "You aren't near your locker.");
        ShowDialog(playerid, 5);
    }



Re: Detecting if im close to a locker point - RLGaming - 07.09.2012

any niggas that can help