06.10.2013, 11:41
When i deposit the gun it spams the chat that i deposited the gun but its still in my hand and it fills all the slots with the gun i deposited so i have that gun in each slot and i can withdraw it from each slot.. Whats wrong?
pawn Код:
CMD:sdeposit(playerid, params[])
{
new string[128], option[32], done, amount;
new idx = 1;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsPlayerInRangeOfPoint(playerid, 2, 2274.7395,-1696.7655,13.6408)) return SendClientMessage(playerid, COLOR_GREY, "You are not at the safe depot.");
if(sscanf(params, "s[32]", option))
{
if(sscanf(params, "i", option, amount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /sdeposit [weapon] [slot]");
if(amount < 1 || amount > 5) return SendClientMessage(playerid, COLOR_GREY, "Weapon slots are between 1 and 5.");
amount += amount;
format(string, sizeof(string), "WeaponSafe: Weapon 1: %s (%d Ammo) | Weapon 2: %s (%d Ammo) | Weapon 3: %s (%d Ammo)", RWN(SafeInfo[idx][sGun][0]), SafeInfo[idx][sGunAmmo][0], RWN(SafeInfo[idx][sGun][1]), SafeInfo[idx][sGunAmmo][1], RWN(SafeInfo[idx][sGun][2]), SafeInfo[idx][sGunAmmo][2]);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), "WeaponSafe: Weapon 4: %s (%d Ammo) | Weapon 5: %s (%d Ammo)", RWN(SafeInfo[idx][sGun][3]), SafeInfo[idx][sGunAmmo][3], RWN(SafeInfo[idx][sGun][4]), SafeInfo[idx][sGunAmmo][4]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
else if(!strcmp(option, "weapon", true, 4))
{
if(!GetPlayerWeapon(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not holding a weapon in your hand.");
new tw[2], w[2];
for(new i=0; i<13; i++)
{
GetPlayerWeaponData(playerid, i, tw[0], tw[1]);
if(tw[0] == GetPlayerWeapon(playerid))
{
w[0] = tw[0];
w[1] = tw[1];
}
if(!SafeInfo[idx][sGun][0])
{
SafeInfo[idx][sGun][0] = w[0];
SafeInfo[idx][sGunAmmo][0] = w[1];
done = 1;
}
else if(!SafeInfo[idx][sGun][1])
{
SafeInfo[idx][sGun][1] = w[0];
SafeInfo[idx][sGunAmmo][1] = w[1];
done = 1;
}
else if(!SafeInfo[idx][sGun][2])
{
SafeInfo[idx][sGun][2] = w[0];
SafeInfo[idx][sGunAmmo][2] = w[1];
done = 1;
}
else if(!SafeInfo[idx][sGun][3])
{
SafeInfo[idx][sGun][3] = w[0];
SafeInfo[idx][sGunAmmo][3] = w[1];
done = 1;
}
else if(!SafeInfo[idx][sGun][4])
{
SafeInfo[idx][sGun][4] = w[0];
SafeInfo[idx][sGunAmmo][4] = w[1];
done = 1;
}
if(done)
{
format(string, sizeof(string), "You have placed a %s in your safe.", RWN(GetPlayerWeapon(playerid)));
SendClientMessage(playerid, COLOR_WHITE, string);
RemoveWizzaWeapon(playerid, w[0]);
}
else SendClientMessage(playerid, COLOR_GREY, "You cant place enymore guns in your safe.");
}
}
return 1;
}