Jump to content
  • 0

Ajutor /buygun


RayMaX

Question

Problema intalnita (descriere): Am o problema cu gunshop-ul, intru in el dau /buygun si mi zice ca " Nu esti intr-un magazin de arme"
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu):

Spoiler

    if (strcmp(cmd, "/buygun", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerCash(playerid) < 1)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Nu ai suficienti bani!");
                return 1;
            }
            if(PlayerData[playerid][pGunLic] == 0)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Server: Nu ai licenta de arme!");
                return 1;
            }
            new gun;
            new gunid[16];
            new gunstring1[182];
            new gunstring2[182];
            new gunstring3[182];
            new gunstring4[182];
            new infostring[182];
            new guncharge;
            new ammocharge;
            //new location = PlayerData[playerid][pLocal];
            new location;
            if(InBizz[playerid] >= 100)
            {
                location = InBizz[playerid]-100;
            }
            else
            {
                location = InBizz[playerid];
            }
            if(location == 99 || location == 100 || location == 102 || location == 107)
            {
                if(BizzData[location-99][bProducts] <= 0)
                {
                    GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
                    return 1;
                }
                tmp = strtok2(cmdtext, idx);
                if(!strlen(tmp))
                {
                    format(string, sizeof(string), "» Foloseste: /buygun [gunname] [ammoamount]");
                    SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
                    SendClientMessage(playerid, COLOR_WHITE,"=> Guns & Ammo <=");
                    SendClientMessage(playerid, COLOR_GRAD2,string);
                    format(gunstring1, 256, "Weapons: parachute ($1000) baseballbat ($500) shovel ($500)",
                    BizzData[location][bGunPrice]*500/100,BizzData[location][bGunPrice]*200/100,BizzData[location][bGunPrice]*300/100);
                    SendClientMessage(playerid, COLOR_GRAD3, gunstring1);
                    format(gunstring2, 256, "Weapons: purpledildo ($500) whitedildo ($%500) longwhitedildo ($500) whitedildo2 ($500) flowers ($500) cane ($500)",
                    BizzData[location][bGunPrice]*400/100,BizzData[location][bGunPrice]*780/100,BizzData[location][bGunPrice]*560/100,BizzData[location][bGunPrice]*530/100,BizzData[location][bGunPrice]*200/100,BizzData[location][bGunPrice]*600);
                    SendClientMessage(playerid, COLOR_GRAD3, gunstring2);
                    format(gunstring3, 256, "Weapons: sdpistol ($1125) deagle ($1250) mp5 ($1375)",
                    BizzData[location][bGunPrice]*500/100,BizzData[location][bGunPrice]*1000/100,BizzData[location][bGunPrice]*3000/100,BizzData[location][bGunPrice]*2000/100,BizzData[location][bGunPrice]*3000/100,BizzData[location][bGunPrice]*2500);
                    SendClientMessage(playerid, COLOR_GRAD3, gunstring3);
                    format(gunstring4, 256, "Weapons: shotgun ($1500) ak47 ($1500) m4 ($1500) rifle ($1250)",
                    BizzData[location][bGunPrice]*3000/100,BizzData[location][bGunPrice]*6000/100,BizzData[location][bGunPrice]*4000/100,BizzData[location][bGunPrice]*5000/100,BizzData[location][bGunPrice]*5000/100,BizzData[location][bGunPrice]*1000);
                    SendClientMessage(playerid, COLOR_GRAD3, gunstring4);
                    SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
                    return 1;
                }
                strmid(gunid, tmp, 0, strlen(cmdtext), 255);
                tmp = strtok2(cmdtext, idx);
                if(!strlen(tmp))
                {
                    format(string, sizeof(string), "COMANDA: /buygun [gunname] [ammoamount]");
                    return 1;
                }
                new ammo = strvalEx(tmp);
                if(ammo < 1 || ammo > 999) { SendClientMessage(playerid, COLOR_GRAD1, "Munitia nu poate fi mai mic de 1 dar nici mai mare de 999!"); return 1; }
                if (strcmp(gunid, "parachute", true, strlen(gunid)) == 0)
                {
                    gun = 46;
                    guncharge = 1000;
                    ammocharge = 0;
                }
                else if (strcmp(gunid, "baseballbat", true, strlen(gunid)) == 0)
                {
                    gun = 5; guncharge = 500; ammocharge = 0;
                    
                }
                else if (strcmp(gunid, "shovel", true, strlen(gunid)) == 0)
                {
                    gun = 6; guncharge = 500; ammocharge = 0;
                    
                }
                else if (strcmp(gunid, "purpledildo", true, strlen(gunid)) == 0)
                {
                    gun = 10; guncharge = 500; ammocharge = 0;
                    
                }
                else if (strcmp(gunid, "whitedildo", true, strlen(gunid)) == 0)
                {
                    gun = 11; guncharge = 500; ammocharge = 0;
                    
                }
                else if (strcmp(gunid, "longwhitedildo", true, strlen(gunid)) == 0)
                {
                    gun = 12; guncharge = 500; ammocharge = 0;
                    
                }
                else if (strcmp(gunid, "whitedildo2", true, strlen(gunid)) == 0)
                {
                    gun = 13; guncharge = 500; ammocharge = 0;
                    
                }
                else if (strcmp(gunid, "flowers", true, strlen(gunid)) == 0)
                {
                    gun = 14; guncharge = 500; ammocharge = 0;
                    
                }
                else if (strcmp(gunid, "cane", true, strlen(gunid)) == 0)
                {
                    gun = 15; guncharge = 500; ammocharge = 0;
                    
                }
                else if (strcmp(gunid, "sdpistol", true, strlen(gunid)) == 0)
                {
                    gun = 23; guncharge = 1125; ammocharge = BizzData[location][bGunPrice]*25/100*ammo;
                    
                }
                else if (strcmp(gunid, "deagle", true, strlen(gunid)) == 0)
                {
                    gun = 24; guncharge = 1250; ammocharge = BizzData[location][bGunPrice]*25/100*ammo;
                    
                }
                else if (strcmp(gunid, "mp5", true, strlen(gunid)) == 0)
                {
                    gun = 29; guncharge = 1375; ammocharge = BizzData[location][bGunPrice]*25/100*ammo;
                    
                }
                else if (strcmp(gunid, "shotgun", true, strlen(gunid)) == 0)
                {
                    gun = 25; guncharge = 1500; ammocharge = BizzData[location][bGunPrice]*40/100*ammo;
                    
                }
                else if (strcmp(gunid, "ak47", true, strlen(gunid)) == 0)
                {
                    gun = 30; guncharge = 1500; ammocharge = BizzData[location][bGunPrice]*40/100*ammo;
                    
                }
                else if (strcmp(gunid, "m4", true, strlen(gunid)) == 0)
                {
                    gun = 31; guncharge = 1500; ammocharge = BizzData[location][bGunPrice]*40/100*ammo;
                    
                }
                else if (strcmp(gunid, "rifle", true, strlen(gunid)) == 0)
                {
                    gun = 33; guncharge = 1250; ammocharge = BizzData[location][bGunPrice]*50/100*ammo;
                    
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD6, "ShopKeeper {FFFFFF}spune{FFFFFF}: Nu am auzit niciodata de aceasta arma.");
                    return 1;
                }
                if((guncharge+ammocharge) > GetPlayerCash(playerid))
                {
                    format(infostring, 256, "Nu ai $%d !",guncharge+ammocharge);
                    SendClientMessage(playerid, COLOR_GRAD3, infostring);
                    return 1;
                }
                if(GetPlayerCash(playerid) < (guncharge+ammocharge))
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "Can't afford that !");
                    return 1;
                }
                new payout = guncharge + ammocharge;
                format(infostring, 256, "Tocmai ai cumparat un %s cu %d gloante, pentru $%d",gunid,ammo,payout);
                SendClientMessage(playerid, COLOR_GRAD3, infostring);
                if(location == 102 && IsACop(playerid)) { }
                else
                    {
                        GivePlayerCash(playerid, - payout);
                        //hackmoney[playerid] = hackmoney[playerid] - payout;
                        if(payout > 4999 && payout < 50000)
                        {
                            ConsumingMoney[playerid] = 2;
                        }
                        else if(payout > 49999 && payout < 5000000)
                        {
                            ConsumingMoney[playerid] = 3;
                        }
                     }
                BizzData[location][bTill] += payout;
                ExtortionBiz(location-99, payout);
                BizzData[location][bProducts]--;
                PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                GivePlayerWeapon(playerid, gun, ammo);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "%s a cumparat arme pentru $%s la bizul %d", sendername, FormatNumber(payout, 0, '.'), location-99);
                printf("%s", string);
                GunLog(string);
                //UpdateWeapons(playerid);
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE,"Nu esti intr-un magazin de arme.");
                return 1;
            }
        }
        return 1;
    }


Imagini / Video (optional): http://imgur.com/vogaZqT
Ati incercat sa rezolvati singur?:  Da , dar nu-i dau de cap

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Seteaza un interior pentru player, atunci cand intra in gamemode . Gen : PlayerInfo[playerid][pInt] = ceidvreitu; Si , la comanda /buygun adaugi o verificare : 

if(!PlayerInfo[playerid][pInt] == id-ulpusdetine)
		return SendClientMessage(playerid, -1, Nu esti intr-un Gun Shop!");

 

Link to comment
Share on other sites

  • 0

aici este problema ta  

 if(location == 99 || location == 100 || location == 102 || location == 107)
            

De aici iti trimite mesajul acela, pentru ca variabila location nu este 99 100 102 sau 107, 

iar mai sus ai asta

   //new location = PlayerData[playerid][pLocal];
            new location;

inlocuieste cu asta

   new location = PlayerData[playerid][pLocal];
          

iar atunci cand intra in gunshop sa iti seteze plocal 100 102 sau ce mai era acolo

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
8 minutes ago, RayMaX said:

 

Tot la comanda /buygun o adaug? PlayerInfo[playerid][pInt] = ceidvreitu; 

Nu, aia o pui cand intra in bizz player-ul . Dar incearca sa rezolvi ce a zis @Mister mai sus, desi stiu ca si altii s-au confruntat cu aceastra problema, au incercat sa o rezolve in modul ala si nu au reusit .

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.