Restriction
#1

I have made a topic earlier but that has been deleted by some ******, i'm pretty sure that i haven't done a shit in that thread. Please give me a simple code that restrict someone from using a hydra in a particular place.

Actually someone has give me that but when i refreshed, it has gone.. :/
Reply
#2

Please refer to this source: https://sampwiki.blast.hk/wiki/Areacheck

You could use the streamer plugin to detect if a user is in a certain area.
pawn Code:
native CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1);
native CreateDynamicCuboid(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worldid = -1, interiorid = -1, playerid = -1);
forward OnPlayerEnterDynamicArea(playerid, areaid);
forward OnPlayerLeaveDynamicArea(playerid, areaid);
Streamer plugin: https://sampforum.blast.hk/showthread.php?tid=102865
Reply
#3

Quote:
Originally Posted by Death1300
View Post
Please refer to this source: https://sampwiki.blast.hk/wiki/Areacheck

You could use the streamer plugin to detect if a user is in a certain area.
pawn Code:
native CreateDynamicCircle(Float:x, Float:y, Float:size, worldid = -1, interiorid = -1, playerid = -1);
native CreateDynamicCylinder(Float:x, Float:y, Float:minz, Float:maxz, Float:size, worldid = -1, interiorid = -1, playerid = -1);
native CreateDynamicSphere(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1);
native CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1);
native CreateDynamicCuboid(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worldid = -1, interiorid = -1, playerid = -1);
native CreateDynamicPolygon(Float:points[], Float:minz = -FLOAT_INFINITY, Float:maxz = FLOAT_INFINITY, maxpoints = sizeof points, worldid = -1, interiorid = -1, playerid = -1);
native DestroyDynamicArea(areaid);
native IsValidDynamicArea(areaid);
native GetDynamicPolygonPoints(areaid, Float:points[], maxpoints = sizeof points);
native GetDynamicPolygonNumberPoints(areaid);
native TogglePlayerDynamicArea(playerid, areaid, toggle);
native TogglePlayerAllDynamicAreas(playerid, toggle);
native IsPlayerInDynamicArea(playerid, areaid, recheck = 0);
native IsPlayerInAnyDynamicArea(playerid, recheck = 0);
native IsAnyPlayerInDynamicArea(areaid, recheck = 0);
native IsAnyPlayerInAnyDynamicArea(recheck = 0);
native GetPlayerDynamicAreas(playerid, areas[], maxareas = sizeof areas);
native GetPlayerNumberDynamicAreas(playerid);
native IsPointInDynamicArea(areaid, Float:x, Float:y, Float:z);
native IsPointInAnyDynamicArea(Float:x, Float:y, Float:z);
native AttachDynamicAreaToObject(areaid, objectid, type = STREAMER_OBJECT_TYPE_DYNAMIC, playerid = INVALID_PLAYER_ID);
native AttachDynamicAreaToPlayer(areaid, playerid);
native AttachDynamicAreaToVehicle(areaid, vehicleid);
forward OnPlayerEnterDynamicArea(playerid, areaid);
forward OnPlayerLeaveDynamicArea(playerid, areaid);
Out of this which is the one i'm searching for, thats a hardcore thingy. Could you please point it out
Reply
#4

If you would like to do a area check with the streamer plugin/ include, Use the following callbacks/ functions
pawn Code:
native CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1);
native CreateDynamicCuboid(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worldid = -1, interiorid = -1, playerid = -1);
forward OnPlayerEnterDynamicArea(playerid, areaid);
forward OnPlayerLeaveDynamicArea(playerid, areaid);
I suggest reading Areacheck on SA-MP wiki if do not want to use the streamer.
- https://sampwiki.blast.hk/wiki/Areacheck
Reply
#5

Quote:
Originally Posted by Death1300
View Post
If you would like to do a area check with the streamer plugin/ include, Use the following callbacks/ functions
pawn Code:
native CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1);
native CreateDynamicCuboid(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worldid = -1, interiorid = -1, playerid = -1);
forward OnPlayerEnterDynamicArea(playerid, areaid);
forward OnPlayerLeaveDynamicArea(playerid, areaid);
I suggest reading Areacheck on SA-MP wiki if do not want to use the streamer.
- https://sampwiki.blast.hk/wiki/Areacheck
yeah, someone gave me a complete code of that on the last thread i made but some prick deleted it without any reason :/ god damnit
Reply
#6

pawn Code:
forward isPlayerInArea();
public isPlayerInArea()
   {
       new Float:X, Float:Y, Float:Z; //We use this to store player position
       for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i"
       {
           GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously
           if (X <= -3915 && X >= -3694 && Y <= 401 && Y >= 37)
           /* This line is the important one!. Here, is where you change those numbers, by the ones
           you get from the /pos command. As you can see, those coordinates, are only the X and Y ones, the Z
           doesnt matter*/

           {
               SetPlayerHealth(i, -999999.9); //This will ensure, that our player gets killed if he tries to enter
           }
       }
   }
Yes, The code was on the SA-MP wiki if you took a look at it. Furthermore information/ explanation upon the area check can be found by clicking the source below.
- https://sampwiki.blast.hk/wiki/Areacheck
Reply
#7

Tried this one but doesn't work

pawn Code:
//ongamemodeinit
RestrictFFS = CreateDynamicRectangle(2035.0002,1007.8917, 2078.3801,1007.7595,  -1, -1, -1);

public OnPlayerEnterDynamicArea(playerid, areaid)
{
    if(areaid == RestrictFFS)
        if(IsPlayerInAnyVehicle(playerid))
        {
            if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 425)
            {
                SetPlayerHealth(playerid,1.0);
                SendClientMessage(playerid, -1,"You're in protected area!");
            }
        }
    return 1;}
Reply
#8

Are you restricting the hydra from entering the area? If so, You have got the wrong vehicle ID.
Reply
#9

Quote:
Originally Posted by Death1300
View Post
Are you restricting the hydra from entering the area? If so, You have got the wrong vehicle ID.
No, i've actually tried it with the vehicle id that i've given there.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)