Problem with pickups -
FunnyBear - 01.03.2015
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.
Re: Problem with pickups -
ATGOggy - 01.03.2015
Show OnPlayerPickupPickup
Re: Problem with pickups -
FunnyBear - 01.03.2015
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.
Re: Problem with pickups -
ATGOggy - 01.03.2015
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) ?
Re: Problem with pickups -
FunnyBear - 01.03.2015
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.
Re: Problem with pickups -
FunnyBear - 01.03.2015
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..
Re: Problem with pickups -
Vince - 01.03.2015
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.
Re: Problem with pickups -
ATGOggy - 01.03.2015
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.
|
Yeah, that's it.