25.07.2015, 20:15
I want to check if a player is in los santos , or las venturs , or san fierro ,or small city.
but how
but how
if(IsPlayerInRangeOfPoint(playerid, 200.0, X, Y, Z)) //get the cordinate of center of LV(or any city), and put here. 200.0 is the "example range", but increase this number depending of the city.
{
SendClientMessage(playerid,0xFFFFFFFF,"You are near of Las Venturas!"); //Functions, SendClientMessage is a example.
}
#include <a_samp>
#include <streamer>
#define MAX_ZONES 3
new zones[MAX_ZONES];
new Float:zones_points_0[] = {
31.0, -568.0, 2991.0, 1692.0
};
new Float:zones_points_1[] = {
-2997.0, 1540.0, -1225.0, 3760.0
};
new Float:zones_points_2[] = {
859.0, 3036.0, 2995.0, 5588.0
};
new zones_text[MAX_ZONES][64] = {
"Los Santos",
"San Fierro",
"las Venturas"
};
public OnFilterScriptInit()
{
zones[0] = CreateDynamicRectangle(zones_points_0[0], zones_points_0[1], zones_points_0[2], zones_points_0[3]);
zones[1] = CreateDynamicRectangle(zones_points_1[0], zones_points_1[1], zones_points_1[2], zones_points_1[3]);
zones[2] = CreateDynamicRectangle(zones_points_2[0], zones_points_2[1], zones_points_2[2], zones_points_2[3]);
return 1;
}
public OnFilterScriptExit() {
return 1;
}
public OnPlayerEnterDynamicArea(playerid, areaid) {
for (new zone=0; zone<MAX_ZONES; zone++) {
if (areaid==zones[zone]) {
new msg[90];
format(msg, 90, "Welcome to %s", zones_text[zone]);
SendClientMessage(playerid, 0xFFFFFFFF, msg);
}
}
return 1;
}
public OnPlayerLeaveDynamicArea(playerid, areaid) {
for (new zone=0; zone<MAX_ZONES; zone++) {
if (areaid==zones[zone]) {
new msg[90];
format(msg, 90, "Goodbye from %s", zones_text[zone]);
SendClientMessage(playerid, 0xFFFFFFFF, msg);
}
}
return 1;
}