If a player stands 1m away from another player the person who has been approached gets 100HP.
#1

Hi, I'm trying to get it so when a player is 1m away from ANY other player on the server it gives the player who has been approached 100hp. I'm not entirely sure how to do this, I tried with OnPlayerUpdate, but I all i can think of is that the player would have to enter an ID, which I don't want.
Reply
#2

just loop trough all players and check if the player is near any of those players..
Reply
#3

Do you mind giving me an example? I would appreciate that.
Reply
#4

Quote:
Originally Posted by cloudysky
Посмотреть сообщение
Do you mind giving me an example? I would appreciate that.
Sure

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(i, x, y, z);
        if(IsPlayerInRangeOfPoint(playerid, 1.0, x, y, z))
        {
            SetPlayerHealth(playerid, 100);
        }
    }
}
Reply
#5

Thank you very much.
Reply


Forum Jump:


Users browsing this thread: