în acest tutorial o să vă explic cum să faceți un sistem de quest mult dorit.
Să întelegeți acest sistem
Când se încarcă modul de joc se adaugă pickup-urile în joc.
Jucătorii au de căutat pickup-urile pe rând 1,2,3,4,5.
După ce le-a găsit pe toată ei primesc o recompensă.
Atenție o să aveți nevoie de Streamer pentru acest tutorial și să adaugați la PlayerInfo pLastHeart .
Vă recomand la înregistrare să adăugați pLastHeart = 0. Eu am făcut o comandă prin care resetez acestea, când adaug un nou tip de quest.
Cod: Selectaţi tot
new QuestEventState = 1; //Pentru moment evenimentul se începe odată cu deschiderea serverului.
#define QuestName "Hearts Quest" //Denumirea acestui eveniment.
#define QuestSingleName "hearts" //Cum se numesc acestea (x din x inimii)
new QuestObject = 1240; //Object pentru Pickup.
//si mai jus puneți pozitiiile.
new Float:QuestPositions[][4] = {
{-2426.7627000,2214.1216000,4.9844000},
{-2573.6902000,2239.6013000,4.9822000},
{-2608.6724000,2282.9377000,8.3594000},
{-2608.5308000,2382.1914000,9.9331000},
{-2566.4634000,2407.9978000,14.8467000},
{-2563.1536000,2383.7449000,13.0426000},
{-2570.7590000,2350.4607000,5.9321000},
{-2569.8328000,2306.8784000,4.9844000},
{-2549.7969000,2277.7483000,4.9844000},
{-2525.0195000,2265.0696000,4.9878000},
{-2500.1206000,2254.8196000,4.9647000},
{-2486.3098000,2253.1038000,4.9844000},
{-2473.3911000,2250.2566000,4.9844000}
};
new QuestPickups[sizeof(QuestPositions)]; //pickup-ul.
new Text3D: QuestText[sizeof(QuestPositions)]; //text-ul 3d.
Cod: Selectaţi tot
new string[256]; //String nou cu questul.
for(new a = 0; a < sizeof(QuestPositions); a++)
{
format(string, sizeof(string), "Inima #%d", a + 1);
QuestText[a] = CreateDynamic3DTextLabel(string, -1,QuestPositions[a][0],QuestPositions[a][1],QuestPositions[a][2], 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 5.0);
QuestPickups[a] = CreateDynamicPickup(QuestObject, 23, QuestPositions[a][0],QuestPositions[a][1],QuestPositions[a][2], 0);
}
Cod: Selectaţi tot
public OnPlayerPickUpDynamicPickup(playerid, STREAMER_TAG_PICKUP pickupid)
{
if(QuestEventState == 1)
{
new str[256];
if(PlayerInfo[playerid][pLastHeart] != sizeof(QuestPositions) && PlayerInfo[playerid][pLastHeart] != 999)
{
if(pickupid == QuestPickups[PlayerInfo[playerid][pLastHeart]])
{
PlayerInfo[playerid][pLastHeart] ++;
if(PlayerInfo[playerid][pLastHeart] != sizeof(QuestPositions))
{
format(str,sizeof(str), "%d din %d %s gasite!", PlayerInfo[playerid][pLastHeart], sizeof(QuestPositions), QuestSingleName);
GameTextForPlayer(playerid, str, 3000, 3);
}
else
{
format(str,sizeof(str), "Toate %s au fost gasite!", QuestSingleName); //Inimile gasite, mesaj. + premiul.
GameTextForPlayer(playerid, str, 3000, 3);
GivePlayerMoney(playerid, 50000);
PlayerInfo[playerid][pLastHeart] = 999;
}
}
else
{
format(str,sizeof(str), "(%s) {FFFFFF}Aceasta nu este inima nevoită de tine. Tu ai nevoie de #%d.", QuestName, PlayerInfo[playerid][pLastHeart] + 1); //Nu e inima corecta.
SCM(playerid, COLOR_LIGHTRED, str);
}
}
}
}
Cod: Selectaţi tot
#define COLOR_LIGHTRED 0xFF6347AA