13.06.2018, 02:37
Hello SA:MP Forums,
I've been working on a quest system where you have to pickup 30 pickups with a specific model to gain a prize. I faced a problem which is setting the pickup model in the OnPlayerPickupDynamicPickUp function. What I need to know is how to make this specific pickup model have the function working just on it and not on every other dynamic pickup that's added to the server.
OnPlayerPickupDynamicPickUp code:
The pickup model is: 1582 defined as:
Note:indentation looks crappy in here, sorry for that.
Please notice that there isn't only 1 quest pickup, there's a minimum of 30 pickups.
Thanks for your help in advance!
I've been working on a quest system where you have to pickup 30 pickups with a specific model to gain a prize. I faced a problem which is setting the pickup model in the OnPlayerPickupDynamicPickUp function. What I need to know is how to make this specific pickup model have the function working just on it and not on every other dynamic pickup that's added to the server.
OnPlayerPickupDynamicPickUp code:
PHP код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
if(QuestEventState == 1)
{
new quest2[256];
if(PlayerInfo[playerid][pLastQuest] != sizeof(QuestPositions) && PlayerInfo[playerid][pLastQuest] != 999)
{
if(pickupid == QuestPickups[PlayerInfo[playerid][pLastQuest]])
{
PlayerInfo[playerid][pLastQuest]++;
if(PlayerInfo[playerid][pLastQuest] != sizeof(QuestPositions))
{
format(quest2, sizeof(str), "%d out of %d Pizzas found!", PlayerInfo[playerid][pLastQuest], sizeof(QuestPositions));
GameTextForPlayer(playerid, quest2, 3000, 3);
Update(playerid, pLastQuestx);
}
else
{
format(quest2,sizeof(str), "All %s has been found!", QuestSingleName);
GameTextForPlayer(playerid, quest2, 3000, 3);
GivePlayerMoney(playerid, 300000);
PlayerInfo[playerid][pGoldPoints] += 300;
PlayerInfo[playerid][pExp] += 30;
PlayerInfo[playerid][pLastQuest] = 999;
Update(playerid, pCashx);
Update(playerid, pRP);
Update(playerid, pGoldPointsx);
Update(playerid, pLastQuestx);
}
}
else
{
format(quest2,sizeof(str), "(%s) {FFFFFF}This is not your last Pizza. You need #%d.", QuestName, PlayerInfo[playerid][pLastQuest] + 1);
SCM(playerid, COLOR_LIGHTRED, quest2);
}
}
}
return 1;
}
PHP код:
new QuestObject = 1582;
Please notice that there isn't only 1 quest pickup, there's a minimum of 30 pickups.
Thanks for your help in advance!