Pickups outside normal map don't get created
#1

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!
Reply
#2

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.
Reply
#3

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.
Reply
#4

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
Reply
#5

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.
Reply
#6

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
Reply
#7

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

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;
}
Reply
#9

Yes,this should be fixed.
Reply
#10

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

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.
Reply
#12

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
Reply
#13

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

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.
Reply
#15

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?
Reply
#16

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.
Reply
#17

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.
Reply
#18

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)).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)