08.02.2014, 01:21
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;
}