Jump to content
  • 0
StR_MaRy

Comanda pe timp

Question

Problema intalnita (descriere): vreau sa fac la comanda /getgift un timer de o ora
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu): http://pastebin.com/2ez58jxk - aici aveti comanda , chiar nu stiu ce pot sa ii fac am testat o gramada :-s
Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: da de multe ori de fiecare data esec...

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Foloseste asa ceva si eventual poti salva in contul fiecaruia acea variabila "Spam_CMD" ca sa nu se reseteze de fiecare data cand intra pe server.

CMD:comandata( playerid, params[] )
{
  	// ( Verifica daca a expirat deja o ora )
    if( gettime( ) - PlayerInfo[ playerid ][ Spam_CMD ] > 3600 ) return SendClientMessage( playerid, ~1, "Poti folosi comanda o singura data pe ora" );
    
  	// ( Executa codul daca este totul ok )
  	// .....

  	// ( Salveaza noua valoare dupa ce a fost executata comanda )
  	PlayerInfo[ playerid ][ Spam_CMD ] = gettime( );
	return true;
}

 


Sinner.png

Share this post


Link to post
Share on other sites
  • 0

Nu am timpul necesar sa stau sa-ti explic fiecare lucru in parte. Am crezut ca ai idee cat de cat despre scripting.


Sinner.png

Share this post


Link to post
Share on other sites
  • 0

Cred ca detineti o functie de salvare a conturilor.. Puteti sa o puneti acolo si de asemenea daca e pe MySQL sa o puneti si in baza de date.

Share this post


Link to post
Share on other sites
  • 0
// Nu uita sa definesti si Spam_CMD pentru PlayerData :)

if(strcmp(cmd, "/getgift", true) == 0)
{
	// ( Verifica daca a expirat deja o ora )
    if( gettime( ) - PlayerData[ playerid ][ Spam_CMD ] > 3600 )
		return SendClientMessage( playerid, ~1, "Poti folosi comanda o singura data pe ora" );
    
    if(IsPlayerConnected(playerid))
   	{
   	    if (!PlayerToPoint(3.0, playerid, 1124.2874,-1466.6426,15.7665))
		{
		    CP[playerid] = 123321;
		    SetPlayerCheckpoint(playerid,1124.2874,-1466.6426,15.7665,5.0);
			SendClientMessage(playerid, COLOR_GRAD2, "Nu esti sub bradul de craciun de langa spawn.");
			SendClientMessage(playerid, COLOR_GRAD2, "Ti-am setat un Punct rosu pe harta unde trebuie sa ajungi.");
			return 1;
		}
		if(PlayerData[playerid][pLevel] > 3)
		{
			new gift = random(9);
   			if(gift == 0)
		    {
		        PlayerData[playerid][pExp] += 5;
		        SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 5 respect points-uri la giftbox.");
		        format(string, sizeof(string), "(( AdmBot says: %s won 5 respect points at giftbox. ))",GetName(playerid));
		    	SendClientMessageToAll(COLOR_WHITE,string);
		    	format(string, sizeof(string), "UPDATE players SET Respect='%d' WHERE id=%d", PlayerData[playerid][pExp], PlayerData[playerid][pSQLID]);
				mysql_query(string);
		    }
		    if(gift == 1)
		    {
		        new cash = random(1000000);
		        PlayerData[playerid][pCash] += cash;
		        SendClientMessage(playerid, COLOR_WHITE, "Ai castigat o suma de bani la giftbox.");
		        format(string, sizeof(string), "(( AdmBot says: %s won $%s at giftbox. ))",GetName(playerid), NumberFormat(cash));
		        SendClientMessageToAll(COLOR_WHITE,string);
				format(string, sizeof(string), "UPDATE players SET Money='%d' WHERE id=%d", PlayerData[playerid][pCash], PlayerData[playerid][pSQLID]);
				mysql_query(string);
		    }
		    if(gift == 2)
		    {
		       	PlayerData[playerid][pWarns] = 0;
		        SendClientMessage(playerid, COLOR_WHITE, "Ai castigat clear warns de la giftbox.");
		        format(string, sizeof(string), "(( AdmBot says: %s won a warns clear at giftbox. ))",GetName(playerid));
		        SendClientMessageToAll(COLOR_WHITE,string);
		        format(string, sizeof(string), "UPDATE players SET Warnings='%d' WHERE id=%d", PlayerData[playerid][pWarns], PlayerData[playerid][pSQLID]);
				mysql_query(string);
		   	}
		    if(gift == 3)
		    {
				PlayerData[playerid][pMats] += 20000;
		        SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 20.000 materiale de la giftbox.");
		        format(string, sizeof(string), "(( AdmBot says: %s won 20.000 materials at giftbox. ))",GetName(playerid));
		        SendClientMessageToAll(COLOR_WHITE,string);
		        format(string, sizeof(string), "UPDATE players SET Materials='%d' WHERE id=%d", PlayerData[playerid][pMats], PlayerData[playerid][pSQLID]);
				mysql_query(string);
		    }
		    if(gift == 4)
		    {
		        PlayerData[playerid][pFpunish] = 0;
		        SendClientMessage(playerid, COLOR_WHITE, "Ai castigat clear FP de la giftbox.");
		        format(string, sizeof(string), "(( AdmBot says: %s won a clear FP at giftbox. ))",GetName(playerid));
		        SendClientMessageToAll(COLOR_WHITE,string);
		        format(string, sizeof(string), "UPDATE players SET Fpunish='%d' WHERE id=%d", PlayerData[playerid][pFpunish], PlayerData[playerid][pSQLID]);
				mysql_query(string);
		    }
		    if(gift == 5)
		    {
		        PlayerData[playerid][pLevel] ++;
		        SendClientMessage(playerid, COLOR_WHITE, "Ai castigat un level up de la giftbox.");
		        format(string, sizeof(string), "(( AdmBot says: %s won a level up at giftbox. ))",GetName(playerid));
		        SendClientMessageToAll(COLOR_WHITE,string);
		        format(string, sizeof(string), "UPDATE players SET PlayerLevel='%d' WHERE id=%d", PlayerData[playerid][pLevel], PlayerData[playerid][pSQLID]);
				mysql_query(string);
		    }
		    if(gift == 6)
		    {
		        new cash = random(70);
		        PlayerData[playerid][pDonateRank] += cash;
		        SendClientMessage(playerid, COLOR_WHITE, "Ai castigat puncte premium la giftbox.");
		        format(string, sizeof(string), "(( AdmBot says: %s won %d premium points at giftbox. ))",GetName(playerid), cash);
		        SendClientMessageToAll(COLOR_WHITE,string);
		        format(string, sizeof(string), "UPDATE players SET DonateRank='%d' WHERE id=%d", PlayerData[playerid][pDonateRank], PlayerData[playerid][pSQLID]);
				mysql_query(string);
		    }
		    if(gift == 7)
		    {

		        PlayerData[playerid][pDrugs] += 10000;
          		SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 10.000 droguri de la giftbox.");
		        format(string, sizeof(string), "(( AdmBot says: %s won 10.000 drugs at giftbox. ))",GetName(playerid));
		        SendClientMessageToAll(COLOR_WHITE,string);
		        format(string, sizeof(string), "UPDATE players SET Drugs='%d' WHERE id=%d", PlayerData[playerid][pDrugs], PlayerData[playerid][pSQLID]);
				mysql_query(string);
		    }
		}
		else return SendClientMessage(playerid, COLOR_GREY, "Trebuie sa ai lvl 4 pentru a folosi /getgift");
	}
	PlayerData[ playerid ][ Spam_CMD ] = gettime( );
	return 1;
}

 


Sinner.png

Share this post


Link to post
Share on other sites
  • 0

primesc astea -  C:\Users\StR\Desktop\Scripting Sa-Mp\GameMode The Pyrex\gamemodes\ThePyrex.pwn(31839) : error 076: syntax error in the expression, or invalid function call
C:\Users\StR\Desktop\Scripting Sa-Mp\GameMode The Pyrex\gamemodes\ThePyrex.pwn(31932) : error 076: syntax error in the expression, or invalid function call
C:\Users\StR\Desktop\Scripting Sa-Mp\GameMode The Pyrex\gamemodes\ThePyrex.pwn(73275) : warning 203: symbol is never used: "Spam_CMD"

 

am pus new Spam_CMD[MAX_PLAYERS]; si forward Spam_CMD(playerid; si tot nu merge

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

This site uses cookies. By continuing browsing, you agree to the use of this information. For more details, see Terms of Use and Privacy Policy.