Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:gdeposit(playerid, params[])
- {
- if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
- if(IsPlayerConnected(playerid))
- {
- new x = PlayerInfo[playerid][pMember], string[128], cashdeposit, item[30], name[30];
- if(x <= 0) return 1;
- if(sscanf(params, "s[30]d", item, cashdeposit))
- {
- SendClientMessage(playerid, COLOR_GREY, "Syntax:{FFFFFF} /gdeposit [money, materials or drugs] [amount]");
- format(string, sizeof(string), "Safe balance: $%d, %d materials, %d grams of drugs", DynamicFactions[x][fBank], DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 1;
- }
- if(cashdeposit < 1 || cashdeposit > 2147483646) return 1;
- GetPlayerName(playerid, name, sizeof(name));
- if(IsPlayerInRangeOfPoint(playerid, 5.0, DynamicFactions[x][fSafePos][0], DynamicFactions[x][fSafePos][1], DynamicFactions[x][fSafePos][2]))
- {
- if(strcmp(item, "money", true) == 0)
- {
- if(GetPlayerCash(playerid) >= cashdeposit)
- {
- DynamicFactions[x][fBank] += cashdeposit;
- GivePlayerCash(playerid, -cashdeposit);
- Update(playerid,pCashx);
- format(string, sizeof(string), "You've put %s money in safe.", FormatNumber(cashdeposit));
- SendClientMessage(playerid, COLOR_GREY, string);
- format(string, sizeof(string), "Safe balance: $%d, %d materials, %d grams of drugs", DynamicFactions[x][fBank]+cashdeposit, DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
- SendClientMessage(playerid, COLOR_GREY, string);
- new str[184];
- mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Bank`='%d' WHERE `ID`='%d'", DynamicFactions[x][fBank], x);
- mysql_tquery(SQL,str,"","");
- new varxx[256];
- mysql_format(SQL, varxx, sizeof(varxx), "UPDATE users SET `MoneyDeposit`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pMoneyDeposit], PlayerInfo[playerid][pNormalName]);
- mysql_tquery(SQL,varxx,"","");
- return 1;
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that amount of money.");
- }
- else if(strcmp(item, "materials", true) == 0)
- {
- if(cashdeposit <= PlayerInfo[playerid][pMats])
- {
- PlayerInfo[playerid][pMats] = PlayerInfo[playerid][pMats]-cashdeposit;
- DynamicFactions[x][fMats] += cashdeposit;
- format(string, sizeof(string), "You've put %d materials in safe.", cashdeposit);
- SendClientMessage(playerid, COLOR_GREY, string);
- format(string, sizeof(string), "Safe balance: $%d, %d materials, %d grams of drugs", DynamicFactions[x][fBank], DynamicFactions[x][fMats]+cashdeposit, DynamicFactions[x][fDrugs]);
- SendClientMessage(playerid, COLOR_GREY, string);
- format(string, sizeof(string), "Info: {FFFFFF}Total materiale depozitate: %d", PlayerInfo[playerid][pMatsDeposit]+cashdeposit);
- SendClientMessage(playerid, COLOR_JMEK, string);
- new str[256];
- mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Mats`='%d' WHERE `ID`='%d'", DynamicFactions[x][fMats], x);
- mysql_tquery(SQL,str,"","");
- mysql_format(SQL,str,sizeof(str),"UPDATE `users` SET `Materials`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pMats], PlayerInfo[playerid][pNormalName]);
- mysql_tquery(SQL,str,"","");
- new varxx[256];
- mysql_format(SQL, varxx, sizeof(varxx), "UPDATE users SET `MatsDeposit`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pMatsDeposit], PlayerInfo[playerid][pNormalName]);
- mysql_tquery(SQL,varxx,"","");
- return 1;
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that amount of materials.");
- }
- else if(strcmp(item, "drugs", true) == 0)
- {
- if(cashdeposit <= PlayerInfo[playerid][pDrugs])
- {
- PlayerInfo[playerid][pDrugs] = PlayerInfo[playerid][pDrugs]-cashdeposit;
- DynamicFactions[x][fDrugs] += cashdeposit;
- format(string, sizeof(string), "You've put %d drugs in safe.", cashdeposit);
- SendClientMessage(playerid, COLOR_GREY, string);
- format(string, sizeof(string), "Safe balance: $%d, %d materials, %d grams of drugs", DynamicFactions[x][fBank], DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]+cashdeposit);
- SendClientMessage(playerid, COLOR_GREY, string);
- format(string, sizeof(string), "Info: {FFFFFF}Total droguri depozitate: %d", PlayerInfo[playerid][pDrugsDeposit]+cashdeposit);
- SendClientMessage(playerid, COLOR_JMEK, string);
- new str[184];
- mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Drugs`='%d' WHERE `ID`='%d'", DynamicFactions[x][fDrugs], x);
- mysql_tquery(SQL,str,"","");
- mysql_format(SQL,str,sizeof(str),"UPDATE `users` SET `Drugs`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pDrugs], PlayerInfo[playerid][pNormalName]);
- mysql_tquery(SQL,str,"","");
- new varxx[256];
- mysql_format(SQL, varxx, sizeof(varxx), "UPDATE users SET `DrugsDeposit`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pDrugsDeposit], PlayerInfo[playerid][pNormalName]);
- mysql_tquery(SQL,varxx,"","");
- return 1;
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that amount of drugs.");
- }
- else return SendClientMessage(playerid, COLOR_GREY, "Syntax:{FFFFFF} /gdeposit [money, materials or drugs] [amount]");
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "You must be at your group safe to do this.");
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment