[CAMPANIE STAFF]Cautam moderatori si designeri activi!
Welcome to WTFCS Community Forums!
Servere gaming la super-preturi! [HOSTING SERVICE]
-->






[PAWN] Quest System (static)
Author : mihay111, Category : Tutoriale, 0 Replyes, 671 Views
EVALUATE THIS TOPIC
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
1 Guest(s)
Moderator
     
577
POSTS
452
THREADS
190
REPUTATION
Male
Sex

WtfCs Coins: 0.15[w]

Suit Member
04-19-2020, 01:09 PM
#1
Creat de KeNNyAdv

Quote: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-au găsit pe toate 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.

Hai să incepem.

Code:
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.

Acum adugăm la OnGameModeInit.


Code:
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);
}

Acum să adăugăm un nou public în caz că nu îl aveti. ( Nu am explicat aici, deoarece ar cam trebui sa-l aveti toti, nu-i nimic de explicat.


Code:
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);
           }
       }
   }
}

În caz că vă spune că culoarea COLOR_LIGHTRED nu este definită adăugați acest rând la inceput de gamemode.


Code:
#define COLOR_LIGHTRED      0xFF6347AA


Forum Jump: