Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×

Question

Posted

Problema intalnita (descriere): Am creat un timer la comanda :getgift sa poate fii data o data la 4 ore, dar daca dau relog si intru iarasi, pot folosi din nou comanda fara sa se fi salvat timpul
Ero(area / rile) / warning-(ul / urile):-
Liniile de cod / sursa / script-ul(obligatoriu): 

CMD:getgift(playerid, params[])
{
   if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa te loghezi  mai intai.");
   if(IsPlayerInAnyVehicle(playerid)) return SCM(playerid,COLOR_WHITE,"{37B9C8}Coboara din vehicul, pentru a putea primi cadoul.");
   if(!IsPlayerInRangeOfPoint(playerid, 7.0, -2320.9114,-1608.5073,486.2220))  return SCM(playerid,0xFFFFCCFF, "Nu te afli in locatia corecta pe Muntele Chilliad SF.");
   if(TimerGetGift[playerid] >= 1)
	{
    SendClientMessage(playerid, -1, "Poti primi acest cadou o data la 4 ore.");
    return 1;
	}

   {
       {
	    	new Random = random(12);
	    	switch(Random)
	    	{
	    		case 0:
	    		{
	    			GivePlayerCash(playerid,1000);
                	Update(playerid,pCashx);
	    			SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 1,000$.");
	    			TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
		   			ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	    		}
	    		case 1:
	    		{
     				GivePlayerCash(playerid,2000);
                	Update(playerid,pCashx);
	  				SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 2,000$.");
	  				TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
					ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	   			}
	    		case 2:
	    		{
     				GivePlayerCash(playerid,3000);
                	Update(playerid,pCashx);
	  				SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 3,000$.");
	  				TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
					ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	    		}
	    		case 3:
	    		{
            		PlayerInfo[playerid][pExp] += 1;
	    			SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 1 punct de respect.");
	    			TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
					ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	    		}
	    		case 4:
	    		{
	    			PlayerInfo[playerid][pExp] += 2;
	    			SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 2 puncte de respect.");
	    			TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
					ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	    		}
				case 5:
	    		{
	    			PlayerInfo[playerid][pExp] += 3;
	    			SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 3 puncte de respect.");
	    			TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
					ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	    		}
	    		case 6:
	    		{
	    			PlayerInfo[playerid][pExp] += 4;
	    			SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 4 puncte de respect.");
	    			TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
					ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	    		}
	    		case 7:
	    		{
	    			PlayerInfo[playerid][pExp] += 5;
	    			SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 5 puncte de respect.");
	    			TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
					ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	    		}
	    		case 8:
	    		{
	    			PlayerInfo[playerid][pHPoints] += 20;
	    			SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 20 Gold.");
	    			TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
					ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	    		}
	    		case 9:
	    		{
	    			PlayerInfo[playerid][pHPoints] += 30;
	    			SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 30 Gold.");
	    			TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
					ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	    		}
	    		case 10:
	    		{
	    			PlayerInfo[playerid][pHPoints] += 50;
	    			SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 50 Gold.");
	    			TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
					ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	    		}
	    		case 11:
	    		{
     				GivePlayerCash(playerid,5000);
                	Update(playerid,pCashx);
	  				SendClientMessage(playerid, COLOR_WHITE, "Felicitari, ai castigat 5,000$.");
	  				TimerGetGift[playerid] = 1;
					SetTimerEx("NewGetGift", 14400000, false, "i", playerid);
					ApplyAnimation(playerid, "RIOT","RIOT_CHANT", 3.0, 0, 0, 0, 0, 0);
	    		}
	    	}
		}
   }
   return 1;
}


Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: Nu stiu ce ar trebui sa fac, sa se salveze timpul dupa delogare.

4 answers to this question

Recommended Posts

  • 0
Posted

Definesti o noua variabila la enum pInfo , gen : "pGiftTime" , apoi salvezi timer-ul pentru fiecare player prin intermediul acestei variabile , adaugand-o in fisierul playerului sau in tabela din baza de date a player-ului .

  • 0
Posted

Trebuie sa faci astfel incat sa salvezi datele de la getgift in baza de date.

242086.png

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.