MySQL Error Help :(
#1

Hello I was working on a login system of my new GM which is MySQL Based. I followed tutorials on Forums to create a base login system to test if the way I am coding is correct. Now the problem is, that its giving me error on a weird line. I tried all possible things to prevent the error like writing same code in different ways but nothing worked. so I request some help. Thanks.


errors:
Код:
 S:\SAMP Stuff\ gamemodes\new.pwn(258) : error 029: invalid expression, assumed zero
S:\SAMP Stuff\ gamemodes\new.pwn(258) : warning 217: loose indentation
S:\SAMP Stuff\ gamemodes\new.pwn(258) : error 029: invalid expression, assumed zero
S:\SAMP Stuff\ gamemodes\new.pwn(258) : error 029: invalid expression, assumed zero
S:\SAMP Stuff\ gamemodes\new.pwn(258) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Code:
Код:
public OnPlayerDataLoaded(playerid)
{
	new rows,fields,row_count,field_count;
	row_count = cache_get_row_count(rows);
	field_count = cache_get_field_count(fields);
	if(!row_count)
    { //Line 258 here the error points.
        ShowPlayerDialog(playerid, Dialog_NoAcct, DIALOG_STYLE_MSGBOX, "Not Registerd on UCP, register there first.", "ok","");
		Kick(playerid);
	}
    else
    {
        cache_get_field_content(0, "Pass", PlayerInfo[playerid][pPass], DBConnect, 1024);
        PlayerInfo[playerid][pID] = cache_get_field_content_int(0, "ID");
        ShowPlayerDialog(playerid, Dialog_Login, DIALOG_STYLE_INPUT, "login", "enter password to login", "login", "quit");
    }
	return 1;
}
Reply
#2

Quote:
Originally Posted by GeorgeMcReary
Посмотреть сообщение
Hello I was working on a login system of my new GM which is MySQL Based. I followed tutorials on Forums to create a base login system to test if the way I am coding is correct. Now the problem is, that its giving me error on a weird line. I tried all possible things to prevent the error like writing same code in different ways but nothing worked. so I request some help. Thanks.


errors:
Код:
 S:\SAMP Stuff\ gamemodes\new.pwn(258) : error 029: invalid expression, assumed zero
S:\SAMP Stuff\ gamemodes\new.pwn(258) : warning 217: loose indentation
S:\SAMP Stuff\ gamemodes\new.pwn(258) : error 029: invalid expression, assumed zero
S:\SAMP Stuff\ gamemodes\new.pwn(258) : error 029: invalid expression, assumed zero
S:\SAMP Stuff\ gamemodes\new.pwn(258) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Code:
Код:
public OnPlayerDataLoaded(playerid)
{
	new rows,fields,row_count,field_count;
	row_count = cache_get_row_count(rows);
	field_count = cache_get_field_count(fields);
	if(!row_count)
    { //Line 258 here the error points.
        ShowPlayerDialog(playerid, Dialog_NoAcct, DIALOG_STYLE_MSGBOX, "Not Registerd on UCP, register there first.", "ok","");
		Kick(playerid);
	}
    else
    {
        cache_get_field_content(0, "Pass", PlayerInfo[playerid][pPass], DBConnect, 1024);
        PlayerInfo[playerid][pID] = cache_get_field_content_int(0, "ID");
        ShowPlayerDialog(playerid, Dialog_Login, DIALOG_STYLE_INPUT, "login", "enter password to login", "login", "quit");
    }
	return 1;
}
show this please
PHP код:
cache_get_row_count(rows); 
Reply
#3

PHP код:
public OnPlayerDataLoaded(playerid)
{
    new 
fields,row_count,field_count;
    
row_count cache_get_row_count();
    
field_count cache_get_field_count(fields);
    if(!
row_count)
    { 
//Line 258 here the error points.
        
ShowPlayerDialog(playeridDialog_NoAcctDIALOG_STYLE_MSGBOX"Not Registerd on UCP, register there first.""ok","");
        
Kick(playerid);
    }
    else
    {
        
cache_get_field_content(0"Pass"PlayerInfo[playerid][pPass], DBConnect1024);
        
PlayerInfo[playerid][pID] = cache_get_field_content_int(0"ID");
        
ShowPlayerDialog(playeridDialog_LoginDIALOG_STYLE_INPUT"login""enter password to login""login""quit");
    }
    return 
1;

Reply
#4

Nope doesnt work
Reply
#5

Any Help?
Reply
#6

Here you have:
PHP код:
public OnPlayerDataLoaded(playerid)
{
    if(!
cache_get_row_count(DBConnect))
    {
        
ShowPlayerDialog(playeridDialog_NoAcctDIALOG_STYLE_MSGBOX"Not Registerd on UCP, register there first.""ok","");
        
Kick(playerid);
    }
    else
    {
        
cache_get_field_content(0"Pass"PlayerInfo[playerid][pPass], DBConnect1024); // Why 1024 characters?!
        
PlayerInfo[playerid][pID] = cache_get_field_content_int(0"ID"DBConnect);
        
ShowPlayerDialog(playeridDialog_LoginDIALOG_STYLE_INPUT"login""enter password to login""login""quit");
    }
    return 
1;

You should update to the latest version by the way, those functions are from the R33 one. In case of you update your plugin the callback would look like this:
PHP код:
public OnPlayerDataLoaded(playerid)
{
    new 
rows;
    if(
cache_get_row_count(rows))
    {
        if(!
rows)
        {
            
ShowPlayerDialog(playeridDialog_NoAcctDIALOG_STYLE_MSGBOX"Not Registerd on UCP, register there first.""ok","");
            
Kick(playerid);
        }
        else
        {
            
cache_get_value_name(0"Pass"PlayerInfo[playerid][pPass], 1024); // Why 1024 characters?!
            
cache_get_value_name_int(0"ID"PlayerInfo[playerid][pID]);
            
ShowPlayerDialog(playeridDialog_LoginDIALOG_STYLE_INPUT"login""enter password to login""login""quit");
        }
    }
    return 
1;

You might follow the next tutorial in order to update your MySQL plugin: https://sampforum.blast.hk/showthread.php?tid=644891
Reply
#7

Thanks for the help but there are few more errors.

Код:
S:\SAMP Stuff\gamemodes\new.pwn(252) : error 001: expected token: "-identifier-", but found " "
S:\SAMP Stuff\gamemodes\new.pwn(256) : error 010: invalid function or declaration
S:\SAMP Stuff\gamemodes\new.pwn(268) : error 010: invalid function or declaration
S:\SAMP Stuff\gamemodes\new.pwn(274) : error 001: expected token: "-identifier-", but found " "
S:\SAMP Stuff\gamemodes\new.pwn(285) : error 010: invalid function or declaration
S:\SAMP Stuff\gamemodes\new.pwn(288) : error 010: invalid function or declaration
S:\SAMP Stuff\gamemodes\new.pwn(290) : error 010: invalid function or declaration
S:\SAMP Stuff\gamemodes\new.pwn(340) : warning 217: loose indentation
S:\SAMP Stuff\gamemodes\new.pwn(361) : error 001: expected token: "-identifier-", but found " "
S:\SAMP Stuff\gamemodes\new.pwn(530) : error 001: expected token: "-identifier-", but found " "
S:\SAMP Stuff\gamemodes\new.pwn(540) : error 010: invalid function or declaration

10 Errors.
Here are the code with errors:

Код:
public OnPlayerDataLoaded(playerid) //Line 252
{
    new rows;

    if(cache_get_row_count(rows)) //Line 256
    {
        if(!rows)
        {
            ShowPlayerDialog(playerid, Dialog_NoAcct, DIALOG_STYLE_MSGBOX, "Not Registerd on UCP, register there first.", "ok","");
            Kick(playerid);
        }
        else
        {
            cache_get_value_name(0, "Pass", PlayerInfo[playerid][pPass], 1024); // Why 1024 characters?!
            cache_get_value_name_int(0, "ID", PlayerInfo[playerid][pID]);

            ShowPlayerDialog(playerid, Dialog_Login, DIALOG_STYLE_INPUT, "login", "enter password to login", "login", "quit"); //Line 268
        }
    }
    return 1;
}
Код:
public OnAccountLoaded(playerid) //Line 274
{
    PlayerInfo[playerid][pLevel] = cache_get_field_content_int(0, "Level");
    PlayerInfo[playerid][pCash] = cache_get_field_content_int(0, "Cash");
	PlayerInfo[playerid][pBank] = cache_get_field_content_int(0, "Bank");
	PlayerInfo[playerid][pPlayingHours] = cache_get_field_content_int(0, "Playing Hours");
	PlayerInfo[playerid][pRepPoints] = cache_get_field_content_int(0, "Respect points");
	PlayerInfo[playerid][pGender] = cache_get_field_content_int(0, "Gender");
	PlayerInfo[playerid][pAge] = cache_get_field_content_int(0, "Age");
    TogglePlayerSpectating(playerid, false);

    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); //Line 285

//    SetSpawnInfo(playerid, 0, 23, Player[playerid][posX], Player[playerid][posY], Player[playerid][posZ], Player[playerid][posA], 0, 0, 0, 0, 0, 0);
    SpawnPlayer(playerid); //Line 288

    SendClientMessage(playerid, -1, "You have successfully logged in."); //Line 290
    return true;
}
Код:
public OnPlayerDisconnect(playerid, reason) //Line 361
{
    new
        query[128],
        //Float:pos[4];
        
    //GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    //GetPlayerFacingAngle(playerid, pos[3]);
    
    mysql_format(mysql, query, sizeof(query), "UPDATE `accounts` SET `Level` = %d, `Money` = %d, `Bank` = %d, `Playing Hours` = %d, `Respect Points` = %d WHERE `ID` = %d",
    PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pCash], PlayerInfo[playerid][pBank], PlayerInfo[playerid][pPlayingHours], PlayerInfo[playerid][pRepPoints], PlayerInfo[playerid][pID]);
    mysql_tquery(DBConnect, query, "", "");
    return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) //Line 530
Код:
GetPlayerName(playerid, playername, sizeof(playername)); //Line 540
IDK whats wrong. please help.
Reply
#8

I still need help!!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)