Advertisement
Guest User

ez

a guest
Sep 23rd, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.63 KB | None | 0 0
  1. // ez pz
  2.  
  3. CMD:test(playerid, params[])
  4. {
  5.     if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Nu poti folosi nicio comanda pentru ca nu esti logat.");
  6.     if(IsPlayerConnected(playerid))
  7.     {
  8.         if(IsAMember(playerid))
  9.         {
  10.             new x = PlayerInfo[playerid][pMember],string[256],cashdeposit;
  11.             x = PlayerInfo[playerid][pMember];
  12.             new oldbalance = DynamicFactions[x][fBank];
  13.             new oldbalance1 = DynamicFactions[x][fBank];
  14.             new x_nr[70], val, drugsam,sendername[30],matsam;
  15.             if(IsPlayerInRangeOfPoint(playerid,50.0,DynamicFactions[x][fcX],DynamicFactions[x][fcY],DynamicFactions[x][fcZ]))
  16.             {
  17.                 if(sscanf(params, "s[70]d", x_nr, val))
  18.                 {
  19.                     SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
  20.                     format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  21.                     SendClientMessage(playerid, COLOR_GREY, string);
  22.                     return 1;
  23.                 }
  24.                 if(strcmp(x_nr,"money",true) == 0)
  25.                 {
  26.                     cashdeposit = val;
  27.                     if(GetPlayerCash(playerid) >= cashdeposit)
  28.                     {
  29.                         DynamicFactions[x][fBank] += cashdeposit;
  30.                         GivePlayerCash(playerid, -cashdeposit);
  31.                         Update(playerid,pCashx);
  32.                         new str[184];
  33.                         mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Bank`='%d' WHERE `ID`='%d'",DynamicFactions[x][fBank],x);
  34.                         mysql_tquery(SQL,str,"","");
  35.                         SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
  36.                         format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  37.                         SendClientMessage(playerid, COLOR_GREY, string);
  38.                         format(string, sizeof(string), "%s deposits $%s in their group safe.",PlayerInfo[playerid][pNormalName],FormatNumber(cashdeposit));
  39.                         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  40.                         format(string, sizeof(string), "Faction manager %s deposited $%s in group safe.", PlayerInfo[playerid][pNormalName],FormatNumber(cashdeposit));
  41.                         SendRadioMessage(x, COLOR_LEADER, string);
  42.                         return 1;
  43.                     }
  44.                     else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that amount of money with you.");
  45.                 }
  46.                 if(strcmp(x_nr,"materials",true) == 0)
  47.                 {
  48.                     matsam = val;
  49.                     if(matsam <= PlayerInfo[playerid][pMats])
  50.                     {
  51.                         PlayerInfo[playerid][pMats] =PlayerInfo[playerid][pMats]-matsam;
  52.                         DynamicFactions[x][fMats] +=matsam;
  53.                         PlayerInfo[playerid][pCommands]++;
  54.                         Update(playerid,pCommandsx);
  55.                         new str[256];
  56.                         mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Commands`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pCommands],PlayerInfo[playerid][pNormalName]);
  57.                         mysql_tquery(SQL,str,"","");
  58.                         format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  59.                         SendClientMessage(playerid, COLOR_GREY, string);
  60.                         format(string, sizeof(string), "You have deposited %d materials in your group safe.", matsam);
  61.                         SendClientMessage(playerid, COLOR_WHITE, string);
  62.                         format(string, sizeof(string), "%s deposits %d materials in their group safe.",PlayerInfo[playerid][pNormalName],matsam);
  63.                         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  64.                         mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Mats`='%d' WHERE `ID`='%d'",DynamicFactions[x][fMats],x);
  65.                         mysql_tquery(SQL,str,"","");
  66.                         mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Materials`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pMats],PlayerInfo[playerid][pNormalName]);
  67.                         mysql_tquery(SQL,str,"","");
  68.                         return 1;
  69.                     }
  70.                     else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much materials on you.");
  71.                 }
  72.                 if(strcmp(x_nr,"drugs",true) == 0)
  73.                 {
  74.                     drugsam = val;
  75.                     if(drugsam <= PlayerInfo[playerid][pDrugs])
  76.                     {
  77.                         PlayerInfo[playerid][pDrugs] =PlayerInfo[playerid][pDrugs]-drugsam;
  78.                         DynamicFactions[x][fDrugs] +=drugsam;
  79.                         format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  80.                         SendClientMessage(playerid, COLOR_GREY, string);
  81.                         format(string, sizeof(string), "You have deposited %d materials in your group safe.", drugsam);
  82.                         SendClientMessage(playerid, COLOR_WHITE, string);
  83.                         format(string, sizeof(string), "%s deposits %d grams of drugs in their group safe.",PlayerInfo[playerid][pNormalName],drugsam);
  84.                         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  85.                         new str[184];
  86.                         mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Drugs`='%d' WHERE `ID`='%d'",DynamicFactions[x][fDrugs],x);
  87.                         mysql_tquery(SQL,str,"","");
  88.                         mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Drugs`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pDrugs],PlayerInfo[playerid][pNormalName]);
  89.                         mysql_tquery(SQL,str,"","");
  90.                         return 1;
  91.                     }
  92.                     else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much grams of drugs on you.");
  93.                 }
  94.             }
  95.             else return SendClientMessage(playerid, COLOR_ERROR, "This command can only be used by in your HQ.");
  96.         }
  97.     }
  98.     return 1;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement