Detecting if im close to a locker point
#1

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
Reply
#2

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
Reply
#3

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?
Reply
#4

anyone please
Reply
#5

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!
Reply
#6

someone? Please!
Reply
#7

Only thing I can think of is;

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

under OnPlayerUpdate.
Reply
#8

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

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);
    }
Reply
#10

any niggas that can help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)