Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "a_samp"
- #include "zcmd"
- #define CMD_L69 //For command : "telel69" undefine this to disable that command.
- new L69;
- new lpwep[MAX_PLAYERS][13][2];
- new ldb[MAX_PLAYERS];
- #define red 0xFF0000FF
- #define Lymin 566.1470
- #define Lymax 708.0251
- #define Lxmin -2748.1877
- #define Lxmax -2524.6787
- stock GetPlayerArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY) //Creating a stock to get player's area. Thanks to SA-MP forums for the AreaCheck.
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- if(X >= MinX && X <= MaxX && Y >= MinY && Y <= MaxY)
- {
- return 1;
- }
- return 0;
- }
- public OnFilterScriptInit()
- {
- printf("");
- printf("__________________________________________________________");
- printf("");
- printf("YoUnG Generations Driveby protection Loading...");
- // L69 = GangZoneCreate(-2748.1877,566.1470,-2524.6787,708.0251);
- L69 = GangZoneCreate(Lxmin, Lymin, Lxmax, Lymax);
- for(new i; i< GetMaxPlayers(); i++)
- {
- if(IsPlayerConnected(i))
- {
- GangZoneShowForPlayer(i, L69, 0xFF9900AA);
- }
- }
- printf("YoUnG Generations Driveby protection loaded successfully!");
- printf("__________________________________________________________");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- GangZoneShowForPlayer(playerid, L69, 0xFF9900AA);
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- GangZoneHideForPlayer(playerid, L69);
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- if(vehicleid != INVALID_VEHICLE_ID) {
- if(GetPlayerArea(playerid, Lxmin, Lymin, Lxmax, Lymax)) {
- if(GetPlayerWeapon(playerid) >= 22 && GetPlayerWeapon(playerid) <= 38) {
- if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
- {
- for(new i = 0; i< 13; i++)
- {
- GetPlayerWeaponData(playerid, i, lpwep[playerid][i][0], lpwep[playerid][i][1]);
- ldb[playerid] = 1;
- }
- ResetPlayerWeapons(playerid);
- SendClientMessage(playerid, red, "Your weapons have been resetted as your in a vehicle on driveby restricted areas!");
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- if(ldb[playerid] == 1)
- {
- for(new i = 0; i< 13; i++)
- {
- GivePlayerWeapon(playerid, lpwep[playerid][i][0], lpwep[playerid][i][1]);
- ldb[playerid] = 0;
- }
- }
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(GetPlayerArea(playerid, Lxmin, Lymin, Lxmax, Lymax))
- {
- if(GetPlayerWeapon(playerid) >= 22 && GetPlayerWeapon(playerid) <= 38)
- {
- for(new i = 0; i< 13; i++)
- {
- GetPlayerWeaponData(playerid, i, lpwep[playerid][i][0], lpwep[playerid][i][1]);
- }
- ResetPlayerWeapons(playerid);
- ldb[playerid] = 1;
- }
- }
- }
- return 1;
- }
- #if defined L69_CMD
- CMD:telel69(playerid, params[])
- {
- SetPlayerPos(playerid, -2526.9819,625.6696,28.0642);
- return 1;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement