Posts: 1,648
Threads: 482
Joined: Jun 2010
The pickup you can see below is a Faction Pickup: It shouldn't display the code here but only on the houses...
It seems to be executing this code:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new string[256];
for(new i = 0; i < MAX_HOUSES; i++)
{
if(pickupid == HousePickup[i])
{
if(!(strcmp(HouseOwner[i], "nobody", true)))
{
format(string, sizeof(string), "~r~For Sale : %s~n~~w~Price: $%d~n~~b~Type '/buyhouse' to purchase.", HouseName[i], HousePrice[i]);
}
else
{
format(string, sizeof(string), "Address: %s ~n~ Owner: %s", HouseName[i], HouseOwner[i]);
}
GameTextForPlayer(playerid, string, 3000, 5);
break;
}
}
return 1;
}
Can someone help and explain why this is happening?
Posts: 2,082
Threads: 118
Joined: Jan 2010
Reputation:
0
'pickupid' seems to be 'HousePickup[i]' - are you sure they are not colliding and that the HousePickup array is holding the correct data?
Posts: 1,648
Threads: 482
Joined: Jun 2010
They don't collide and yes, because it loads all of the house pickups and game text: Here is the code for both of them under LoadFactions and LoadHouses.
pawn Код:
FactionPickup[y] = CreatePickup(1318, 23, FactionEntX[y], FactionEntY[y], FactionEntZ[y], 0);
pawn Код:
HousePickup[x] = CreatePickup(1273, 23, HouseEntX[x], HouseEntY[x], HouseEntZ[x], 0);
Posts: 1,648
Threads: 482
Joined: Jun 2010
Posts: 2,082
Threads: 118
Joined: Jan 2010
Reputation:
0
A temporary work around:
- Loop through all houses, and check if the player is in range of the specific point the pickup ID is referring too.
I seem to remember reading somewhere that sometimes CreatePickup ID's sometimes mis-match and/or return the wrong ID. In all of my scripts I use OnPlayerPickUpPickup to trigger a Loop + IsPlayerInRangeOfPoint search for the right data.
Off Topic: I'm sure I replied to your post (before the bump).
Posts: 1,648
Threads: 482
Joined: Jun 2010
Thanks very much, I'll give it a try.
Posts: 1,648
Threads: 482
Joined: Jun 2010
Alright, I put this: Is this what you meant?
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new string[256];
for(new i = 0; i < MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, HousePickup[i], HousePickup[i], HousePickup[i]))
{
if(pickupid == HousePickup[i])
{
if(!(strcmp(HouseOwner[i], "nobody", true)))
{
format(string, sizeof(string), "~r~For Sale : %s~n~~w~Price: $%d~n~~b~Type '/buyhouse' to purchase.", HouseName[i], HousePrice[i]);
}
else
{
format(string, sizeof(string), "Address: %s ~n~ Owner: %s", HouseName[i], HouseOwner[i]);
}
GameTextForPlayer(playerid, string, 3000, 5);
break;
}
Posts: 1,648
Threads: 482
Joined: Jun 2010
It Doesnt work :/ I'll try something else but I can't guarantee :/
I'll keep you updated!
If I manage to fix it i'll + rep you
EDIT: It's working!! + rep, thank you!