Message when you get a place
#1

Can someone tell me how to make a script like this:
When I get a place is shown a message in chat to the player.
Example
When I arrive at the station a message is sent: You're at the station.
Reply
#2

this could be done with a Checkpoint do you want me to make you a simple one?
Reply
#3

Or, you could use IsPlayerInRangeOfPoint, in combination with a timer.

Quick example:
pawn Code:
forward InArea(playerid); // on top

SetTimer("AreaCheck", 1000, true); // at 'onplayerspawn'

//new callback
public InArea
{
if(IsPlayerInRangeOfPoint(playerid, 15, x , y , z) // add your own X Y Z, and you can change 15 into something else.
{
 SendClientMessage(playerid,0xFF0000AA,"You are now in range.");
}
return 1;
}
Reply
#4

Can't you use IsPlayerInArea?
If you got it of course
(I'm looking for it btw )
Reply
#5

Code:
stock IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) return 1;
return 0;
}
Add that someone in the script (not in callback),

Then,
pawn Code:
forward InArea(playerid); // on top

SetTimer("AreaCheck", 1000, true); // at 'onplayerspawn'

public InArea
{
if(IsPlayerInArea(playerid, max_X, min_X, max_Y, min_Y) // add your own min_X, max_x, min_Y, and max_Y
{
 SendClientMessage(playerid,0xFF0000AA,"You are now in range.");
}
return 1;
}
Reply
#6

Quote:
Originally Posted by VonLeeuwen
Or, you could use IsPlayerInRangeOfPoint, in combination with a timer.

Quick example:
pawn Code:
forward InArea(playerid); // on top

SetTimer("AreaCheck", 1000, true); // at 'onplayerspawn'

//new callback
public InArea
{
if(IsPlayerInRangeOfPoint(playerid, 15, x , y , z) // add your own X Y Z, and you can change 15 into something else.
{
 SendClientMessage(playerid,0xFF0000AA,"You are now in range.");
}
return 1;
}
One of the most stupidity codes I have ever seen.
Reply
#7

1. This code won't even compile without errors.
2. 'playerid' in this case will always be '0', unless you put a loop in there.
Reply
#8

Oh c'mon guys, just woke up :P knew something went wrong :$


Does this sound better?

pawn Code:
public InArea()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerInArea(i,MAX_X, MIN_X, MAX_Y, MIN_Y)) // edit yourself
      {
        SendClientMessage(i,0xFF0000AA,"You are now in the area.");
        }
    }
    return 1;
}
Reply
#9

The coordinates of IsPlayerInArea/IsPlayerInRangeOfPoint are the same that I would use the function SetPlayerWorldBounds?

OBS: For IsPlayerInRangeOfPoint i can use this script? (My server are 0.2x)

Code:
stock IsPlayerInRangeOfPoint(playerid, Float:radius, Float:X, Float:Y, Float:Z)
{
  new Float:oldpos[3], Float:temppos[3];
  GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
  temppos[0] = (oldpos[0] -X);
  temppos[1] = (oldpos[1] -Y);
  temppos[2] = (oldpos[2] -Z);
  if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
  {
    return true;
  }
  return false;
}
Reply
#10

Quote:
Originally Posted by [BEP
GeoPilot ]
The coordinates of IsPlayerInArea/IsPlayerInRangeOfPoint are the same that I would use the function SetPlayerWorldBounds?

OBS: For IsPlayerInRangeOfPoint i can use this script?

Code:
stock IsPlayerInRangeOfPoint(playerid, Float:radius, Float:X, Float:Y, Float:Z)
{
  new Float:oldpos[3], Float:temppos[3];
  GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
  temppos[0] = (oldpos[0] -X);
  temppos[1] = (oldpos[1] -Y);
  temppos[2] = (oldpos[2] -Z);
  if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
  {
    return true;
  }
  return false;
}
You don't have to use that Stock, as Pawno already has IsPlayerInRangeOfPoint ...
Reply
#11

But my server are 0.2X
(And not, I don't want a update to 0.3)

Update: And the codes I tested in this post don't worked
Reply
#12

Suggestions?
Reply
#13

I reviewed this topic one more time, and I think this should work for you:

http://pawn.pastebin.com/R474hLUS
Reply
#14

Thanks VonLeeuwen, worked!
Reply
#15

Good
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)