Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Filterscripta sukure Johurt(Edgaras), padejo Robertas ir Elonas specialiai Gta-Online.lt
- Viskas daryta pagal wiki.sa-mp.com:
- http://wiki.sa-mp.com/wiki/SetTimer
- http://wiki.sa-mp.com/wiki/GangZoneCreate
- http://pastebin.com/HpQHTrZS - F-ja sugeneruoti minX, minY, maxX, maxY kord.
- */
- #define FILTERSCRIPT
- #include <a_samp>
- #define MAX_ZONES 5 // Maksimalos saugiu zonu kiekis.
- #define MAX_WARNS 5 // Maksimalus ispejimu kiekis.
- #define WARN_COLOR 0xf6102bFF // Ispejimo spalva.
- #define ZONE_COLOR 0xFFFF0096 // Saugiu zonu spalva.
- forward ShowText();
- enum kords
- {
- Float:minX,
- Float:minY,
- Float:maxX,
- Float:maxY
- };
- new Float:ZoneCords[MAX_ZONES][kords] =
- {
- // minX, minY, maxX, maxY
- {-2696.9824, -60.6852, -2613.1055, 29.8879}, // San Fierro
- {-2001.5415, 77.9670, -1950.7507, 218.3597}, // San Fierro
- {2077.4653, 1197.4258, 2182.3826, 1369.1112}, // Las Venturas
- {1810.8127, 1456.8585, 2037.8066, 1709.1813}, // Las Venturas
- {2192.7255, 2032.4004, 2312.0420, 2067.6936} // Las Venturas
- };
- new Zone[MAX_ZONES], Warns[MAX_PLAYERS], bool:IsPlayerInZone[MAX_PLAYERS];
- new Text:Text, Timer;
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------------");
- print("[FS]jSZS - Save Zones System by Johurt loaded.");
- print("--------------------------------------------\n");
- Text = TextDrawCreate(456.0, 381.0, "Saugi_Zona");
- TextDrawFont(Text, 3);
- TextDrawLetterSize(Text, 0.569999, 2.399999);
- TextDrawSetOutline(Text, 0);
- TextDrawBackgroundColor(Text, 1717986918);
- TextDrawColor(Text, -65386);
- TextDrawSetOutline(Text, 0);
- TextDrawSetProportional(Text, 1);
- TextDrawSetShadow(Text, 1);
- for(new z = 0; z < MAX_ZONES; z++)
- {
- Zone[z] = GangZoneCreate(ZoneCords[z][minX], ZoneCords[z][minY], ZoneCords[z][maxX], ZoneCords[z][maxY]);
- GangZoneShowForAll(Zone[z], ZONE_COLOR);
- }
- for(new p = 0; p < MAX_PLAYERS; p++) IsPlayerInZone[p] = false;
- Timer = SetTimer("ShowText", 1000, true);
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n----------------------------------------------");
- print("[FS]jSZS - Save Zones System by Johurt unloaded.");
- print("----------------------------------------------\n");
- for(new z = 0; z < MAX_ZONES; z++) GangZoneDestroy(Zone[z]);
- for(new p = 0; p < MAX_PLAYERS; p++) IsPlayerInZone[p] = false;
- KillTimer(Timer); TextDrawDestroy(Text);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- Warns[playerid] = 0; IsPlayerInZone[playerid] = false;
- for(new z = 0; z < MAX_ZONES; z++) GangZoneShowForPlayer(playerid, Zone[z], ZONE_COLOR);
- TextDrawHideForPlayer(playerid, Text);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- for(new z = 0; z < MAX_ZONES; z++) GangZoneHideForPlayer(playerid, Zone[z]);
- TextDrawHideForPlayer(playerid, Text);
- return 1;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
- {
- if(issuerid != INVALID_PLAYER_ID)
- {
- if(IsPlayerInZone[playerid] == true)
- {
- new Float:phealt; GetPlayerHealth(playerid, phealt);
- new Float:ihhealt; GetPlayerHealth(issuerid, ihhealt);
- SetPlayerHealth(playerid, phealt + amount); SetPlayerHealth(issuerid, ihhealt - amount);
- Warns[issuerid] += 1;
- new msg[110];
- format(msg, sizeof(msg), "Ispejame. Jeigu ir toliau saudysite i civilius saugiuose zonuose busite nubaustas. Gavote %d ispejima(Max %d).", Warns[issuerid], MAX_WARNS);
- SendClientMessage(issuerid, WARN_COLOR, msg);
- if(Warns[issuerid] >= MAX_WARNS)
- {
- SendClientMessage(issuerid, WARN_COLOR, "Jus ismestas is serverio uz saudyma i civilius saugiose zonuose.");
- Kick(issuerid);
- }
- }
- }
- return 1;
- }
- public ShowText()
- {
- for(new p = 0; p < MAX_PLAYERS; p++)
- {
- if(!IsPlayerConnected(p)) continue;
- for(new z = 0; z < MAX_ZONES; z++)
- {
- if(!PlayerInZone(p, ZoneCords[z][minX], ZoneCords[z][minY], ZoneCords[z][maxX], ZoneCords[z][maxY]))
- {
- if(IsPlayerInZone[p] == true)
- {
- IsPlayerInZone[p] = false;
- TextDrawHideForPlayer(p, Text);
- }
- continue;
- }
- else if(IsPlayerInZone[p] == false)
- {
- IsPlayerInZone[p] = true;
- TextDrawShowForPlayer(p, Text);
- }
- return 1;
- }
- }
- return 1;
- }
- stock PlayerInZone(playerid, Float:min_X, Float:min_Y, Float:max_X, Float:max_Y)
- {
- new Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- if((pos[0] <= max_X && pos[0] >= min_X) && (pos[1] <= max_Y && pos[1] >= min_Y)) return 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement