Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:test(playerid, params[])
- {
- if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Nu poti folosi nicio comanda pentru ca nu esti logat.");
- if(IsPlayerConnected(playerid))
- {
- if(IsAMember(playerid))
- {
- new x = PlayerInfo[playerid][pMember],string[256],cashdeposit;
- x = PlayerInfo[playerid][pMember];
- new oldbalance = DynamicFactions[x][fBank];
- new oldbalance1 = DynamicFactions[x][fBank];
- new x_nr[70],drugsam,sendername[30],matsam;
- if(IsPlayerInRangeOfPoint(playerid,50.0,DynamicFactions[x][fcX],DynamicFactions[x][fcY],DynamicFactions[x][fcZ]))
- {
- if(sscanf(params, "s[70]", x_nr))
- {
- SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
- format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 1;
- }
- if(strcmp(x_nr,"money",true) == 0)
- {
- if(sscanf(params, "d", cashdeposit))
- {
- SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
- format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 1;
- }
- if(GetPlayerCash(playerid) >= cashdeposit)
- {
- DynamicFactions[x][fBank] += cashdeposit;
- GivePlayerCash(playerid, -cashdeposit);
- Update(playerid,pCashx);
- 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,"","");
- SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
- format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
- SendClientMessage(playerid, COLOR_GREY, string);
- format(string, sizeof(string), "%s deposits $%s in their group safe.",PlayerInfo[playerid][pNormalName],FormatNumber(cashdeposit));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- format(string, sizeof(string), "Faction manager %s deposited $%s in group safe.", PlayerInfo[playerid][pNormalName],FormatNumber(cashdeposit));
- SendRadioMessage(x, COLOR_LEADER, string);
- return 1;
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that amount of money with you.");
- }
- if(strcmp(x_nr,"materials",true) == 0)
- {
- if(sscanf(params, "d", matsam))
- {
- SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
- format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 1;
- }
- if(matsam <= PlayerInfo[playerid][pMats])
- {
- PlayerInfo[playerid][pMats] =PlayerInfo[playerid][pMats]-matsam;
- DynamicFactions[x][fMats] +=matsam;
- PlayerInfo[playerid][pCommands]++;
- Update(playerid,pCommandsx);
- new str[256];
- mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Commands`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pCommands],PlayerInfo[playerid][pNormalName]);
- mysql_tquery(SQL,str,"","");
- format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
- SendClientMessage(playerid, COLOR_GREY, string);
- format(string, sizeof(string), "You have deposited %d materials in your group safe.", matsam);
- SendClientMessage(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "%s deposits %d materials in their group safe.",PlayerInfo[playerid][pNormalName],matsam);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- 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,"","");
- return 1;
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much materials on you.");
- }
- if(strcmp(x_nr,"drugs",true) == 0)
- {
- if(sscanf(params, "d", drugsam))
- {
- SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
- format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 1;
- }
- if(drugsam <= PlayerInfo[playerid][pDrugs])
- {
- PlayerInfo[playerid][pDrugs] =PlayerInfo[playerid][pDrugs]-drugsam;
- DynamicFactions[x][fDrugs] +=drugsam;
- format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
- SendClientMessage(playerid, COLOR_GREY, string);
- format(string, sizeof(string), "You have deposited %d materials in your group safe.", drugsam);
- SendClientMessage(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "%s deposits %d grams of drugs in their group safe.",PlayerInfo[playerid][pNormalName],drugsam);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- 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,"","");
- return 1;
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much grams of drugs on you.");
- }
- }
- else return SendClientMessage(playerid, COLOR_ERROR, "This command can only be used by in your HQ.");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement