12.03.2009, 14:08
pawn Код:
forward InfoText(); //forward the function
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z); //This will be used to check player's position
public OnGameModeInit()
{
SetTimer("InfoText", 1000, 1); //sets it to a timer which will be called every seconds
return 1;
}
public InfoText() //This will check player position and send a message if he's in the zone you defined.
{
for (new i =0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerToPoint(5.0, i, x, y, z)) //5.0 is the radi, i is playerid and x,y,z are coordinates of the circle center
{
SendClientMessage(i, color," === MAP NAME ==="); replace color with your color code
//Add the rest of your text
}
}
}
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z) //By ****** if I'm not wrong
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
