Jump to content
  • 0

Problema /giftbox nu ramane salvat.


Question

Posted (edited)

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

10 answers to this question

Recommended Posts

  • 0
Posted

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

  • 0
Posted
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

  • 0
Posted
Acum 1 minut, AlexxAdv a spus:

Pai ai definit pe 1 sau pe 0?

pai am cautat pe server new getgift nu am gasit nimica

  • 0
Posted
3 minutes ago, SpriteTV said:

pai am cautat pe server new getgift nu am gasit nimica

cauta new GiftBox sau doar GiftBox nu getgift

  • 0
Posted
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

  • 0
Posted
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

  • 0
Posted
Acum 4 minute, AlexxAdv a spus:

Aici new    GiftBoxActiv = 0 in loc de 0 pune 1

Bun am pus cum ai spus tu.

Am activat gift-ul box-ul dar el tot dispare cad-ul . dar din cate vad el o ramas activat dar cadoul dispare.

  • 0
Posted

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

  • 0
Posted
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.