Message when you get a place - [BEP]AcerPilot - 23.02.2010
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.
Re: Message when you get a place -
Flake. - 23.02.2010
this could be done with a Checkpoint do you want me to make you a simple one?
Re: Message when you get a place -
VonLeeuwen - 23.02.2010
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;
}
Re: Message when you get a place -
bajskorv123 - 23.02.2010
Can't you use IsPlayerInArea?
If you got it of course
(I'm looking for it btw
)
Re: Message when you get a place -
VonLeeuwen - 23.02.2010
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;
}
Re: Message when you get a place -
MenaceX^ - 23.02.2010
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.
Re: Message when you get a place - WackoX - 23.02.2010
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.
Re: Message when you get a place -
VonLeeuwen - 23.02.2010
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;
}
Re: Message when you get a place - [BEP]AcerPilot - 23.02.2010
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;
}
Re: Message when you get a place -
VonLeeuwen - 23.02.2010
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 ...
Re: Message when you get a place - [BEP]AcerPilot - 23.02.2010
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
Re: Message when you get a place - [BEP]AcerPilot - 25.02.2010
Suggestions?
Re: Message when you get a place -
VonLeeuwen - 25.02.2010
I reviewed this topic one more time, and I think this should work for you:
http://pawn.pastebin.com/R474hLUS
Re: Message when you get a place - [BEP]AcerPilot - 26.02.2010
Thanks VonLeeuwen, worked!
Re: Message when you get a place -
VonLeeuwen - 26.02.2010
Good