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)
+--- Thread: Help! (/showthread.php?tid=493300)



Help! - yuvraj201 - 08.02.2014

If i put the gun in my backpack it gives the whole server a gun in their backpack please help!

pawn Код:
CMD:bpput(playerid, params[])
{
    new done, idx;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, rt_col, "You need to login first!");
    if(!PlayerInfo[playerid][pBackpack]) return SendClientMessage(playerid, rt_col, "You dont have a backpack!");
    if(!GetPlayerWeapon(playerid)) return SendClientMessage(playerid, rt_col, "You are not holding a weapon in your hand.");
    new tw[2], w[2];
    for(new g=0; g<13; g++)
    {
        GetPlayerWeaponData(playerid, g, tw[0], tw[1]);
        if(tw[0] == GetPlayerWeapon(playerid))
        {
            w[0] = tw[0];
            w[1] = tw[1];
        }
    }
    if(tw[0] == GetPlayerWeapon(playerid))
    {
        w[0] = tw[0];
        w[1] = tw[1];
    }
    if(!GunInfo[idx][gGun][0])
    {
        GunInfo[idx][gGun][0] = w[0];
        GunInfo[idx][gGunAmmo][0] = w[1];
        done = 1;
    }
    else if(!GunInfo[idx][gGun][1])
    {
        GunInfo[idx][gGun][1] = w[0];
        GunInfo[idx][gGunAmmo][1] = w[1];
        done = 1;
    }
    if(done)
    {
        RemoveWeapon(playerid, w[0]);
    }
    else SendClientMessage(playerid, color_red, "Your backpack is filled already.");
    return 1;
}



Re: Help! - Wizz123 - 08.02.2014

idx dosen't have a meaning from what im seeing, so remove it and put the 'playerid' parameter instead.