SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   SA-MP 0.3.DL (https://forum.sa-mp.com/forumdisplay.php?f=90)
-   -   Pickups outside normal map don't get created (https://forum.sa-mp.com/showthread.php?t=646954)

Graber 27/12/2017 03:00 PM

Pickups outside normal map don't get created
 
Bug relating to 0.3.8 new objects was fixed in latest RCs. But still, pickups that are outside of the normal 4096 range won’t get created. Given the 0.3.8 update that will allow custom objects (and therefor, maps), it would only make sense to get the pickups fixed so scripters can take advantage of it.

An unofficial fix is already available, this proves the issue can be fixed.
Quote:

Originally Posted by ][Noname][ (Post 3958058)
pickup coord stored in short int 16 bit value

Code:

float x;
short int savex=short int(x*8)

limit - (2^16)/8/2=65536/8/2=8192/2=4096

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!

Please!

Jochemd 28/12/2017 11:48 AM

Re: Pickups outside normal map don't get created
 
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.

Locky_ 28/12/2017 12:17 PM

Re: Pickups outside normal map don't get created
 
In the case what he requests that this be corrected. For example, the player's animation has been corrected when exiting a vehicle on created maps. I think correcting the visibility of the pickup would also be a good fix.

d0 28/12/2017 01:28 PM

Re: Pickups outside normal map don't get created
 
Quote:

- Vehicle exiting should work properly on server created objects.
as far as i know, this fix also fixes pickups on server created objects.
Just try it ;)

Graber 28/12/2017 01:48 PM

Re: Pickups outside normal map don't get created
 
Quote:

Originally Posted by Jochemd (Post 3972346)
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.

Nope. I use a script which has pickup based enter/exits (so it doesn’t loop through all enter/exits) using the last pickupid. It doesn’t trigger OnPlayerPickUpPickup where it should

Quote:

Originally Posted by d0 (Post 3972386)
as far as i know, this fix also fixes pickups on server created objects.
Just try it ;)

Unfortunately, it doesn’t. I just tried it out before making this post.

adri1 28/12/2017 02:10 PM

Re: Pickups outside normal map don't get created
 
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);
Edit:
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;
}

the object has to be rotated to seem like a original pickup

kurta999 28/12/2017 02:27 PM

Re: Pickups outside normal map don't get created
 
This should be fixed normally in client, not server sided. (already possiblr.with limit adjuster)

adri1 28/12/2017 05:30 PM

Re: Pickups outside normal map don't get created
 
I made an experimental include, its working, but object pickup rotation is not too smooth :(
Code:


/*
        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;
}


Dice_ 28/12/2017 06:57 PM

Re: Pickups outside normal map don't get created
 
Yes,this should be fixed.

ModGuy 28/12/2017 07:32 PM

Re: Pickups outside normal map don't get created
 
Also this rotation bug should be fixed "SetDynamicObjectPos(objectid, x, y, z - 0.001);", it's annoying


All times are GMT. The time now is 06:36 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.