error 035: argument type mismatch (argument 1)/(argument 2) -
DavidGravelli - 08.03.2019
pawn Code:
(7506) : error 035: argument type mismatch (argument 1)
(7506) : error 035: argument type mismatch (argument 2)
(7528) : error 035: argument type mismatch (argument 1)
(7528) : error 035: argument type mismatch (argument 2)
Here is the functions
pawn Code:
stock SaveWeapons(playerid)
{
new str[220];
(7506) mysql_format(str, sizeof(str), "SELECT * FROM `player_weapons` WHERE `nick` = '%s'", NameL(playerid));
mysql_query(mysqlHandle, str, true);
if(!cache_num_rows())
{
mysql_format(mysqlHandle, str, sizeof(str), "INSERT INTO `player_weapons` (`nick`, `trouser_w`, `trouser_a`, `jacket_w`, `jacket_a`, `hand_w`, `hand_a` \
VALUES ('%s', '%d', '%d', '%d', '%d', '%d', '%d')", NameL(playerid), GunInfo[playerid][gGun][0], GunInfo[playerid][gGunAmmo][0], \
GunInfo[playerid][gGun][1], GunInfo[playerid][gGunAmmo][1], GetPlayerWeapon(playerid), GetPlayerAmmo(playerid));
mysql_query(mysqlHandle, str, false);
}
else
{
mysql_format(mysqlHandle, str, sizeof(str),"UPDATE `player_weapons` SET `trouser_w` = %d, `trouser_a` = '%d', `jacket_w` = %d, `jacket_a` = %d, \
`hand_w` = %d, `hand_a` = %d WHERE `nick` = '%s'", GunInfo[playerid][gGun][0], GunInfo[playerid][gGunAmmo][0], \
GunInfo[playerid][gGun][1], GunInfo[playerid][gGunAmmo][1], GetPlayerWeapon(playerid), GetPlayerAmmo(playerid), NameL(playerid));
mysql_query(mysqlHandle, str, false);
}
return 1;
}
stock LoadWeapons(playerid)
{
new str[220];
(7528) mysql_format(str, sizeof(str), "SELECT * FROM `player_weapons` WHERE `nick` = '%s'", NameL(playerid));
mysql_query(mysqlHandle, str, true);
if(!cache_num_rows()) return 1;
cache_get_value_int(0, "trouser_w", GunInfo[playerid][gGun][0]);
cache_get_value_int(0, "trouser_a", GunInfo[playerid][gGunAmmo][0]);
cache_get_value_int(0, "jacket_w", GunInfo[playerid][gGun][1]);
cache_get_value_int(0, "jacket_a", GunInfo[playerid][gGunAmmo][1]);
new weap, ammo;
cache_get_value_int(0, "hand_w", weap);
cache_get_value_int(0, "hand_a", ammo);
GivePlayerWeapon(playerid, weap, ammo);
return 1;
}
Re: error 035: argument type mismatch (argument 1)/(argument 2) -
TheToretto - 08.03.2019
Add mysqlHandle before giving the destination string, you did it correct in some lines such as the else statement.
Re: error 035: argument type mismatch (argument 1)/(argument 2) -
DavidGravelli - 08.03.2019
Thanks, so this will work without any bugs?
pawn Code:
stock SaveWeapons(playerid)
{
new str[128];
mysql_format(mysqlHandle, str, sizeof(str), "SELECT * FROM `player_weapons` WHERE `nick` = '%s'", NameL(playerid));
mysql_query(mysqlHandle, str, true);
if(!cache_num_rows())
{
mysql_format(mysqlHandle, str, sizeof(str), "INSERT INTO `player_weapons` (`nick`, `trouser_w`, `trouser_a`, `jacket_w`, `jacket_a`, `hand_w`, `hand_a` \
VALUES ('%s', '%d', '%d', '%d', '%d', '%d', '%d')", NameL(playerid), GunInfo[playerid][gGun][0], GunInfo[playerid][gGunAmmo][0], \
GunInfo[playerid][gGun][1], GunInfo[playerid][gGunAmmo][1], GetPlayerWeapon(playerid), GetPlayerAmmo(playerid));
mysql_query(mysqlHandle, str, false);
}
else
{
mysql_format(mysqlHandle, str, sizeof(str),"UPDATE `player_weapons` SET `trouser_w` = %d, `trouser_a` = '%d', `jacket_w` = %d, `jacket_a` = %d, \
`hand_w` = %d, `hand_a` = %d WHERE `nick` = '%s'", GunInfo[playerid][gGun][0], GunInfo[playerid][gGunAmmo][0], \
GunInfo[playerid][gGun][1], GunInfo[playerid][gGunAmmo][1], GetPlayerWeapon(playerid), GetPlayerAmmo(playerid), NameL(playerid));
mysql_query(mysqlHandle, str, false);
}
return 1;
}
stock LoadWeapons(playerid)
{
new str[128];
mysql_format(mysqlHandle, str, sizeof(str), "SELECT * FROM `player_weapons` WHERE `nick` = '%s'", NameL(playerid));
mysql_query(mysqlHandle, str, true);
if(!cache_num_rows()) return 1;
cache_get_value_int(0, "trouser_w", GunInfo[playerid][gGun][0]);
cache_get_value_int(0, "trouser_a", GunInfo[playerid][gGunAmmo][0]);
cache_get_value_int(0, "jacket_w", GunInfo[playerid][gGun][1]);
cache_get_value_int(0, "jacket_a", GunInfo[playerid][gGunAmmo][1]);
new weap, ammo;
cache_get_value_int(0, "hand_w", weap);
cache_get_value_int(0, "hand_a", ammo);
GivePlayerWeapon(playerid, weap, ammo);
return 1;
}
Re: error 035: argument type mismatch (argument 1)/(argument 2) -
TheToretto - 08.03.2019
Yes it should.