Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define TOTAL_AREAS 5
- forward OnPlayerInArea();
- new bool:parea[MAX_PLAYERS][TOTAL_AREAS];
- //Agora coloque as suas 300 �reas nessas arrays, a primeira array � o X-, Y-, X+ e Y+ de cada �rea;
- //e a segunda array � o nome de cada �rea correnpondente ao index da primeira array
- new Float:area_coords[TOTAL_AREAS][4] = //4 = n�mero de coordenadas (x-,y-,x+,y+)
- {
- {123.0, 123.0, 123.0, 123.0}, //0
- {234.0, 234.0, 234.0, 234.0}, //1
- {345.0, 345.0, 345.0, 345.0}, //2
- {456.0, 456.0, 456.0, 456.0}, //3
- {567.0, 567.0, 567.0, 567.0} //4
- };
- new area_names[TOTAL_AREAS][64] = //64 = tamanho das strings
- {
- "La Sierra Robada", //0
- "Las Payasadas", //1
- "Fort Carson", //2
- "Angel Pine", //3
- "Bayside" //4
- };
- public OnFilterScriptInit()
- {
- SetTimer("OnPlayerInArea", 300, 1);
- return 1;
- }
- public OnPlayerInArea()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- for(new j; j < TOTAL_AREAS; j++)
- {
- if(PlayerInArea(i, area_coords[j]))
- {
- if(!parea[i][j])
- {
- new string[128];
- format(string, sizeof string, "Voc� entrou em %s.", area_names[j]);
- SendClientMessage(i, 1010580650, string);
- parea[i][j] = true;
- }
- } else {
- parea[i][j] = false;
- }
- }
- }
- }
- stock PlayerInArea(playerid, Float:area[4])
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- return X >= area[0] && Y >= area[1] && X <= area[2] && Y <= area[3];
- }
Add Comment
Please, Sign In to add comment