So our /getgift command is not working properly, it shows a /me but is not giving the gift and is allowing us to spam the command instead of telling us to wait 5 hours after entering it. if you need anymore info let me know. It was working fine when we started but now its acting up, and nobody even touched it
https://pastebin.com/55eSzcQH
CMD:getgift(playerid, params[])
{
new string[128];
if(IsPlayerInRangeOfPoint(playerid, 3.0,2546.680908, 1403.430786, 7699.584472))
{
if(PlayerInfo[playerid][pDonateRank] >= 1)
{
if(VIPGifts == 0 && PlayerInfo[playerid][pDonateRank] < 4)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "The safe is locked!");
return 1;
}
if(PlayerInfo[playerid][pGiftTime] > 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You have already received a gift in the last 5 hours!");
return 1;
}
format(string, sizeof(string), "* %s reaches inside the safe with his eyes closed.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GiftPlayer(500, playerid);
}
}
else if(dynamicgift != 0)
{
new Float:Position[3];
GetDynamicObjectPos(dynamicgift, Position[0], Position[1], Position[2]);
if(IsPlayerInRangeOfPoint(playerid, 5.0, Position[0], Position[1], Position[2]))
{
if(PlayerInfo[playerid][pLevel] >= 3)
{
if(PlayerInfo[playerid][pGiftTime] > 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You have already received a gift in the last 5 hours!");
return 1;
}
format(string, sizeof(string), "* %s reaches inside the bag of gifts with their eyes closed.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GiftPlayer(500, playerid);
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "* You must be at least level 3 to use this, sorry!");
}
}
}
return 1;
}
stock GiftPlayer(playerid, giveplayerid) // playerid = Gifter.? giveplayerid = gift receiver
{
new string;
if(PlayerInfo >= 2 || playerid == MAX_PLAYERS)
{
new randgift = Random(1, 100);
if(randgift >= 1 && randgift <= 83)
{
new gift = Random(1, 10);
if(gift == 1)
{
if(PlayerInfo < 1 || PlayerInfo > 0 || PlayerInfo > 2) return GiftPlayer(playerid, giveplayerid);
GivePlayerValidWeapon(giveplayerid, 27, 60000);
GivePlayerValidWeapon(giveplayerid, 24, 60000);
GivePlayerValidWeapon(giveplayerid, 31, 60000);
GivePlayerValidWeapon(giveplayerid, 34, 60000);
GivePlayerValidWeapon(giveplayerid, 29, 60000);
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won a full weapon set!");
format(string, sizeof(string), "* %s was just gifted a full weapon set, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 2)
{
if(PlayerInfo > 2) return GiftPlayer(playerid, giveplayerid);
PlayerInfo;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won a first aid kit!");
format(string, sizeof(string), "* %s was just gifted a first aid kit, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 3)
{
PlayerInfo = 2000;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won 2,000 materials!");
format(string, sizeof(string), "* %s was just gifted 2,000 materials, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 4)
{
if(PlayerInfo != 0)
{
PlayerInfo--;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won a single warning removal!");
format(string, sizeof(string), "* %s was just gifted a single warning removal, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else
{
SendClientMessageEx(giveplayerid, COLOR_GRAD2, "Random gift ended up in a removal of one warning - let's try again!");
GiftPlayer(playerid, giveplayerid);
return 1;
}
}
else if(gift == 5)
{
PlayerInfo = 50;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won 50 grams of pot!");
format(string, sizeof(string), "* %s was just gifted 50 grams of pot, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 6)
{
PlayerInfo = 25;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won 25 grams of crack!");
format(string, sizeof(string), "* %s was just gifted 25 grams of crack, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 7)
{
GivePlayerCash(giveplayerid, 20000);
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won $20,000!");
format(string, sizeof(string), "* %s was just gifted $20,000, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 8)
{
PlayerInfo = 10;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won 10 paintball tokens!");
format(string, sizeof(string), "* %s was just gifted 10 paintball tokens, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 9)
{
if(PlayerInfo < 1) return GiftPlayer(playerid, giveplayerid);
PlayerInfo = 5;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won 5 VIP tokens!");
format(string, sizeof(string), "* %s was just gifted 5 VIP tokens, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 10)
{
PlayerInfo = 5;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won 5 Respect Points!");
format(string, sizeof(string), "* %s was just gifted 5 Respect Points, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
}
else if(randgift > 83 && randgift <= 98)
{
new gift = Random(1, 9);
if(gift == 1)
{
GivePlayerCash(giveplayerid, 150000);
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won $150,000!");
format(string, sizeof(string), "* %s was just gifted $150,000, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 2)
{
PlayerInfo = 15000;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won 15,000 materials!");
format(string, sizeof(string), "* %s was just gifted 15,000 materials, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 3)
{
PlayerInfo = 10;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won 10 respect points!");
format(string, sizeof(string), "* %s was just gifted 10 respect points, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 4)
{
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won a free car!");
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Note: This rare reward may take up to 48 hours to be rewarded, contact Shop Techs.");
format(PlayerInfo, 128, "Free Car (Gift)");
format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has just gifted %s and he won a free car.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ABroadCast(COLOR_YELLOW, string, 4);
if(playerid != MAX_PLAYERS)
{
new year,month,day,log;
getdate(year, month, day);
format(log, sizeof(log), "AdmCmd: %s has just gifted %s and he won a free car(%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), month, day, year);
Log("logs/gifts.log", log);
} else {
new year,month,day,log;
getdate(year, month, day);
format(log, sizeof(log), "AdmCmd: %s was just gifted by the system and he won a free car(%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), month, day, year);
Log("logs/gifts.log", log);
}
format(string, sizeof(string), "* %s was just gifted a free car, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 5)
{
if(PlayerInfo > 0)
{
PlayerInfo = 15;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won 15 VIP tokens!");
format(string, sizeof(string), "* %s was just gifted 15 VIP tokens, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else
{
PlayerInfo = 1;
PlayerInfo = 10800;
PlayerInfo = 1;
format(string, sizeof(string), "You have been invited to become a Level 1 VIP for 3 hours. Enjoy!", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "BUDDY INVITE: %s has won a buddyinvite.", GetPlayerNameEx(giveplayerid));
Log("logs/setvip.log", string);
format(string, sizeof(string), "* %s was just gifted 3 hours of VIP, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
}
else if(gift == 6)
{
PlayerToyInfo = 18643;
PlayerToyInfo = 6;
PlayerToyInfo = 0.0;
PlayerToyInfo = 0.0;
PlayerToyInfo = 0.0;
PlayerToyInfo = 0.0;
PlayerToyInfo = 0.0;
PlayerToyInfo = 0.0;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won a Free Laser Pointer!");
format(string, sizeof(string), "* %s was just gifted a Free Laser Pointer, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 7)
{
if(PlayerInfo < 1) return GiftPlayer(playerid, giveplayerid);
PlayerInfo = 0;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won a Free Admute Reset!");
format(string, sizeof(string), "* %s was just gifted a Free Admute Reset, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 8)
{
if(PlayerInfo < 1) return GiftPlayer(playerid, giveplayerid);
PlayerInfo = 0;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won a Free Nmute Reset!");
format(string, sizeof(string), "* %s was just gifted a Free Nmute Reset, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
}
else if(randgift > 98 && randgift <= 100)
{
new gift = Random(1, 6);
if(gift == 1 && PlayerInfo <= 2) // Silver VIP can get it extended, I suppose
{
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won one month of Silver VIP!");
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Note: This rare reward may take up to 48 hours to be rewarded.");
format(PlayerInfo, 128, "Free Silver VIP (Gift)");
format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has just gifted %s and he won one month of Silver VIP.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ABroadCast(COLOR_YELLOW, string, 2);
new year,month,day,log;
getdate(year, month, day);
format(log, sizeof(log), "AdmCmd: %s has just gifted %s and he won one month of Silver VIP(%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), month, day, year);
Log("logs/gifts.log", log);
format(string, sizeof(string), "* %s was just gifted one month of Silver VIP, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 2)
{
if(playerid != MAX_PLAYERS)
{
new year,month,day,log;
getdate(year, month, day);
format(log, sizeof(log), "AdmCmd: %s has just gifted %s and he won a free house(%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), month, day, year);
Log("logs/gifts.log", log);
} else {
new year,month,day,log;
getdate(year, month, day);
format(log, sizeof(log), "AdmCmd: %s was just gifted by the system and he won a free house(%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), month, day, year);
Log("logs/gifts.log", log);
}
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won a free house!");
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Note: This rare reward may take up to 48 hours to be rewarded.");
format(PlayerInfo, 128, "Free House (Gift)");
format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has just gifted %s and he won a free house.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ABroadCast(COLOR_YELLOW, string, 2);
format(string, sizeof(string), "* %s was just gifted a free house, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 3)
{
if(PlayerInfo < 1) return GiftPlayer(playerid, giveplayerid);
PlayerInfo = 50;
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won 50 VIP tokens!");
format(string, sizeof(string), "* %s was just gifted 50 VIP tokens, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 4)
{
new year,month,day,log;
getdate(year, month, day);
format(log, sizeof(log), "AdmCmd: %s has just gifted %s and he won $500,000. (%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), month, day, year);
Log("logs/gifts.log", log);
GivePlayerCash(giveplayerid, 500000);
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won $500,000!");
format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has just gifted %s and he won $500,000.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ABroadCast(COLOR_YELLOW, string, 2);
format(string, sizeof(string), "* %s was just gifted $500,000, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else if(gift == 5)
{
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Congratulations - you have won one month of Gold VIP!");
SendClientMessageEx(giveplayerid, COLOR_GRAD2, " Note: This rare reward may take up to 48 hours to be rewarded.");
format(PlayerInfo, 128, "Free Gold VIP (Gift)");
format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has just gifted %s and he won one month of Gold VIP.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ABroadCast(COLOR_YELLOW, string, 2);
new year,month,day,log;
getdate(year, month, day);
format(log, sizeof(log), "AdmCmd: %s has just gifted %s and he won one month of Gold VIP(%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), month, day, year);
Log("logs/gifts.log", log);
format(string, sizeof(string), "* %s was just gifted one month of Gold VIP, enjoy!", GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
}
PlayerInfo = 300;
}
return 1;
}