pickup coord stored in short int 16 bit value
Code:
float x; short int savex=short int(x*8) set limit to 32768 without changing structure format will change coord accuracy step to 1.0 test with limit 4096*2=8192 but accuracy - 0.25 PickupCoordTest.asi source I don't know is there any incompatible with other mods or what Kalcor will change use only for testing! |
- Vehicle exiting should work properly on server created objects. |
They do get created, they're just not visible. Try to walk through the position you created them and you'll notice they work as expected.
|
as far as i know, this fix also fixes pickups on server created objects.
Just try it |
CreateDynamicCylinder(Float:x, Float:y, Float:minz, Float:maxz, Float:size, worldid = -1, interiorid = -1, playerid = -1, priority = 0);
#define AREA_TYPE_FIXED_PICKUP 1000 forward OnPlayerEnterFixedPickup(playerid, pickupid); forward OnPlayerLeaveFixedPickup(playerid, pickupid); Fixed_CreatePickup(model, Float:x, Float:y, Float:z, worldid = -1, interiorid = -1, playerid = -1) { CreateDynamicObject(model, x, y, z, 0.0, 0.0, 0.0, worldid, interiorid, playerid); new areaid = CreateDynamicCylinder(x, y, z - 1.0, z + 3.0, 1.0, worldid, interiorid, playerid); Streamer_SetIntData(STREAMER_TYPE_AREA, areaid, E_STREAMER_EXTRA_ID, AREA_TYPE_FIXED_PICKUP); return areaid; } public OnPlayerEnterDynamicArea(playerid, areaid) { if(Streamer_GetIntData(STREAMER_TYPE_AREA, areaid, E_STREAMER_EXTRA_ID) == AREA_TYPE_FIXED_PICKUP) { OnPlayerEnterFixedPickup(playerid, areaid); } return 1; } public OnPlayerLeaveDynamicArea(playerid, areaid) { if(Streamer_GetIntData(STREAMER_TYPE_AREA, areaid, E_STREAMER_EXTRA_ID) == AREA_TYPE_FIXED_PICKUP) { OnPlayerLeaveFixedPickup(playerid, areaid); } return 1; } //inc public OnPlayerEnterFixedPickup(playerid, pickupid) { new str[45]; format(str, sizeof str, "OnPlayerEnterFixedPickup, ID: %d", pickupid); SendClientMessage(playerid, -1, str); return 1; } public OnPlayerLeaveFixedPickup(playerid, pickupid) { new str[45]; format(str, sizeof str, "OnPlayerLeaveFixedPickup, ID: %d", pickupid); SendClientMessage(playerid, -1, str); return 1; }
/* By adri1 */ //cpickup #if defined _inc_cpickup #endinput #endif #define _inc_cpickup //streamer #if !defined _streamer_included #error "no streamer include" #endif //yhooks #include <YSI-Includes\YSI\y_hooks> // #define CUSTOM_PICKUP_UNIQUE_ID 1000 #define INVALID_CUSTOM_PICKUP_ID INVALID_STREAMER_ID forward OnPlayerEnterCustomPickup(playerid, pickupid); forward OnPlayerLeaveCustomPickup(playerid, pickupid); stock CreateDynamicCustomPickup(model, Float:x, Float:y, Float:z, Float:rx = 0.0, Float:ry = 0.0, worldid = -1, interiorid = -1, playerid = -1) { //create new objectid = CreateDynamicObject(model, x, y, z + 1.0, rx, ry, 0.0, worldid, interiorid, playerid), areaid = CreateDynamicCylinder(x, y, z - 1.0, z + 3.0, 0.5, worldid, interiorid, playerid); //move object SetDynamicObjectPos(objectid, x, y, z - 0.001); MoveDynamicObject(objectid, x, y, z, 0.005, rx, ry, 179.0); //object Streamer_SetIntData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID, CUSTOM_PICKUP_UNIQUE_ID); //area new streamer_info[2]; streamer_info[0] = CUSTOM_PICKUP_UNIQUE_ID; streamer_info[1] = objectid; Streamer_SetArrayData(STREAMER_TYPE_AREA, areaid, E_STREAMER_EXTRA_ID, streamer_info); return areaid; } stock DestroyDynamicCustomPickup(pickupid) { if(pickupid == INVALID_CUSTOM_PICKUP_ID) return 0; new streamer_info[2]; Streamer_GetArrayData(STREAMER_TYPE_AREA, pickupid, E_STREAMER_EXTRA_ID, streamer_info); if(streamer_info[0] != CUSTOM_PICKUP_UNIQUE_ID) return 0; DestroyDynamicObject(streamer_info[1]); DestroyDynamicArea(pickupid); return 1; } hook OnPlayerEnterDynArea(playerid, areaid) { new streamer_info[2]; Streamer_GetArrayData(STREAMER_TYPE_AREA, areaid, E_STREAMER_EXTRA_ID, streamer_info); if(streamer_info[0] == CUSTOM_PICKUP_UNIQUE_ID) CallLocalFunction("OnPlayerEnterCustomPickup", "dd", playerid, areaid); return 1; } hook OnPlayerLeaveDynArea(playerid, areaid) { new streamer_info[2]; Streamer_GetArrayData(STREAMER_TYPE_AREA, areaid, E_STREAMER_EXTRA_ID, streamer_info); if(streamer_info[0] == CUSTOM_PICKUP_UNIQUE_ID) CallLocalFunction("OnPlayerLeaveCustomPickup", "dd", playerid, areaid); return 1; } hook OnDynamicObjectMoved(objectid) { if(Streamer_GetIntData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID) == CUSTOM_PICKUP_UNIQUE_ID) { new Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz; GetDynamicObjectPos(objectid, x, y, z); GetDynamicObjectRot(objectid, rx, ry, rz); if(rz == 179.0) rz = 359.0; else rz = 179.0; SetDynamicObjectPos(objectid, x, y, z - 0.001); MoveDynamicObject(objectid, x, y, z, 0.001, rx, ry, rz); } return 1; }
the only thing that occurs to me is an area and rotating object
Code:
CreateDynamicCylinder(Float:x, Float:y, Float:minz, Float:maxz, Float:size, worldid = -1, interiorid = -1, playerid = -1, priority = 0); you can do some like this: (no tested) Code:
#define AREA_TYPE_FIXED_PICKUP 1000 forward OnPlayerEnterFixedPickup(playerid, pickupid); forward OnPlayerLeaveFixedPickup(playerid, pickupid); Fixed_CreatePickup(model, Float:x, Float:y, Float:z, worldid = -1, interiorid = -1, playerid = -1) { CreateDynamicObject(model, x, y, z, 0.0, 0.0, 0.0, worldid, interiorid, playerid); new areaid = CreateDynamicCylinder(x, y, z - 1.0, z + 3.0, 1.0, worldid, interiorid, playerid); Streamer_SetIntData(STREAMER_TYPE_AREA, areaid, E_STREAMER_EXTRA_ID, AREA_TYPE_FIXED_PICKUP); return areaid; } public OnPlayerEnterDynamicArea(playerid, areaid) { if(Streamer_GetIntData(STREAMER_TYPE_AREA, areaid, E_STREAMER_EXTRA_ID) == AREA_TYPE_FIXED_PICKUP) { OnPlayerEnterFixedPickup(playerid, areaid); } return 1; } public OnPlayerLeaveDynamicArea(playerid, areaid) { if(Streamer_GetIntData(STREAMER_TYPE_AREA, areaid, E_STREAMER_EXTRA_ID) == AREA_TYPE_FIXED_PICKUP) { OnPlayerLeaveFixedPickup(playerid, areaid); } return 1; } //inc public OnPlayerEnterFixedPickup(playerid, pickupid) { new str[45]; format(str, sizeof str, "OnPlayerEnterFixedPickup, ID: %d", pickupid); SendClientMessage(playerid, -1, str); return 1; } public OnPlayerLeaveFixedPickup(playerid, pickupid) { new str[45]; format(str, sizeof str, "OnPlayerLeaveFixedPickup, ID: %d", pickupid); SendClientMessage(playerid, -1, str); return 1; } |
You must create pickup inside coords:
-4000 < X < 4000 && -4000 < Z < 4000 (maybye for Z axis too) CreatePickup(1234,1,3999,3999,0,-1);//visible CreatePickup(1234,1,4001,3999,0,-1);//not visible |