Jump to content
  • 0

[Problema] Getgift


mefedrona

Question

Problema intalnita (descriere): Am o comanda care iti da o data la 3 euro un cadou daca tastezi in locul unde se afla comanda /getgift

Dar faza este ca iti da cadoul , dar daca dai restart si intri inapoi poti tasta dinou /getgift fara a mai astepta 3 euro
Ero(area / rile) / warning-(ul / urile): 0
Liniile de cod / sursa / script-ul(obligatoriu):

CMD:getgift(playerid, params[])
{
	if(playerVariables[playerid][pPlayingHours] >= 3)
	{
		if(assetVariables[1][aAssetValue] == 1)
		{
			if(IsPlayerInRangeOfPoint(playerid, 15.0, 1123.7257,-1468.3381,15.7514))
			{
				format(szMessage, 256, "Poti folosi /getgift peste %d ore.", playerVariables[playerid][pGiftHours]);
				if(playerVariables[playerid][pGiftHours] == 0)
				{
					new gift = random(10);
					if(gift == 0)
					{
						playerVariables[playerid][pRPoints] += 5;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 5 respect points-uri la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 5 respect points at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 1)
					{
						new cash = random(1000000);
						playerVariables[playerid][pMoney] += cash;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat o suma de bani la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won $%s at giftbox. ))",GetName(playerid), NumberFormat(cash));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 2)
					{
						playerVariables[playerid][pRobPoints] += 100;
						if(playerVariables[playerid][pGroup] == 1 || playerVariables[playerid][pGroup] == 2 || playerVariables[playerid][pGroup] == 3 || playerVariables[playerid][pGroup] == 5)
						{
							SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 100 lawer points-uri la giftbox.");
							format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 100 lawer points at giftbox.  ))",GetName(playerid));
							SCMTA(COLOR_LIGHT,szMessage);				
						}
						else
						{
							SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 100 rob points-uri la giftbox.");
							format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 100 rob points at giftbox.  ))",GetName(playerid));
							SCMTA(COLOR_LIGHT,szMessage);	
						}
					}
					if(gift == 3)
					{
						playerVariables[playerid][pDriveLicense] += 500;
				        playerVariables[playerid][pGunLicense] += 500;
				        playerVariables[playerid][pFlyLicense] += 500;
				        playerVariables[playerid][pBoatLicense] += 500;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat inca 500 de ore la fiecare licenta de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 5 respect points at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 4)
					{
						playerVariables[playerid][pWarns] = 0;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat clear warns de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won a warns clear at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
						new str[128];
						format(str,128,"UPDATE playeraccounts SET playerVIP = 0 WHERE playerID = %d",playerVariables[playerid][pInternalID]);
						mysql_tquery(handle, str);
					}
					if(gift == 5)
					{
						playerVariables[playerid][pMaterials] += 100000;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 100.000 materiale de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 100.000 materials at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 6)
					{
						playerVariables[playerid][pFPunish] = 0;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat clear FP de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won a clear FP at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 7)
					{
						playerVariables[playerid][pLevel] ++;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat un level up de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won a level up at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 8)
					{
						new cash = random(69);
						playerVariables[playerid][pPremiumPoints] += cash;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat puncte premium la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won %d premium points at giftbox. ))",GetName(playerid), cash);
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 9)
					{

						playerVariables[playerid][pDrugs] += 100000;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 100.000 droguri de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 100.000 drugs at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					playerVariables[playerid][pGiftHours] = 4;
				}
				else SCM(playerid,COLOR_YELLOW, szMessage);
			}
			else
			{
				SCM(playerid,COLOR_WHITE, "You are not at giftbox location. Go to checkpoint.");
				SetPlayerCheckpoint(playerid, 1123.7257,-1468.3381,15.7514, 2);
			}	
		}
		else SCM(playerid,COLOR_YELLOW,"The gift is not active.");
	}	
	
	else SCM(playerid,COLOR_WHITE, "Ai nevoie de 3 ore jucate pentru a folosi comanda /getgift.");
	return 1;
}	

Imagini / Video (optional): 0
Ati incercat sa rezolvati singur?: Am incercat sa adaug un timer de 3 ore , dar ma ca.m batut..

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Pune in baza de date mysql un table nou la playeri pe nume : playerHours , si o sa functioneze cum trebuie !

 

si ca sa fi sigur pune si asta :

CMD:getgift(playerid, params[])
{
	if(playerVariables[playerid][pPlayingHours] >= 3)
	{
		if(assetVariables[1][aAssetValue] == 1)
		{
			if(IsPlayerInRangeOfPoint(playerid, 15.0, 1123.7257,-1468.3381,15.7514))
			{
				format(szMessage, 256, "Poti folosi /getgift peste %d ore.", playerVariables[playerid][pGiftHours]);
				if(playerVariables[playerid][pGiftHours] == 0)
				{
					new gift = random(10);
					if(gift == 0)
					{
						playerVariables[playerid][pRPoints] += 5;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 5 respect points-uri la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 5 respect points at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 1)
					{
						new cash = random(1000000);
						playerVariables[playerid][pMoney] += cash;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat o suma de bani la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won $%s at giftbox. ))",GetName(playerid), NumberFormat(cash));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 2)
					{
						playerVariables[playerid][pRobPoints] += 100;
						if(playerVariables[playerid][pGroup] == 1 || playerVariables[playerid][pGroup] == 2 || playerVariables[playerid][pGroup] == 3 || playerVariables[playerid][pGroup] == 5)
						{
							SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 100 lawer points-uri la giftbox.");
							format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 100 lawer points at giftbox.  ))",GetName(playerid));
							SCMTA(COLOR_LIGHT,szMessage);				
						}
						else
						{
							SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 100 rob points-uri la giftbox.");
							format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 100 rob points at giftbox.  ))",GetName(playerid));
							SCMTA(COLOR_LIGHT,szMessage);	
						}
					}
					if(gift == 3)
					{
						playerVariables[playerid][pDriveLicense] += 500;
				        playerVariables[playerid][pGunLicense] += 500;
				        playerVariables[playerid][pFlyLicense] += 500;
				        playerVariables[playerid][pBoatLicense] += 500;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat inca 500 de ore la fiecare licenta de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 5 respect points at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 4)
					{
						playerVariables[playerid][pWarns] = 0;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat clear warns de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won a warns clear at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
						new str[128];
						format(str,128,"UPDATE playeraccounts SET playerVIP = 0 WHERE playerID = %d",playerVariables[playerid][pInternalID]);
						mysql_tquery(handle, str);
					}
					if(gift == 5)
					{
						playerVariables[playerid][pMaterials] += 100000;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 100.000 materiale de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 100.000 materials at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 6)
					{
						playerVariables[playerid][pFPunish] = 0;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat clear FP de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won a clear FP at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 7)
					{
						playerVariables[playerid][pLevel] ++;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat un level up de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won a level up at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 8)
					{
						new cash = random(69);
						playerVariables[playerid][pPremiumPoints] += cash;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat puncte premium la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won %d premium points at giftbox. ))",GetName(playerid), cash);
						SCMTA(COLOR_LIGHT,szMessage);
					}
					if(gift == 9)
					{

						playerVariables[playerid][pDrugs] += 100000;
						SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 100.000 droguri de la giftbox.");
						format(szMessage, sizeof(szMessage), "(( AdmBot says: %s won 100.000 drugs at giftbox. ))",GetName(playerid));
						SCMTA(COLOR_LIGHT,szMessage);
					}
					playerVariables[playerid][pGiftHours] = 4;
				}
				else SCM(playerid,COLOR_YELLOW, szMessage);
			}
			else
			{
				SCM(playerid,COLOR_WHITE, "You are not at giftbox location. Go to checkpoint.");
				SetPlayerCheckpoint(playerid, 1123.7257,-1468.3381,15.7514, 2);
			}	
		}
		else SCM(playerid,COLOR_YELLOW,"The gift is not active.");
	}	
	
	else SCM(playerid,COLOR_WHITE, "Ai nevoie de 3 ore jucate pentru a folosi comanda /getgift.");
	return 1;
}
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.