SA-MP Forums Archive
Error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error (/showthread.php?tid=470743)



Error - yvoms - 19.10.2013

getting 2 errors :
Код:
C:\Documents and Settings\Administrator\桌面\FCRP.pwn(236) : warning 217: loose indentation
C:\Documents and Settings\Administrator\桌面\FCRP.pwn(248) : error 035: argument type mismatch (argument 3)
C:\Documents and Settings\Administrator\桌面\FCRP.pwn(273) : warning 217: loose indentation
C:\Documents and Settings\Administrator\桌面\FCRP.pwn(280) : warning 217: loose indentation
C:\Documents and Settings\Administrator\桌面\FCRP.pwn(285) : error 035: argument type mismatch (argument 3)
C:\Documents and Settings\Administrator\桌面\FCRP.pwn(287) : warning 217: loose indentation
C:\Documents and Settings\Administrator\桌面\FCRP.pwn(481) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Код:
public OnPlayerConnect(playerid)
{
mysql_format(1, query, "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 0,1", GetName(playerid));
mysql_function_query(1, query, true, "CheckPlayer", "i", playerid);
return 1;
}

// Kijkt of iemand in de database staat Vervolgens inloggen of registreren
forward CheckPlayer(playerid);
public CheckPlayer(playerid)
{
new rows, fields, string[128];
cache_get_data(rows, fields);
if(!rows)
{
format(string, sizeof(string), "{FFFFFF}Welcome {A3FF00}%s{FFFFFF} on my server. Input your password and register account.", GetName(playerid));
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_PASSWORD, "Registration", string, "Registration", "Quit");
        }
        else
        {
new temp[12];
cache_get_row(0, 1, temp); PlayerInfo[playerid][pSQLid] = strval(temp);
cache_get_row(0, 2, PlayerInfo[playerid][pPass]);
cache_get_row(0, 3, temp); PlayerInfo[playerid][pMoney] = strval(temp);
format(string, sizeof(string), "{FFFFFF}Welcome back {A3FF00}%s{FFFFFF}, your account is ready for use. Input your password and login.", GetName(playerid)); 
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Quit");
        }
        return 1;
}
//Maakt een row aan met account info en zet die vervolgens in de database
forward OnAccountCreate(playerid);
public OnAccountCreate(playerid)
{
    PlayerInfo[playerid][pSQLid] = mysql_insert_id();
        return 1;
}
	//als iemand disconnect Shit opslaan in de database
	public OnPlayerDisconnect(playerid, reason)
{
mysql_format(1, query, "UPDATE `players` SET `Money` = '%d' WHERE `Name` = '%e' LIMIT 1", GetPlayerMoney(playerid), GetName(playerid)); 
mysql_function_query(1, query, false, "", "");
        return 1;
}
I do not understand the errors
But they are on the following lines;
Код:
mysql_format(1, query, "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 0,1", GetName(playerid));
mysql_format(1, query, "UPDATE `players` SET `Money` = '%d' WHERE `Name` = '%e' LIMIT 1", GetPlayerMoney(playerid), GetName(playerid));



Re: Error - Patrick - 19.10.2013

Fuck, your indentation is horrible and I hope you do have MySQL Experience the one you just did is totally WRONG not in MySQL but in your CALLBACKS

Fixed
pawn Код:
public OnPlayerConnect(playerid)
{
    mysql_format(1, query, "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 0,1", GetName(playerid));
    mysql_function_query(1, query, true, "CheckPlayer", "i", playerid);
    return 1;
}

// Kijkt of iemand in de database staat Vervolgens inloggen of registreren
forward CheckPlayer(playerid);
public CheckPlayer(playerid)
{
    new rows, fields, string[128];
    cache_get_data(rows, fields);
    if(!rows)
    {
        format(string, sizeof(string), "{FFFFFF}Welcome {A3FF00}%s{FFFFFF} on my server. Input your password and register account.", GetName(playerid));
        ShowPlayerDialog(playerid, 0, DIALOG_STYLE_PASSWORD, "Registration", string, "Registration", "Quit");
    }
    else
    {
        new temp[12];
        cache_get_row(0, 1, temp); PlayerInfo[playerid][pSQLid] = strval(temp);
        cache_get_row(0, 2, PlayerInfo[playerid][pPass]);
        cache_get_row(0, 3, temp); PlayerInfo[playerid][pMoney] = strval(temp);
        format(string, sizeof(string), "{FFFFFF}Welcome back {A3FF00}%s{FFFFFF}, your account is ready for use. Input your password and login.", GetName(playerid)); //<---one here
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Quit");
    }
    return 1;
}

//Maakt een row aan met account info en zet die vervolgens in de database
forward OnAccountCreate(playerid);
public OnAccountCreate(playerid)
{
    PlayerInfo[playerid][pSQLid] = mysql_insert_id();
    return 1;
}

//als iemand disconnect Shit opslaan in de database
public OnPlayerDisconnect(playerid, reason)
{
    mysql_format(1, query, "UPDATE `players` SET `Money` = '%d' WHERE `Name` = '%e' LIMIT 1", GetPlayerMoney(playerid), GetName(playerid)); //<-- one error here
    mysql_function_query(1, query, false, "", "");
    return 1;
}



Re: Error - yvoms - 19.10.2013

Fixed that already but still getting
Код:
C:\Documents and Settings\Administrator\桌面\FCRP.pwn(248) : error 035: argument type mismatch (argument 3)
C:\Documents and Settings\Administrator\桌面\FCRP.pwn(287) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664
Anyone any idea on how to fix those?


Re: Error - Konstantinos - 19.10.2013

And the code from those lines is?


Re: Error - yvoms - 19.10.2013

Код:
mysql_format(1, query, "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 0,1", GetName(playerid));
mysql_format(1, query, "UPDATE `players` SET `Money` = '%d' WHERE `Name` = '%e' LIMIT 1", GetPlayerMoney(playerid), GetName(playerid));



Re: Error - Konstantinos - 19.10.2013

The lenght was missing.
pawn Код:
mysql_format(1, query, sizeof(query), "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 0,1", GetName(playerid));
mysql_format(1, query, sizeof(query), "UPDATE `players` SET `Money` = '%d' WHERE `Name` = '%e' LIMIT 1", GetPlayerMoney(playerid), GetName(playerid));