Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:getgift(playerid, params[])
- {
- if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
- if(IsPlayerConnected(playerid))
- {
- if(GiftBoxActiv > 0)
- {
- if(PlayerInfo[playerid][pConnectTime] <= 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need 2 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, 5.0, GiftPosX,GiftPosY,GiftPosZ))
- {
- new randgift = random(150),string[256],sendername[30];
- GetPlayerName(playerid,sendername,sizeof(sendername));
- if(randgift >= 0 && randgift <= 29)
- {
- new randmats = 2000 + random(28000);
- PlayerInfo[playerid][pMats] += randmats;
- Update(playerid, pMatsx);
- format(string,sizeof(string),"Ai primit %d materiale.",randmats);
- ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
- format(string,sizeof(string),"(( Giftbox: %s a castigat %s materiale din giftbox! Felicitari! ))",sendername,FormatNumber(randmats));
- }
- if(randgift >= 31 && randgift <= 59)
- {
- new str[1400];
- PlayerInfo[playerid][pCarLic] = 1;
- PlayerInfo[playerid][pCarLicT] = 500;
- PlayerInfo[playerid][pFlyLic] = 1;
- PlayerInfo[playerid][pFlyLicT] = 500;
- PlayerInfo[playerid][pBoatLic] = 1;
- PlayerInfo[playerid][pBoatLicT] = 500;
- PlayerInfo[playerid][pGunLic] = 1;
- PlayerInfo[playerid][pGunLicT] = 500;
- mysql_format(SQL,str,1400,"UPDATE users SET `CarLic`='1',`CarLicT`='500',`FlyLic`='1',`FlyLicT`='500',`BoatLic`='1',`BoatLicT`='500',`GunLic`='1',`GunLicT`='500' WHERE `name`='%s'",PlayerInfo[playerid][pNormalName]);
- mysql_tquery(SQL,str,"","");
- ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", "Ai primit toate licentele pentru 500 ore.", "OK", "");
- format(string,sizeof(string),"(( Giftbox: %s a castigat toate licentele pentru 500 ore din giftbox! Felicitari! ))",sendername);
- }
- if(randgift >= 61 && randgift <= 89)
- {
- new randfw = 5 + random(20),str2[256];
- PlayerInfo[playerid][pFWorks] += randfw;
- mysql_format(SQL,str2,sizeof(str2),"UPDATE users SET `FWorks`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pFWorks],PlayerInfo[playerid][pNormalName]);
- mysql_tquery(SQL,str2,"","");
- format(string,sizeof(string),"Ai primit %d artificii.",randfw);
- ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
- format(string,sizeof(string),"(( Giftbox: %s a castigat %d artificii din giftbox! Felicitari! ))",sendername,randfw);
- }
- if(randgift >= 91 && randgift <= 109)
- {
- new randm = random(100);
- if(randm >= 0 && randm <= 30)
- {
- new randmoney = 100000 + random(100000);
- 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));
- }
- if(randm >= 31 && randm <= 50)
- {
- new randmoney = 300000 + random(200000);
- 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));
- }
- if(randm >= 51 && randm <= 80)
- {
- new randmoney = 500000 + random(500000);
- 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));
- }
- if(randm >= 81 && randm <= 90)
- {
- new randmoney = 1000000 + random(500000);
- 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));
- }
- if(randm >= 91)
- {
- new randmoney = 2000000 + 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));
- }
- }
- if(randgift >= 111 && randgift <= 119)
- {
- new randmoney = 1000000 + 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));
- }
- if(randgift >= 120 && randgift <= 129)
- {
- if(PlayerInfo[playerid][pWarns] == 0)
- {
- new randmoney = 1000000 + 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));
- }
- else
- {
- PlayerInfo[playerid][pWarns] = 0;
- Update(playerid, pWarnsx);
- ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", "Ai primit Clear warns.", "OK", "");
- format(string,sizeof(string),"(( Giftbox: %s a castigat Clear warns din giftbox! Felicitari! ))",sendername);
- }
- }
- if(randgift >= 130 && randgift <= 139)
- {
- if(PlayerInfo[playerid][pFpunish] == 0)
- {
- new randmoney = 1000000 + 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));
- }
- else
- {
- PlayerInfo[playerid][pFpunish] = 0;
- Update(playerid,pFpunishx);
- ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", "Ai primit Clear FP.", "OK", "");
- format(string,sizeof(string),"(( Giftbox: %s a castigat Clear FP din giftbox! Felicitari! ))",sendername);
- }
- }
- 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] += 2;
- 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.");
- return 1;
- }
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "The giftbox is not active.");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment