SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/03/2019, 11:24 AM   #1
DavidGravelli
Huge Clucker
 
DavidGravelli's Avatar
 
Join Date: May 2014
Location: Belgium
Posts: 262
Reputation: 36
Default error 035: argument type mismatch (argument 1)/(argument 2)

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;
}
DavidGravelli is offline   Reply With Quote
Old 08/03/2019, 11:28 AM   #2
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 584
Reputation: 66
Default Re: error 035: argument type mismatch (argument 1)/(argument 2)

Add mysqlHandle before giving the destination string, you did it correct in some lines such as the else statement.
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 08/03/2019, 11:35 AM   #3
DavidGravelli
Huge Clucker
 
DavidGravelli's Avatar
 
Join Date: May 2014
Location: Belgium
Posts: 262
Reputation: 36
Default Re: error 035: argument type mismatch (argument 1)/(argument 2)

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;
}
DavidGravelli is offline   Reply With Quote
Old 08/03/2019, 11:42 AM   #4
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 584
Reputation: 66
Default Re: error 035: argument type mismatch (argument 1)/(argument 2)

Yes it should.
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assistance Needed | error 035: argument type mismatch (argument 2) KevTheJoker Scripting Help 4 14/01/2019 09:29 PM
D:\server\gamemodes\ExtremeGame.pwn(22326) : error 035: argument type mismatch (argument 2) enzulikeS Scripting Help 2 25/04/2018 03:38 PM
C:\Users\Lirbo\Desktop\Roleplay\gamemodes\ERP.pwn( 19) : error 035: argument type mismatch (argument 1) Lirbo Scripting Help 2 12/12/2014 02:51 PM
error 35: Argument Type Mismatch (argument 2) Forbidden Name System Stoyanov Scripting Help 2 01/11/2014 08:50 PM
error 035: argument type mismatch (argument 2) [Using MySQL R7/R8 With Cache] viveka27 Scripting Help 1 21/05/2013 03:31 PM


All times are GMT. The time now is 10:44 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.