Pickup ids mix
#1

I made an info pickup on my server, so when you pick it up, it shouldn't dissapear and just leave you a GameText.
Its good, but when you pick it up, it also says you found the "tiki" (special prize on my server, /placetiki) and it dissapears. But it respawns after. And does the same stuff. I don't understand whats wrong...

Код:
new WorkPickup;
new TikiStatuePickup;

public OnPlayerPickUpPickup(playerid, pickupid)
{
	new	string[256],
		winnerName[MAX_PLAYER_NAME];

	if(pickupid == TikiStatuePickup)
	{
		GetPlayerName(playerid, winnerName, sizeof(winnerName));

		format(string, sizeof(string), "** %s has found the {FED801}tiki statue{8CDBF4} and won 10.000$!", winnerName);

		SendClientMessage(playerid, COLOR_SUCCESS, "** You have just found the {FED801}tiki statue{74E882}! You won 10.000$!");
		SendClientMessageToAll(COLOR_AQUA, string);

		GivePlayerMoney(playerid, 10000);
		DestroyPickup(TikiStatuePickup);
		TikiPlacedCheck = 0;

		return 1;
	}else
	if(pickupid == WorkPickup)
	{
	    GameTextForPlayer(playerid, "~w~Type ~r~/gangwork ~w~to begin working for gangs", 2000, 3);
	}
	return 1;
}
Please help. Thank you
Reply
#2

It's because you're not assigning the pickup IDs to the variables, so they both == 0, so when you pick up the work pickup (Assumably the first one thats created) it'll do both.

You should do.

new WorkPickup = CreatePickup.....
new TikiStatuePickup = CreatePickup.....

That should stop the misassignment.
Reply
#3

Yes but TikiStatuePickup is created only by a command. And also it's destroyed by /removetiki ... So what do I do about this ? :/
Reply
#4

Quote:
Originally Posted by hydravink
Посмотреть сообщение
Yes but TikiStatuePickup is created only by a command. And also it's destroyed by /removetiki ... So what do I do about this ? :/
Inside the command, you can still do TikiPickup = CreatePickup...

And when you delete it, you can do TikiPickup = -1;
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)