SA-MP Forums Archive
Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help (/showthread.php?tid=161797)



Help - Ardo - 21.07.2010

PHP код:
if(strcmp(cmd,"/valmistarelv",true)==0)
    {
        if(
IsPlayerConnected(playerid))
       {
          if (
PlayerInfo[playerid][pJob] != 9)
         {
             
SendClientMessage(playerid,COLOR_GREY,"   Sa ei ole relvaдrikas !");
             return 
1;
         }
         new 
x_weapon[256],weapon[MAX_PLAYERS],ammo[MAX_PLAYERS],price[MAX_PLAYERS];
         
tmp strtok(cmdtextidx);
         if(!
strlen(tmp))
         {
            
SendClientMessage(playeridCOLOR_GRAD1"Kasutus: /valmistarelv [MдngijaID/OsaNimest] [relvanimi]");
            
SendClientMessage(playeridCOLOR_GREY"Relvad: knife(100) bat(100) flowers(25) sdpistol(100) eagle(150)");
            
SendClientMessage(playeridCOLOR_GREY"Relvad: mp5(200) shotgun(200) ak47(600) m4(600) rifle (600)");
            return 
1;
         }
         
giveplayerid ReturnUser(tmp);
         if (
IsPlayerConnected(giveplayerid))
         {
             if(
giveplayerid != INVALID_PLAYER_ID)
             {
               
x_weapon strtok(cmdtextidx);
               if(!
strlen(x_weapon))
               {
                  
SendClientMessage(playeridCOLOR_GREEN"________________________________________________");
                  
SendClientMessage(playeridCOLOR_WHITE"*** Relvade mььk ***");
                  
SendClientMessage(playeridCOLOR_GREY"Kasutus: /valmistarelv [MдngijaID/OsaNimest] [relvanimi]");
                  
SendClientMessage(playeridCOLOR_GREY"Relvad: knife(100) bat(100) flowers(25) sdpistol(100) eagle(200)");
                  
SendClientMessage(playeridCOLOR_GREY"Relvad: mp5(200) shotgun(200) ak47(600) m4(600) rifle(600)");
                  
SendClientMessage(playeridCOLOR_GREEN"________________________________________________");
                  return 
1;
               }
            }
            if(
strcmp(x_weapon,"knife",true) == 0) { if(PlayerInfo[playerid][pMats] > 99) { weapon[playerid] = 4price[playerid] = 100ammo[playerid] = 1; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
            else if(
strcmp(x_weapon,"bat",true) == 0) { if(PlayerInfo[playerid][pMats] > 99) { weapon[playerid] = 5price[playerid] = 100ammo[playerid] = 1; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
            else if(
strcmp(x_weapon,"sdpistol",true) == 0) { if(PlayerInfo[playerid][pMats] > 99) { weapon[playerid] = 23price[playerid] = 100ammo[playerid] = 50; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
            else if(
strcmp(x_weapon,"flowers",true) == 0) { if(PlayerInfo[playerid][pMats] > 24) { weapon[playerid] = 14price[playerid] = 25ammo[playerid] = 1; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
            else if(
strcmp(x_weapon,"eagle",true) == 0) { if(PlayerInfo[playerid][pMats] > 199) { weapon[playerid] = 24price[playerid] = 150ammo[playerid] = 50; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
            else if(
strcmp(x_weapon,"mp5",true) == 0) { if(!PlayerToPoint(15.0,playerid,149.7532,-287.5675,1.5781)) { SendClientMessage(playeridCOLOR_GREY"   You can sell this gun only at black market !"); return 1; } if(PlayerInfo[playerid][pMats] > 199) { weapon[playerid] = 29price[playerid] = 200ammo[playerid] = 200; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
            else if(
strcmp(x_weapon,"shotgun",true) == 0) {   if(!PlayerToPoint(15.0,playerid,149.7532,-287.5675,1.5781)) { SendClientMessage(playeridCOLOR_GREY"   You can sell this gun only at black market !"); return 1; } if(PlayerInfo[playerid][pMats] > 199) { weapon[playerid] = 25price[playerid] = 200ammo[playerid] = 50; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
            
//else if(strcmp(x_weapon,"spas12",true) == 0) { if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 27; price[playerid] = 600; ammo[playerid] = 50; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
            
else if(strcmp(x_weapon,"ak47",true) == 0) { if(!PlayerToPoint(15.0,playerid,149.7532,-287.5675,1.5781)) { SendClientMessage(playeridCOLOR_GREY"   You can sell this gun only at black market !"); return 1; } if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 30price[playerid] = 600ammo[playerid] = 250; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
            else if(
strcmp(x_weapon,"m4",true) == 0) { if(!PlayerToPoint(15.0,playerid,149.7532,-287.5675,1.5781)) { SendClientMessage(playeridCOLOR_GREY"   You can sell this gun only at black market !"); return 1; } if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 31price[playerid] = 600ammo[playerid] = 250; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
            else if(
strcmp(x_weapon,"rifle",true) == 0) { if(!PlayerToPoint(15.0,playerid,149.7532,-287.5675,1.5781)) { SendClientMessage(playeridCOLOR_GREY"   You can sell this gun only at black market !"); return 1; } if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 33price[playerid] = 600ammo[playerid] = 50; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
            else { 
SendClientMessage(playerid,COLOR_GREY,"   Vale relva nimi!"); return 1; }
            if (
ProxDetectorS(5.0playeridgiveplayerid))
            {
                 
/*if(giveplayerid == playerid)
               {
                  SendClientMessage(playerid, COLOR_GRAD1, "   You can not sell Guns to yourself!");
                  return 1;
               }*/
               
if(PlayerInfo[playerid][pMiserPerk] > 0)
               {
                   new 
skill PlayerInfo[playerid][pMiserPerk];
                   new 
mats price[playerid] / 100;
                   
price[playerid] -= (mats)*(skill);
               }
               
//ConsumingMoney[playerid] = 1;
               
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
               
GetPlayerName(playeridsendernamesizeof(sendername));
               
format(stringsizeof(string), "   Sa oled mььnud relva isikule %s, Relv %s  %d Kuuliga, %d Materialide eest."giveplayer,x_weaponammo[playerid], price[playerid]);
               
PlayerPlaySound(playerid10520.00.00.0);
               
SendClientMessage(playeridCOLOR_GRAD1string);
               
format(stringsizeof(string), "   Sulle on auntud relv  %s , kuule %d ,isikult %s."x_weaponammo[playerid], sendername);
               
SendClientMessage(giveplayeridCOLOR_GRAD1string);
               
PlayerPlaySound(giveplayerid10520.00.00.0);
               new 
gunname[100];
               
GetWeaponName(weapon[playerid], gunnamesizeof(gunname));
               
format(stringsizeof(string), "* %s ehitab materialidest %s ja ulatab selle tegelasele %s."sendernamegunname,giveplayer);
               
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
               
SafeGivePlayerWeapon(giveplayerid,weapon[playerid],ammo[playerid]);
               
PlayerInfo[playerid][pMats] -= price[playerid];
            }
            else
            {
               
SendClientMessage(playeridCOLOR_GRAD1"   Sa oled liiga kaugel.");
               return 
1;
            }
         }
         else
         {
            
format(stringsizeof(string), "   %d ei ole aktiivne mдngija."giveplayerid);
            
SendClientMessage(playeridCOLOR_GRAD1string);
         }
      }
      return 
1;
   } 
How do I, so that should not be stamped / valmistarelv Players-id

If the weapon is, I would like to put my hands and not ID or osanimest

But please leave it until the arms are to be recorded as the name

Sorry bad english!