for(new w = 0; w < 13; w++)
{
new id = PlayerWeapons[playerid][w];
printf("WeaponID: %d", id);
if(WepAmmo[id] > 0)
{
GivePlayerWeapon(playerid,WepModel[id],WepAmmo[id]);
printf("Weapon: %d, Ammo: %d", WepModel[id], WepAmmo[id]);
}
}
for(new w=0; w < 13; w++)
{
new string[12];
format(string, sizeof(string), "Weapon%d", w);
mysql_get_field(string, QueryString);
PlayerWeapons[playerid][w] = strval(QueryString);
}
pawn Код:
|
printf("Weapon: %d, Ammo: %d", WepModel[id], WepAmmo[id]);
//and
printf("WeaponID: %d", id);
[18:49:43] Weapon: 22, Ammo: 250
[18:49:43] WeaponID: 0
[18:49:43] Weapon: 22, Ammo: 250
[18:49:43] WeaponID: 1
[18:49:43] WeaponID: 0
[18:49:43] Weapon: 22, Ammo: 250
[18:49:43] WeaponID: 0
[18:49:43] Weapon: 22, Ammo: 250
[18:49:43] WeaponID: 0
[18:49:43] Weapon: 22, Ammo: 250
[18:49:43] WeaponID: 0
[18:49:43] Weapon: 22, Ammo: 250
[18:49:43] WeaponID: 0
[18:49:43] Weapon: 22, Ammo: 250
[18:49:43] WeaponID: 0
[18:49:43] Weapon: 22, Ammo: 250
[18:49:43] WeaponID: 0
[18:49:43] Weapon: 22, Ammo: 250
[18:49:43] WeaponID: 0
[18:49:44] Weapon: 22, Ammo: 250
[18:49:44] WeaponID: 0
[18:49:44] Weapon: 22, Ammo: 250
[18:49:44] WeaponID: 0
[18:49:44] Weapon: 22, Ammo: 250
for(new w=0; w < 13; w++)
{
new string[12];
format(string, sizeof(string), "Weapon%d", w);
mysql_get_field(string, QueryString);
PlayerWeapons[playerid][w] = strval(QueryString); //this should be weapon id
format(string, sizeof(string), "Ammo%d", w);
mysql_get_field(string, QueryString);
PlayerAmmo[playerid][w] = strval(QueryString);
}
// And give weapon to player.
for(new w = 0; w < 13; w++)
{
if(PlayerAmmo[playerid][w] > 0)
{
GivePlayerWeapon(playerid,PlayerWeapons[playerid][w],PlayerAmmo[playerid][w]);
}// this would work.