In a specfic area , players wont be able to dmg each other
#1

Any can explain how you could do this?
Reply
#2

Well there are multiple ways of doing this.

OnPlayerTakeDamage
- if(issuerid != INVALID_PLAYER_ID), Give the player back the health they lost.

SetPlayerTeam
When the player enters the certain area, set their team to a specific number. They won't be able to damage any other players on the same team. So they won't be able to damage anyone in the same area. Don't forget to reset the players team to NO_TEAM when they leave the area though.
Reply
#3

Hi!

There are more then only one way because you can use two functions.

1. function - IsPlayerInRangeOfPoint:
IsPlayerInRangeOfPoint is a function which you can use to get the distance between a player and a certain point.
The range which is a parameter in that function is circular from the point.

2. function - IsPlayerInArea:
IsPlayerInArea is a function which you can use to get wheather a player is in a certain "area". This area isn't circular but it's square.

So, I think for your intention it is a good way to use IsPlayerInArea.
PHP код:
IsPlayerInArea(playerid,Float:MinX,Float:MinY,Float:MaxX,Float:MaxY)
{
    new 
Float:X,Float:Y,Float:Z;
    
GetPlayerPos(playerid,X,Y,Z);
    return (
X>=MinX && X<= MaxX && Y=>MinY && Y<=MaxY) ? 0;

This is the function you need. You apply this function in the callback OnPlayerTakeDamage or OnPlayerGiveDamage. It's yours decision.

Try this and feel free to ask if you need help. Good luck!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)