Stay within world boundaries
#1

Hey I wanna make a filter script that has bikes and dirtbikes and stuff at the skatepark but i want it so that you want take them out of the skatepark, how would I do that?
Reply
#2

Use the "SetPlayerWorldBounds" function
imagine a square around your park and get the position of the top left and bottom right corner and use those coords for the min and max coords...
read the wiki for the correct parameter useage:
https://sampwiki.blast.hk/wiki/SetPlayerWorldBounds
Reply
#3

Okay made a square around the skate park
pawn Код:
SetPlayerWorldBounds(playerid, 1923.388, 1923.388, -1342.356, -1342.356);
    SetPlayerWorldBounds(playerid, 1988.037, 1988.037, -1401.572, -1401.572);
    SetPlayerWorldBounds(playerid, 1927.191, 1927.191, -1460.788, -1460.788);
    SetPlayerWorldBounds(playerid, 1851.135, 1851.135, -1413.416, -1413.416);
but how do i make it so that it does that when you only get in a certen cars?
Reply
#4

Quote:
Originally Posted by Michael_Cuellar
Посмотреть сообщение
Okay made a square around the skate park
pawn Код:
SetPlayerWorldBounds(playerid, 1923.388, 1923.388, -1342.356, -1342.356);
    SetPlayerWorldBounds(playerid, 1988.037, 1988.037, -1401.572, -1401.572);
    SetPlayerWorldBounds(playerid, 1927.191, 1927.191, -1460.788, -1460.788);
    SetPlayerWorldBounds(playerid, 1851.135, 1851.135, -1413.416, -1413.416);
but how do i make it so that it does that when you only get in a certen cars?
Simple, make a function/stock idk to check what vehicle ID the user is in.. Once you do that you just ad

if(vehicleid == QUADID || vehicleid == BIKEID || vehicleid == ANYOTHERCARYOU WANT)
{
SetPlayerWorld..
}
Reply
#5

I went into debug and set it up how i like it, is there away to only make that work with these
pawn Код:
AddStaticVehicle(468,1927.7985,-1415.3989,13.2394,3.8370,3,3); // dirtbike 1
AddStaticVehicle(468,1926.4099,-1415.5229,13.2400,13.3121,3,3); // dirtbike 2
AddStaticVehicle(468,1924.8374,-1415.5814,13.2392,12.9154,46,46); // dirtbike 3
AddStaticVehicle(468,1923.9250,-1415.7706,13.2394,4.4355,3,3); // dirtbike 4
AddStaticVehicle(468,1922.9930,-1415.6388,13.2390,25.1528,46,46); // dirtbike 5
AddStaticVehicle(468,1922.1638,-1415.9061,13.2396,16.9196,3,3); // dirtbike 6
AddStaticVehicle(471,1917.8064,-1416.2734,13.0519,3.1439,120,114); // quad 1
AddStaticVehicle(471,1919.0906,-1416.1726,13.0518,4.1536,120,112); // quad 2
AddStaticVehicle(471,1915.8846,-1416.2947,13.0468,14.5635,120,113); // quad 3
AddStaticVehicle(471,1914.2170,-1416.3369,13.0517,355.0599,120,117); // quad 4
AddStaticVehicle(471,1912.1467,-1416.1077,13.0517,7.5703,120,114); // quad 5
AddStaticVehicle(471,1910.3541,-1416.3918,13.0519,8.7375,120,112); // quad 6
AddStaticVehicle(481,1945.0970,-1362.9436,18.0965,95.6540,6,6); // bike 1
AddStaticVehicle(481,1945.0455,-1364.9452,18.0938,83.1716,65,9); // bike 2
AddStaticVehicle(481,1944.9021,-1366.5309,18.0949,85.4169,12,9); // bike 3
AddStaticVehicle(481,1944.5746,-1368.2930,18.0936,89.4225,1,1); // bike 4
AddStaticVehicle(481,1944.8589,-1374.4915,18.0933,87.7535,6,6); // bike 5
AddStaticVehicle(481,1944.1874,-1377.1334,18.0920,83.5089,65,9); // bike 6
AddStaticVehicle(481,1944.5990,-1375.7726,18.0957,87.2999,12,9); // bike 7
AddStaticVehicle(481,1944.7347,-1378.4813,18.0927,86.9628,1,1); // bike 8
Reply
#6

You need to find the variable that is used to check a cars ID in your script, and tell us what it is - then I can help you. Unless you want to do it this way (Not sure if it'd work)

pawn Код:
skatepark1 = AddStaticVehicle(468,1927.7985,-1415.3989,13.2394,3.8370,3,3); // dirtbike 1
skatepark2 =AddStaticVehicle(468,1926.4099,-1415.5229,13.2400,13.3121,3,3); // dirtbike 2
skatepark3 =AddStaticVehicle(468,1924.8374,-1415.5814,13.2392,12.9154,46,46); // dirtbike 3
skatepark4 =AddStaticVehicle(468,1923.9250,-1415.7706,13.2394,4.4355,3,3); // dirtbike 4
skatepark5 =AddStaticVehicle(468,1922.9930,-1415.6388,13.2390,25.1528,46,46); // dirtbike 5
skatepark6 =AddStaticVehicle(468,1922.1638,-1415.9061,13.2396,16.9196,3,3); // dirtbike 6
skatepark7 =AddStaticVehicle(471,1917.8064,-1416.2734,13.0519,3.1439,120,114); // quad 1
skatepark8 =AddStaticVehicle(471,1919.0906,-1416.1726,13.0518,4.1536,120,112); // quad 2
skatepark9 =AddStaticVehicle(471,1915.8846,-1416.2947,13.0468,14.5635,120,113); // quad 3
skatepark10 =AddStaticVehicle(471,1914.2170,-1416.3369,13.0517,355.0599,120,117); // quad 4
skatepark11 =AddStaticVehicle(471,1912.1467,-1416.1077,13.0517,7.5703,120,114); // quad 5
skatepark12 =AddStaticVehicle(471,1910.3541,-1416.3918,13.0519,8.7375,120,112); // quad 6
skatepark13 =AddStaticVehicle(481,1945.0970,-1362.9436,18.0965,95.6540,6,6); // bike 1
skatepark14 =AddStaticVehicle(481,1945.0455,-1364.9452,18.0938,83.1716,65,9); // bike 2
skatepark15 =AddStaticVehicle(481,1944.9021,-1366.5309,18.0949,85.4169,12,9); // bike 3
skatepark16 =AddStaticVehicle(481,1944.5746,-1368.2930,18.0936,89.4225,1,1); // bike 4
skatepark17 =AddStaticVehicle(481,1944.8589,-1374.4915,18.0933,87.7535,6,6); // bike 5
skatepark18 =AddStaticVehicle(481,1944.1874,-1377.1334,18.0920,83.5089,65,9); // bike 6
skatepark19 =AddStaticVehicle(481,1944.5990,-1375.7726,18.0957,87.2999,12,9); // bike 7
skatepark20 =AddStaticVehicle(481,1944.7347,-1378.4813,18.0927,86.9628,1,1); // bike 8
Then somewhere else (idk where exactly, not concentrating)

pawn Код:
if(VEHICLEID == skatepark1 || VEHICLEID == skatepark2 || VEHICLEID == skatepark3 || VEHICLEID == skatepark4 || VEHICLEID == skatepark5 || VEHICLEID == skatepark6 || VEHICLEID == skatepark7 || VEHICLEID == skatepark8 || VEHICLEID == skatepark9 || VEHICLEID == skatepark10 || VEHICLEID == skatepark11 || VEHICLEID == skatepark12 || VEHICLEID == skatepark13 || VEHICLEID == skatepark14 || VEHICLEID == skatepark15 || VEHICLEID == skatepark16 || VEHICLEID == skatepark17 || VEHICLEID == skatepark18 || VEHICLEID == skatepark19 || VEHICLEID == skatepark20);
{
stay within world boundries shit
}
Something like that anyways
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)