Tiki System Help
#2

Here is an example, but it would be better if you use y_iterate
Код:
new tiki[50]; // You should've make this variable as an array for easier use
new bool:Picked[MAX_PLAYERS][50];

tiki[0] = CreatePickup(1234, X, Y, Z, -1);
// ... until tiki[49] = CreatePickup(...

public OnPlayerPickUpPickup(playerid, pickupid)
{
	for(new i = 0; i < 50; i++) // Loop 50 times to check if pickupid is tiki pickup
	{
		if(pickupid != tiki[i])
			continue;

		if(Picked[playerid][i])
			return SendClientMessage(playerid, COLOR_GREY, "You picked up this tiki already!");
		else
		{
			OnPlayerPickTiki(playerid, i);
            Picked[playerid][i] = true;
            return 1;
		}
	}
	return 1;
}

forward OnPlayerPickTiki(playerid, tikiid);
public OnPlayerPickTiki(playerid, tikiid) // This callback is called on player picked up a tiki (tikid = index of tiki)
{
	switch(tikiid)
	{
		case 0: // If player picked up tiki[0]
		{
			SendClientMessage(playerid, COLOR_GREY, "Ai gasit o statueta tiki si ai primit 5RP!");
            PlayerInfo[playerid][pExp] += 5;
		}
		case 1: // If player picked up tiki[1]
		{
			SendClientMessage(playerid, COLOR_GREY, "Ai gasit o statueta tiki si ai primit un level up!");
	    	SendClientMessage(playerid, COLOR_GREY, "Felicitari,ai colectat toate tiki-urile si ai mai primit un   bonus de 1.5kk!");
	    	PlayerInfo[playerid][pLevel] +=1;
			GivePlayerMoney(playerid, 1500000);
		}
		case 2:
		{
			// ...
		}
	}
	return 1;
}

IsPlayerPickedUpAllTiki(playerid) // You can use this to check if player picked up all tikis
{
	for(new i = 0; i < 50; i++)
		if(!Picked[playerid][i])
			return false;

	return true;
}
Reply


Messages In This Thread
Tiki System Help - by VikThor - 08.11.2016, 08:00
Re: Tiki System Help - by X337 - 08.11.2016, 08:26
Re: Tiki System Help - by VikThor - 08.11.2016, 08:58
Re: Tiki System Help - by VikThor - 08.11.2016, 09:31
Re: Tiki System Help - by X337 - 08.11.2016, 09:44
Re: Tiki System Help - by VikThor - 08.11.2016, 09:55
Re: Tiki System Help - by X337 - 08.11.2016, 10:14
Re: Tiki System Help - by denNorske - 08.11.2016, 10:15

Forum Jump:


Users browsing this thread: 1 Guest(s)