SA-MP Forums Archive
Pickups outside normal map don't get created - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP DL Edition (https://sampforum.blast.hk/forumdisplay.php?fid=92)
+--- Forum: SA-MP 0.3.DL (https://sampforum.blast.hk/forumdisplay.php?fid=90)
+--- Thread: Pickups outside normal map don't get created (/showthread.php?tid=646954)



Pickups outside normal map don't get created - Graber - 27.12.2017

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][
View Post
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!


Re: Pickups outside normal map don't get created - Jochemd - 28.12.2017

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.


Re: Pickups outside normal map don't get created - Locky_ - 28.12.2017

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.


Re: Pickups outside normal map don't get created - d0 - 28.12.2017

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


Re: Pickups outside normal map don't get created - Graber - 28.12.2017

Quote:
Originally Posted by Jochemd
View Post
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
View Post
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.


Re: Pickups outside normal map don't get created - adri1 - 28.12.2017

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


Re: Pickups outside normal map don't get created - kurta999 - 28.12.2017

This should be fixed normally in client, not server sided. (already possiblr.with limit adjuster)


Re: Pickups outside normal map don't get created - adri1 - 28.12.2017

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



Re: Pickups outside normal map don't get created - Fairuz - 28.12.2017

Yes,this should be fixed.


Re: Pickups outside normal map don't get created - ModGuy - 28.12.2017

Also this rotation bug should be fixed "SetDynamicObjectPos(objectid, x, y, z - 0.001);", it's annoying


Re: Pickups outside normal map don't get created - RogueDrifter - 28.12.2017

Quote:
Originally Posted by adri1
View Post
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
Lol adri i actually thought of the same thing since i already use IsPlayerInRangeOfPoint for my custom interiors and creating an object as the pickup would work.


Re: Pickups outside normal map don't get created - ATomas - 28.12.2017

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


Re: Pickups outside normal map don't get created - ][Noname][ - 28.12.2017

http://forum.sa-mp.com/showpost.php?...&postcount=155


Re: Pickups outside normal map don't get created - ModGuy - 29.12.2017

Quote:
Originally Posted by ATomas
Посмотреть сообщение
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
4096 is the limit, not 4000.


Re: Pickups outside normal map don't get created - Morpheus1992 - 29.12.2017

Why do you guys talk about work arounds, they all need CPU Usage, doesnt matter how.
The Streamer Plugin doesnt work like it should, area, polygon or spheres are all slowly as hell.

This should be fixed in 0.3.8 as this bug is very old, why does 3DText are working and Pickups not?
Also we should be able to use custom Objects as Pickups too?


Re: Pickups outside normal map don't get created - kurta999 - 29.12.2017

3d texts are handled by samp client, it doesnt have any "contact" with gta. Pickups handled by gta originally, some parts as you saw above needs to be hacked to work properly outside of original map.


Re: Pickups outside normal map don't get created - Graber - 05.01.2018

I bring the issue up again since this is a very annoying bug that should be fixed, as resources relating to the pickup coords problem have already been brought up. It can be fixable server side yes, with the cost of CPU and the pickups looking weird. It’s very easy to fix at it looks, but without the dev's support, nothing is easy.


Re: Pickups outside normal map don't get created - NaS - 06.01.2018

Quote:
Originally Posted by ModGuy
Посмотреть сообщение
4096 is the limit, not 4000.
Those are 2 different limits. The limit you mean is the max. number of Pickups. He was talking about coordinates (which is (+/-)4000.0 on most axes, but less than 3000 on the X Axis (to the east)).