Jump to content
  • 0

Problema /giftbox nu ramane salvat.


SpriteTV

Question

Salut dragi jucatori de sa-mp.

Am si eu o problema cu gift box-ul

Dupa ce activez giftbox-ul nu ramane salvat dupa ce ies dupa server si trebuie sa-l activez iara.

Si nu stiu cum pot rezolva chestia asta.

CMD:giftbox(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
	if(IsPlayerConnected(playerid))
 	{
 	    if(PlayerInfo[playerid][pAdmin] >= 7)
		{
		    if(IsPlayerInAnyVehicle(playerid)) return 1;
		    new Float:X,Float:Y,Float:Z,Float:A;
		    GetPlayerPos(playerid, X, Y, Z);
		    GetPlayerFacingAngle(playerid, A);
		    if(GiftBoxActiv < 1)
		    {
		        GiftPosX = X;
		        GiftPosY = Y;
		        GiftPosZ = Z;
		        giftboxobject = CreateDynamicObject(19056, X, Y, Z - 0.4, 0.0, 0.0, A);
		        giftbox3DText = CreateStreamed3DTextLabel("ROPLAYERS.ro Giftbox\nUse /getgift to get a gift",0xA9C4E4CC,X,Y,Z+0.25,8.0,0);
		    	SendClientMessage(playerid, COLOR_YELLOW, "Ai activat giftbox.");
		    	PremiumMaxim = 5;
		    	GiftBoxActiv = 1;
			}
			else
			{
			    DestroyDynamicObject(giftboxobject);
            	DestroyDynamic3DTextLabel(giftbox3DText);
		    	SendClientMessage(playerid, COLOR_YELLOW, "Ai dezactivat gifbox.");
		    	PremiumMaxim = 0;
		    	GiftBoxActiv = 0;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
		}
	}
	return 1;
}

Ma poate ajuta careva? 

if(randgift >= 141)
				{
				    PlayerInfo[playerid][pHiddenColor] += 1;
				    Update(playerid, pHiddenColorx);
                    ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", "Ai primit o culoare hidden.", "OK", "");
			    	format(string,sizeof(string),"(( Giftbox: %s a castigat o culoare hidden din giftbox! Felicitari! ))",sendername);
				}
				if(randgift == 30 || randgift == 60 || randgift == 90 || randgift == 110 || randgift == 140)
				{
				    if(PremiumMaxim > 0)
				    {
				    	new randpoints = 15 + random(25);
				    	PlayerInfo[playerid][pPremiumPoints] += randpoints;
				    	Update(playerid, pPremiumPointsx);
				    	PremiumMaxim -= 1;
				    	format(string,sizeof(string),"Ai primit %d puncte premium.",randpoints);
			    		ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
			    		format(string,sizeof(string),"(( Giftbox: %s a castigat %d puncte premium din giftbox! Felicitari! ))",sendername, randpoints);
					}
					else
					{
                        new randmoney = 4000000 + random(1000000);
					    GivePlayerCash(playerid, randmoney);
					    Update(playerid, pCashx);
					    format(string,sizeof(string),"Ai primit $%s.",FormatNumber(randmoney));
				    	ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
                        format(string,sizeof(string),"(( Giftbox: %s a castigat $%s din giftbox! Felicitari! ))",sendername,FormatNumber(randmoney));
					}
				}
				new y,m,d,h,mi,s;
    			getdate(y,m,d);
    			gettime(h,mi,s);
				PlayerInfo[playerid][pGiftTime] += 5;
				SendClientMessageToAll(COLOR_GENANNOUNCE,string);
				Update(playerid, pGiftTimex);
				mysql_format(SQL, string, sizeof(string), "INSERT INTO giftbox_logs (`text`,`PlayerID`,`time`) VALUES ('%s','%d','%02d/%02d/%d %02d:%02d:%02d')", string, PlayerInfo[playerid][pSQLID],d,m,y,h,mi,s);
				mysql_tquery(SQL,string,"","");
			}
			else
			{
			    SendClientMessage(playerid, COLOR_WHITE, "Nu esti langa giftbox.");
			    SendClientMessage(playerid, COLOR_YELLOW, "Mergi la checkpoint-ul de pe minimap pentru a ajunge la giftbox!");
			    SetPlayerCheckpoint(playerid,GiftPosX,GiftPosY,GiftPosZ,5.0);
			    return 1;
			}
		}
		else return SendClientMessage(playerid, COLOR_WHITE, "The giftbox is not active.");
	}

 

Edited by SpriteTV
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0
Acum 4 minute, AlexxAdv a spus:

Deoarece ai new GiftBoxActiv = 0; presupun pune-l pe 1, new GiftBoxActiv = 1; si asa va fi activat mereu.

if(GiftBoxActiv < 1) uite aici.
		    {
		        GiftPosX = X;
		        GiftPosY = Y;
		        GiftPosZ = Z;
		        giftboxobject = CreateDynamicObject(19056, X, Y, Z - 0.4, 0.0, 0.0, A);
		        giftbox3DText = CreateStreamed3DTextLabel("ROPLAYERS.ro Giftbox\nUse /getgift to get a gift",0xA9C4E4CC,X,Y,Z+0.25,8.0,0);
		    	SendClientMessage(playerid, COLOR_YELLOW, "Ai activat giftbox.");
		    	PremiumMaxim = 5;
		    	GiftBoxActiv = 1;
			}
			else
			{
			    DestroyDynamicObject(giftboxobject);
            	DestroyDynamic3DTextLabel(giftbox3DText);
		    	SendClientMessage(playerid, COLOR_YELLOW, "Ai dezactivat gifbox.");
		    	PremiumMaxim = 0;
		    	GiftBoxActiv = 0;
			}
		}

 

 

pai este pus boss

Link to comment
Share on other sites

  • 0
Acum 1 minut, AlexxAdv a spus:

cauta new GiftBox sau doar GiftBox nu getgift

am doar astea

#define pVarGift
#define pVarGiftx

#define pGiftTimex          81

#define DIALOG_GIFTBOX              570

new    GiftBoxActiv = 0, pGiftTime

Link to comment
Share on other sites

  • 0
2 minutes ago, SpriteTV said:

am doar astea

#define pVarGift
#define pVarGiftx

#define pGiftTimex          81

#define DIALOG_GIFTBOX              570

new    GiftBoxActiv = 0, pGiftTime

Aici new    GiftBoxActiv = 0 in loc de 0 pune 1

Link to comment
Share on other sites

  • 0

Mai simplu decat sa pui giftboxactiv pe 1, si poti sa il stergi.

Pui comanda pe x , y , z , adica sa fii intr-o anumita locatie pentru a putea folosii comanda.

Exemplu:

CMD:getgift(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	{
		if(IsPlayerInRangeOfPoint(playerid, 15.0, 1270.4071, -1348.4037, 13.1547))
 	    {
    		if(PlayerInfo[playerid][pConnectTime] <= 2) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need 3 hours to use /getgift.");
     		if(PlayerInfo[playerid][pGiftTime] > 0)
      		{
       			new string[128];
         		format(string,sizeof(string),"Mai poti folosi aceasta comanda peste %d ore.",PlayerInfo[playerid][pGiftTime]);
       			SendClientMessage(playerid, COLOR_YELLOW, string);
         		return 1;
			}
			if(IsPlayerInRangeOfPoint(playerid, 15.0, 1270.4071, -1348.4037, 13.1547))
			{

Dupa care te duci la Create3DTextLabel si adaugi:

	Create3DTextLabel("{FFFF00}Nume{FFFFFF} GiftBox\n {FFFF00}/getgift {FFFFFF}to get a gift.",0xFFFFFFFF,1270.4071, -1348.4037, 13.1547,25.0,0);

Dupa te duci la "//LINII MASINI" si deasupra adaugi:

	//getgift
	CreateObject(19056, 1270.4071, -1348.4037, 13.1547,   0.00000, 0.00000, 0.00000);

Acum inlocui coordonatele 1270.4071, -1348.4037, 13.1547 cu ce coordonate vrei tu.

#retras

Link to comment
Share on other sites

  • 0
Acum 20 minute, VLM a spus:

Mai simplu decat sa pui giftboxactiv pe 1, si poti sa il stergi.

Pui comanda pe x , y , z , adica sa fii intr-o anumita locatie pentru a putea folosii comanda.

Exemplu:


CMD:getgift(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	{
		if(IsPlayerInRangeOfPoint(playerid, 15.0, 1270.4071, -1348.4037, 13.1547))
 	    {
    		if(PlayerInfo[playerid][pConnectTime] <= 2) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need 3 hours to use /getgift.");
     		if(PlayerInfo[playerid][pGiftTime] > 0)
      		{
       			new string[128];
         		format(string,sizeof(string),"Mai poti folosi aceasta comanda peste %d ore.",PlayerInfo[playerid][pGiftTime]);
       			SendClientMessage(playerid, COLOR_YELLOW, string);
         		return 1;
			}
			if(IsPlayerInRangeOfPoint(playerid, 15.0, 1270.4071, -1348.4037, 13.1547))
			{

Dupa care te duci la Create3DTextLabel si adaugi:


	Create3DTextLabel("{FFFF00}Nume{FFFFFF} GiftBox\n {FFFF00}/getgift {FFFFFF}to get a gift.",0xFFFFFFFF,1270.4071, -1348.4037, 13.1547,25.0,0);

Dupa te duci la "//LINII MASINI" si deasupra adaugi:


	//getgift
	CreateObject(19056, 1270.4071, -1348.4037, 13.1547,   0.00000, 0.00000, 0.00000);

Acum inlocui coordonatele 1270.4071, -1348.4037, 13.1547 cu ce coordonate vrei tu.

ms

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.