24.11.2013, 10:51
pawn Код:
CMD:putbag(playerid, params[])
{
new string[128], idx, done;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, 0x77777777, "[ERROR] You need to login first!");
if(!PlayerInfo[playerid][pBackpack]) return SendClientMessage(playerid, 0x77777777, "[ERROR] You dont have a backpack, buy one from the 24/7.");
if(!GetPlayerWeapon(playerid)) return SendClientMessage(playerid, 0x77777777, "[ERROR] 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)
{
format(string, sizeof(string), ">> %s turns the safety of the %s off as he puts it in his backpack.", GetPlayerNameEx(playerid), GUN(GetPlayerWeapon(playerid)));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
RemovePlayerWeapon(playerid, w[0]);
}
else SendClientMessage(playerid, COLOR_GREY, "You cant store any more guns in your backpack.");
return 1;
}