Weapon Package System
#1

pawn Код:
CMD:createpackage(playerid, params[])
{
    if(PlayerInfo[playerid][pJob] !=2)
        return 0;
    new
        wep[128],
        ammo
    ;
    if(sscanf(params,"s[128]i",wep,ammo))
        return SendClientMessage(playerid,C_NICE,"[Usage] {FFFFFF}/createpackage [weapon] [ammo]");
    /*if(!IsPlayerInRangeOfPoint(playerid,3.0,0,0,0))
        return 0;*/

    if(ammo > 20)
        return SendClientMessage(playerid,C_RED,"Maximum ammo in package: 2000 (x*100)");
    if(equal(wep,"deagle",true))
    {
       if(AC_GetPlayerMoney(playerid) < DEAGLE_100*ammo) return SendClientMessage(playerid,C_RED,"You don't have enough money.");
       ForLoop(i,12)
       {
           if(PlayerInfo[playerid][pWPack][i] == 0)
           {
                PlayerInfo[playerid][pWPack][i] = DEAGLE;
                PlayerInfo[playerid][pWPackA][i] = ammo*100;
            }
       }
    }
    if(equal(wep,"mp5",true))
    {
       if(AC_GetPlayerMoney(playerid) < DEAGLE_100*ammo) return SendClientMessage(playerid,C_RED,"You don't have enough money.");
       ForLoop(i,12)
       {
           if(PlayerInfo[playerid][pWPack][i] == 0)
           {
                PlayerInfo[playerid][pWPack][i] = MP5;
                PlayerInfo[playerid][pWPackA][i] = ammo*100;
                SendFormat(playerid,C_NICE,"[Packages] {FFFFFF}You have bought %i magazines of 100 bullets [Package Slot: %i, Weapon: %s]",ammo,i,wep);
           }
       }
    }
    return 1;
}
I was trying to do that if the script finds an occupied package, it goes over to the other one, if the second one is occupied, it will go to the third, and etcetera.. the thing is that when I type the command it instantly sets all of the packages to ammo*100 (with the correct weapon.)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)