[Include] [Function]IsPlayerInRange
#1

Hello,

So this is nothing like IsPlayerInRangeOfPoint, well it is, but this function is looking X and Y Coordinates. There is nothing like Float:range. Here is the code.

pawn Код:
stock IsPlayerInRange(Float:Start_X, Float:Start_Y, Float:End_X, Float:End_Y, playerid){
    new Float:Current_X, Float:Current_Y, Float:Current_Z;
    GetPlayerPos(playerid, Current_X, Current_Y, Current_Z);
    if(Start_X >= Current_X && End_X <= Current_X && Start_Y <= Current_Y && End_Y >= Current_Y){
        return 1;
    }else{
        return 0;
    }
}

Start_X must always be higher value than End_X, and Start_Y smaller than End_Y...
Reply
#2

Useful Functions
Reply
#3

Wow you have just made IsPlayerInArea which has been made several years ago!
https://sampwiki.blast.hk/wiki/Useful_Fu...IsPlayerInArea
Reply
#4

lol, I didn't know that function exists , I made this one for my rp script, cuz i need it for /call function to check does player have signal
Reply
#5

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
lol, I didn't know that function exists , I made this one for my rp script, cuz i need it for /call function to check does player have signal
Hmm I think you are not that good at english because if you needed it without writing on yourself you would find it , but no problem :P At least you can script
Reply
#6

But as I see there is no code for that function, and Notepad++ can't compile it cuz it says rp.pwn(4512) : error 017: undefined symbol "IsPlayerInArea"
Reply
#7

Quote:
Originally Posted by gamer_Z
Посмотреть сообщение
Hmm I think you are not that good at english because if you needed it without writing on yourself you would find it , but no problem :P At least you can script
I am good at English but I wasn't looking for it, it was easier to write one , and you can bet I can script, right now I am working on my roleplay script, it is fu****g huge, but i have to work on it lot more
Reply
#8

IsPlayerInArea is the correct name for this function, NOT IsPlayerInRange.
This function checks if you're within the specified Square-area, not if you're simply <= X meters away from something.
Reply
#9

i know that, but when i tried that function yesterday it said rp.pwn(4512) : error 017: undefined symbol "IsPlayerInArea" , and i scripted my function and i called it IsPlayerInRange, if you don't like name of the functon you can change it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)