Jump to content
  • 0

Nu merge cum trebuie /sellgun


official

Question

Problema intalnita (descriere): Cand ii vand cuiva o arma cu /sellgun el chiar daca nu are licenta o poate cumpara.
Ero(area / rile) / warning-(ul / urile):


CMD:sellgun(playerid, params[])
{
if(!IsPlayerConnectedEx(playerid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(IsPlayerConnected(playerid))
{
   if (playerVariables[playerid][pJob] != 1) return SendClientMessage(playerid,COLOR_GREY,"{FFB870}You are not an Arms Dealer.");
new x_weapon[10],weapon[MAX_PLAYERS],price[MAX_PLAYERS],price2,id,giveplayer[25],sendername[25],string[128];
if(sscanf(params, "us[10]d",id,x_weapon,price2))
{
SendClientMessage(playerid, COLOR_WHITE, "Synthax: /sellgun [Name/Playerid] [Gun Name] [Price]");
SendClientMessage(playerid, COLOR_WHITE, "Weapons: SDPistol(100) Deagle(150)");
SendClientMessage(playerid, COLOR_WHITE, "Weapons: MP5(200) Shotgun(300)");
SendClientMessage(playerid, COLOR_WHITE, "Weapons: AK47(350) M4(400) Rifle(600)");
return 1;
}
if(playerid == id) return SCM(playerid,COLOR_WHITE,"{FFB870}You can not sell yourself weapons.");
if(price2 >= 5000) return SCM(playerid, COLOR_WHITE, "{FFB870}The maximum sell amount is $5,000!");
if(id != INVALID_PLAYER_ID)
        {
if(strcmp(x_weapon,"sdpistol",true) == 0)
{
   if(playerVariables[playerid][pMaterials] < 100) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
weapon[playerid] = 23;
price[playerid] = 100;
}
else if(strcmp(x_weapon,"deagle",true) == 0)
{
   if(playerVariables[playerid][pMaterials] < 150) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
   weapon[playerid] = 24;
price[playerid] = 150;
}
else if(strcmp(x_weapon,"mp5",true) == 0)
{
   if(playerVariables[playerid][pMaterials] < 200) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
   weapon[playerid] = 29;
price[playerid] = 200;
}
else if(strcmp(x_weapon,"shotgun",true) == 0)
{
   if(playerVariables[playerid][pMaterials] < 300) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
   weapon[playerid] = 25;
price[playerid] = 300;
 
}
else if(strcmp(x_weapon,"ak47",true) == 0)
{
   if(playerVariables[playerid][pMaterials] < 350) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
   weapon[playerid] = 30;
price[playerid] = 350;
 
}
else if(strcmp(x_weapon,"m4",true) == 0)
{
   if(playerVariables[playerid][pMaterials] < 400) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
weapon[playerid] = 31;
price[playerid] = 400;
 
}
else if(strcmp(x_weapon,"rifle",true) == 0)
{
   if(playerVariables[playerid][pMaterials] < 600) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
   weapon[playerid] = 33;
price[playerid] = 600;
 
}
else return SendClientMessage(playerid,COLOR_WHITE,"{B8DBFF}Invalid weapon name.");
if(price2 < 1 || price2 > 100000) return SendClientMessage(playerid,COLOR_WHITE,"{B8DBFF}Price must be between $1 and $100,000.");
if (ProxDetectorS(5.0, playerid, id))
{
                if(playerVariables[id][pMoney] < price2) return SCM(playerid,COLOR_WHITE,"{FFB870}This player don't have money needed.");
GetPlayerName(id, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
SellgunOffer[id] = playerid;
SellgunPrice[id] = price2;
SellgunMats[id] = price[playerid];
SellgunID[id] = weapon[playerid];
new gunname[50];
GetWeaponName(weapon[playerid],gunname,sizeof(gunname));
format(string, sizeof(string), "{B8FFDB}* You offered %s %s for %s$.",giveplayer,gunname,NumberFormat(price2));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "{B8FFDB}* %s offered you %s for %s$, (type /accept gun) to accept.",sendername,gunname,NumberFormat(price2));
SendClientMessage(id, COLOR_WHITE, string);
}
else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}This player is not near you.");
}
else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
}
return 1;
}

Liniile de cod / sursa / script-ul(obligatoriu): - 
Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: Da dar nustiu ce sa fac

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
CMD:sellgun(playerid, params[])
{
   if(!IsPlayerConnectedEx(playerid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(IsPlayerConnected(playerid))
   {
       if (playerVariables[playerid][pJob] != 1) return SendClientMessage(playerid,COLOR_GREY,"{FFB870}You are not an Arms Dealer.");
      new x_weapon[10],weapon[MAX_PLAYERS],price[MAX_PLAYERS],price2,id,giveplayer[25],sendername[25],string[128];
      if(sscanf(params, "us[10]d",id,x_weapon,price2))
      {
         SendClientMessage(playerid, COLOR_WHITE, "Synthax: /sellgun [Name/Playerid] [Gun Name] [Price]");
         SendClientMessage(playerid, COLOR_WHITE, "Weapons: SDPistol(100) Deagle(150)");
         SendClientMessage(playerid, COLOR_WHITE, "Weapons: MP5(200) Shotgun(300)");
         SendClientMessage(playerid, COLOR_WHITE, "Weapons: AK47(350) M4(400) Rifle(600)");
         return 1;
      }
      if(playerid == id) return SCM(playerid,COLOR_WHITE,"{FFB870}You can not sell yourself weapons.");
      if(price2 >= 5000) return SCM(playerid, COLOR_WHITE, "{FFB870}The maximum sell amount is $5,000!");
      if(id != INVALID_PLAYER_ID)
        {
        if(playerVariables[id][pGunLic] < 1) return SCM(playerid, COLOR_WHITE, "{FFB870}Acest player nu are licenta pentru arme!");
         if(strcmp(x_weapon,"sdpistol",true) == 0)
         {
             if(playerVariables[playerid][pMaterials] < 100) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
            weapon[playerid] = 23;
            price[playerid] = 100;
         }
         else if(strcmp(x_weapon,"deagle",true) == 0)
         {
             if(playerVariables[playerid][pMaterials] < 150) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
             weapon[playerid] = 24;
            price[playerid] = 150;
         }
         else if(strcmp(x_weapon,"mp5",true) == 0)
         {
             if(playerVariables[playerid][pMaterials] < 200) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
             weapon[playerid] = 29;
            price[playerid] = 200;
         }
         else if(strcmp(x_weapon,"shotgun",true) == 0)
         {
             if(playerVariables[playerid][pMaterials] < 300) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
             weapon[playerid] = 25;
            price[playerid] = 300;

         }
         else if(strcmp(x_weapon,"ak47",true) == 0)
         {
             if(playerVariables[playerid][pMaterials] < 350) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
             weapon[playerid] = 30;
            price[playerid] = 350;

         }
         else if(strcmp(x_weapon,"m4",true) == 0)
         {
             if(playerVariables[playerid][pMaterials] < 400) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
            weapon[playerid] = 31;
            price[playerid] = 400;

         }
         else if(strcmp(x_weapon,"rifle",true) == 0)
         {
             if(playerVariables[playerid][pMaterials] < 600) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}Not enough Materials for that Weapon.");
             weapon[playerid] = 33;
            price[playerid] = 600;

         }
         else return SendClientMessage(playerid,COLOR_WHITE,"{B8DBFF}Invalid weapon name.");
         if(price2 < 1 || price2 > 100000) return SendClientMessage(playerid,COLOR_WHITE,"{B8DBFF}Price must be between $1 and $100,000.");
         if (ProxDetectorS(5.0, playerid, id))
         {
                if(playerVariables[id][pMoney] < price2) return SCM(playerid,COLOR_WHITE,"{FFB870}This player don't have money needed.");
            GetPlayerName(id, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SellgunOffer[id] = playerid;
            SellgunPrice[id] = price2;
            SellgunMats[id] = price[playerid];
            SellgunID[id] = weapon[playerid];
            new gunname[50];
            GetWeaponName(weapon[playerid],gunname,sizeof(gunname));
            format(string, sizeof(string), "{B8FFDB}* You offered %s %s for %s$.",giveplayer,gunname,NumberFormat(price2));
            SendClientMessage(playerid, COLOR_WHITE, string);
            format(string, sizeof(string), "{B8FFDB}* %s offered you %s for %s$, (type /accept gun) to accept.",sendername,gunname,NumberFormat(price2));
            SendClientMessage(id, COLOR_WHITE, string);
         }
         else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}This player is not near you.");
      }
      else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
   }
   return 1;
}

Incearca asa.

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.