Distance from player
#1

Well yeah, I thought about if it was possible to get the distance between players, like i mean if the distance between id 0 and 1 is below 500 meters then id 1 will die .

I looked around at the wiki, but i don't think i'm looking at the right place .

Anyhow, this is which pages i already looked at:

https://sampwiki.blast.hk/wiki/GetVehicleDistanceFromPoint
________________________________________________
^^ I don't think that's soo important, but the one below this text might be?

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

Any solutions?
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
If you have two functions you think are useful, why not play about with them? That is how most people learn.
Yeah, why not? Thanks tho :3


-Silly me

EDIT: I actually think it's pretty simply, by switching some functions around :3
Reply
#3

I built a little stock as I figured it would be useful for me, so here it is.


Код:
stock IsPlayerInRangeOfPlayer(playerid, otherplayerid, range){
    new Float:oPX, Float:oPX, Float:oPZ;
    GetPlayerPos(otherplayerid, oPX, oPY, oPZ);
    if(IsPlayerInRangeOfPoint(playerid, range, oPX, oPY, oPZ)) return 1;
    else return 0;
}
usage:
Код:
if(IsPlayerInRangeOfPoint(playerid, otherplayerid, 10.0)) //do stuff
else //do other stuff
Reply
#4

I have always stuck with "if" but if you think it could be helpful I can probably reduce my code in loads of places.

Can you explain a little further, i'm the old fashioned type who likes to know about ON and OFF switches
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)