Problem with pickups
#1

Hey, I've been trying create stores for my servers, and I made a stock function to easily add stores to the server.

Here is the function:

Код:
stock AddStore(id, msg[], color, Float:x, Float:y, Float:z)
{
	Create3DTextLabel(msg, color, Float:x, Float:y, Float:z, 35.0, 0, 1);
	id = CreatePickup(1318, 1, Float:x, Float:y, Float:z, -1);
	#pragma unused id
	CreatedStores++;
	return 1;
}
It works, the pickup and the 3d text label shows up. However, when I try to enter the pickup, it will not work.

Код:
AddStore(EnterMexican, "Mexican Restraunt\n{FFFFFF}Entrance", 0xFF9900FF, 1948.9808,-1985.0093,13.5469); // Rodeo
I used EnterMexican as the pickupid, and I used it under OnPlayerPickupPickUp, but it still doesn't work.
Reply
#2

Show OnPlayerPickupPickup
Reply
#3

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
Show OnPlayerPickupPickup
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if( pickupid == EnterMexican )
	{
	    SpawnInfo(playerid, 458.5189,-88.5992,999.5547, 90.9292, 4);
	}
	if( pickupid == ExitMexican )
	{
	    SpawnInfo(playerid, 1951.7532,-1985.1202,13.5469, 268.5560, 0);
	}
	return 1;
}
SpawnInfo, is a function I created. That is not what is causing the problem, it still did not work before I even used SpawnInfo.
Reply
#4

I know, SpawnInfo is same as SetPlayerPos but interior can also be set with it.

Are you sure that you created a variable "new EnterMexican" at the top of your script (not inside any callback) ?
Reply
#5

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
I know, SpawnInfo is same as SetPlayerPos but interior can also be set with it.

Are you sure that you created a variable "new EnterMexican" at the top of your script (not inside any callback) ?
Yep, I'm sure.
Reply
#6

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
Код:
//replace both
stock AddStore(id, msg[], color, Float:x, Float:y, Float:z)
{
	Create3DTextLabel(msg, color, x, y, z, 35.0, 0, 1);
	id = CreatePickup(1318, 1, x, y, z, -1);
	#pragma unused id
	CreatedStores++;
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    print("0");
	if( pickupid == EnterMexican )
	{
	    SpawnInfo(playerid, 458.5189,-88.5992,999.5547, 90.9292, 4);
	    print("1");
	}
	if( pickupid == ExitMexican )
	{
	    SpawnInfo(playerid, 1951.7532,-1985.1202,13.5469, 268.5560, 0);
	    print("2");
	}
	return 1;
}
If you get 0, 1 printed then you need to show me your SpawnInfo function.
0 was printed, however I don't think there's anything wrong with my spawn info. If I create the 3D Text labels and pickups manually, without using AddStores, then I would be teleported, but when I use AddStores, it doesn't work.

So I think there is something wrong with the AddStore function, but to me it seems fine..
Reply
#7

This does not work simply because "id" isn't passed by reference. Hence also why you put the pragma to suppress the "symbol is assigned a value that is never used" message.

Код:
AddStore(&id, ...
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
This does not work simply because "id" isn't passed by reference. Hence also why you put the pragma to suppress the "symbol is assigned a value that is never used" message.

Код:
AddStore(&id, ...
Yeah, that's it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)