PDA

View Full Version : Problem With INI


TYDS
30/11/2016, 11:45 AM
Thien.pwn(138) : error 017: undefined symbol "PlayerInfo"
Thien.pwn(139) : error 017: undefined symbol "PlayerInfo"
Thien.pwn(140) : error 017: undefined symbol "PlayerInfo"
Thien.pwn(317) : error 028: invalid subscript (not an array or too many subscripts): "udb_hash"
Thien.pwn(317) : warning 215: expression has no effect
Thien.pwn(317) : error 001: expected token: ";", but found "]"
Thien.pwn(317) : error 029: invalid expression, assumed zero
Thien.pwn(317) : fatal error 107: too many error messages on one line

My Code
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "data");
INI_WriteInt(File, "Tien",GetPlayerMoney(playerid));
INI_WriteInt(File, "Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File, "Diem",PlayerInfo[playerid][pDiem]);
INI_WriteInt(File, "Vip", PlayerInfo[playerid][pVip]);
INI_Close(File);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_DANGKY:
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_DANGKY, DIALOG_STYLE_INPUT,"Dang Ky","Mat Khau Dang Ky Khong Hop Le, Hay Thu Cai Khac!","Dang Ky","Thoat");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "data");
INI_WriteInt(File, "Password",udb_hash[inputtext]);
INI_WriteInt(File, "Tien",0);
INI_WriteInt(File, "Admin",0);
INI_WriteInt(File, "Diem",0);
INI_WriteInt(File, "Vip",0);
INI_Close(File);
}
}
case DIALOG_DANGNHAP:
{
if(!response) return Kick(playerid);
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true,.extra = playerid);
GivePlayerMoney(playerid,PlayerInfo[playerid][pTien]);
SetPlayerScore(playerid,PlayerInfo[playerid][pDiem]);
SendClientMessage(playerid,COLOR_YELLOW,"Dang Nhap Thanh Cong!");
SpawnPlayer(playerid);
TogglePlayerSpectating(playerid, 0);
}
else
{
TogglePlayerSpectating(playerid, 1);
ShowPlayerDialog(playerid,DIALOG_DANGNHAP,DIALOG_S TYLE_PASSWORD,"Dang Nhap","Sai Mat Khau Vui Long Nhap Dung","Dang Nhap","Thoat");
}
}
}
}
return 1;
}
enum pInfo
{
pPass,
pTien,
pAdmin,
pDiem,
pVip
}
new PlayerInfo[MAX_PLAYERS][pInfo];

TYDS
30/11/2016, 12:02 PM
any one ?

SyS
30/11/2016, 12:06 PM
udb_hash(inputtext);
you should use parentheses not square braces
and also udb hash is not safe and therefore it is not used in digital world now as its algorithm can be cracked easily.Use better hashing methods like sha256 .

And about first errors you should check the curly brackets and the order of your code if the usage appeared before declaration and the declaration is globally done.

TYDS
30/11/2016, 12:09 PM
udb_hash(inputtext);
you should use parentheses not square braces
and also udb hash is not safe and therefore it is not used in digital world now as its algorithm can be cracked easily.Use better hashing methods like sha256 .

And about first errors you should check the curly brackets and the order of your code if the usage appeared before declaration and the declaration is globally done.

i am follow this tutorials https://www.youtube.com/watch?v=dymEZTaAS9M

SyS
30/11/2016, 12:12 PM
i am follow this tutorials https://www.youtube.com/watch?v=dymEZTaAS9M

Dont follow it as it is a complete crap.

TYDS
30/11/2016, 12:13 PM
Dont follow it its complete crap.

oh :( so how can i solve this problem

SyS
30/11/2016, 12:16 PM
oh :( so how can i solve this problem

i told you how to fix it...

But one thing if you want to learn Yini there is a tutorial by AndySedeyn which is ,in my opinion, the best out there.

Edit: here is the link http://forum.sa-mp.com/showthread.php?t=597639