Problem with a tutorial
#1

https://sampforum.blast.hk/showthread.php?tid=305994&page=5


I tried to follow this tutorial, but like all other people in comment, I got a problem when I compile
I got this:


Код:
Base.pwn(66) : warning 204: symbol is assigned a value that is never used: "PInfo"
Base.pwn(65) : warning 203: symbol is never used: "Argent"
Base.pwn(63) : warning 203: symbol is never used: "Password"
Base.pwn(62) : warning 203: symbol is never used: "Username"
Base.pwn(78) : error 035: argument type mismatch (argument 1)
Base.pwn(241) : error 017: undefined symbol "Logindialog"
Base.pwn(245) : error 017: undefined symbol "Regdialog"
Base.pwn(245) : error 017: undefined symbol "NPUT"
Base.pwn(245) : error 029: invalid expression, assumed zero
Base.pwn(245) : fatal error 107: too many error messages on one line
http://pastebin.com/VpfXM0w2
Reply
#2

Add
#define Lodindialog 0
#define Regdialog 1

and in line 245 ,you have by mistakenly added a space between I and NPUT.Just remove it.
It should be DIALOG_STYLE_INPUT or you could use DIALOG_STYLE_PASSWORD(doesn't show the password, shows little white dots)

Could you post the line 78 please.
Reply
#3

Line 78: mysql_query(Query);


Line 302 : format(Query,sizeof(Query),"SELECT * FROM `Users` WHERE `Username` = '%s' AND `Password` = '%s'",GetPName(playerid),EscapedText);



Base.pwn(302) : error 017: undefined symbol "Query"
Base.pwn(302) : error 017: undefined symbol "Query"
Base.pwn(302) : error 029: invalid expression, assumed zero
Base.pwn(302) : fatal error 107: too many error messages on one line




Thank you
Reply
#4

Add new Query[256]; before line 302

Is line 78 fixed??

if(line 78 fixed)
{
//:P Nothing
}
else
{
//Show the complete block of code containing line 78
}
Reply
#5

I got this as warnings/errors:


Код:
test.pwn(51) : warning 204: symbol is assigned a value that is never used: "PInfo"
test.pwn(50) : warning 203: symbol is never used: "Argent"
test.pwn(48) : warning 203: symbol is never used: "Password"
test.pwn(47) : warning 203: symbol is never used: "Username"
test.pwn(63) : error 035: argument type mismatch (argument 1)
test.pwn(226) : error 017: undefined symbol "Logindialog"
test.pwn(237) : warning 217: loose indentation
test.pwn(285) : warning 217: loose indentation
test.pwn(286) : warning 217: loose indentation
test.pwn(286) : error 017: undefined symbol "GetPName"
test.pwn(287) : error 035: argument type mismatch (argument 1)
test.pwn(291) : error 017: undefined symbol "green"
test.pwn(296) : error 017: undefined symbol "red"
test.pwn(311) : error 035: argument type mismatch (argument 1)
test.pwn(314) : error 017: undefined symbol "PInfo"
test.pwn(314) : warning 215: expression has no effect
test.pwn(314) : error 001: expected token: ";", but found "]"
test.pwn(314) : error 029: invalid expression, assumed zero
test.pwn(314) : fatal error 107: too many error messages on one line
Pastbin: http://pastebin.com/0QWEMrfe



Block of line 78: ( now line 63)

Код:
public OnPlayerConnect(playerid) {
	new Query[80],pName[24],string[164];
	GetPlayerName(playerid,pName,24);
	format(Query,sizeof(Query),"SELECT `Username` FROM `Users` WHERE `Username` = '%s' LIMIT 1;",pName);
	mysql_query(Query);
	mysql_store_result();
	if(mysql_num_rows() != 0)//if number of rows is different from 0 then continue
		{
		format(string,sizeof(string),"Hey, %s! \nYour account is registered.\nPlease enter the password to log in!",pName);
		ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Lo g in",string,"Login","");
		}
	else
		{
		format(string,sizeof(string),"Hey, %s! \nYour account is not registered. \nPlease register to continue!",pName);
		ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Re gister",string,"Register","");
		}
	mysql_free_result();
    return true;
}
Reply
#6

Are you sure you are using the right version of the mysql plugin which was given in the tutorial?
And
Код:
#define Logindialog 0 
#define green 0x33AA33FF
#define red 0xAA3333FF
pawn Код:
stock GetPName(playerid)
{
    new str[MAX_PLAYER_NAME]; GetPlayerName(playerid,str,sizeof(str)); return str;
}
And show your PInfo declaration
Reply
#7

Now I have less erros, and no warnings, but still have problems...

Anyone got an idea please ?


http://pastebin.com/FNgLfCaH



test2.pwn(69) : error 017: undefined symbol "dialogid"
test2.pwn(71) : error 017: undefined symbol "inputtext"
test2.pwn(7 : error 017: undefined symbol "inputtext"
test2.pwn(79) : error 017: undefined symbol "GetPName"
test2.pwn(81) : error 035: argument type mismatch (argument 2)
Reply
#8

the problem is you've put some of your code that was supposed to be at OnPlayerDialogResponse at OnPlayerConnect.

Move the right code to the right place.
Reply
#9

It's right, thank you guy =)


but now, an other problem with Query


http://pastebin.com/2HGU5Xmm


test2.pwn(250) : error 017: undefined symbol "Query"
test2.pwn(250) : error 017: undefined symbol "Query"
test2.pwn(250) : error 029: invalid expression, assumed zero
test2.pwn(250) : fatal error 107: too many error messages on one line



Line 250:

format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Money) VALUES ('%s','%s,'0')",GetPName(playerid),EscapedText);






EDIT: I added "new Query[256];" before this line but now I have:

test2.pwn(251) : error 017: undefined symbol "GetPName"
test2.pwn(253) : error 035: argument type mismatch (argument 2)



251: format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Argent) VALUES ('%s','%s,'0')",GetPName(playerid),EscapedText);

253: SendClientMessage(playerid,green,"You have been successfully registered!");
Reply
#10

No more idea for this problem ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)