i screwed up again
#1

i got those errors
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(220) : error 037: invalid string (possibly non-terminated string)
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(220) : error 017: undefined symbol "s"
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(220) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(220) : fatal error 107: too many error messages on one line

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


4 Errors.
and script. btw i made login register system and i tested ban and i though i could unban my self but it doesnt work because "it cannot read from ini file http://prntscr.com/ggmubz
Код:
public LoadUser_data(playerid,name[],value[])
{
	INI_Int("Password",PlayerInfo[playerid][pPass]);
	INI_Int("Cash",PlayerInfo[playerid][pCash]);
	INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
	INI_Int("Score",PlayerInfo[playerid][pScore]);
	INI_Int("Bankmoney",PlayerInfo[playerid][pBankmoney]);
	INI_Int("Banned",PlayerInfo[playerid][pBanned]);
	INI_Int("Org",PlayerInfo[playerid][pOrgID]);
	INI_Int("Rank",PlayerInfo[playerid][pRank]);
	return 1;
}
stock UserPath(playerid)
{
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));                //error here
	new string[128];                                                                           //error here
	format(string,sizeof(string),PATH,playername);
	return string;
}
stock udb_hash(buf[])
{
	new length=strlen(buf);
	new s1 = 1;
	new s2 = 0;
	new n;
	for (n=0; n<length; n++)
	{
	    s1 = (s1 + buf[n]) %65521;
		s2 = (s2 + s1)     %65521;
	}
	return (s2 << 16) + s1;
}
public OnPlayerConnect(playerid)
{
	SendClientMessage(playerid,-1,("[RMT:RP]:Dobrodosli na RMTeam RolePlay!"));
	if(fexist(UserPath(playerid)))
	{
	    INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true,.extra = playerid);
	    if(PlayerInfo[playerid][pBanned] == 1) return Ban(playerid);
	    else
		{
	    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login:","Molimo upisite password dolje.","Login","Izlaz");
	    }
	}
	else
	{
	    ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:","Ovaj profil nije bio registrovan! Molimo upisite password dolje.","Register","Izlaz");
	}

	return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File,"data");
	INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
	INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
	INI_WriteInt(File,"Score",GetPlayerScore(playerid));
	INI_WriteInt(File,"Bankmoney",PlayerInfo[playerid][pBankmoney]);
	INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
	INI_WriteInt(File,"Org",PlayerInfo[playerid][pOrgID]);
	INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
	INI_Close(File);
	return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
	{
	    case DIALOG_REGISTER:
	    {
	        if(!response) return Kick(playerid);
	        if(response)
			{
			    if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:","Password nedostupan! Molimo upisite drugi password.","Register","Izlaz");
				new INI:File = INI_Open(UserPath(playerid));
				INI_SetTag(File,"data");
				INI_WriteInt(File,"Password",udb_hash(inputtext));
				INI_WriteInt(File,"Cash",0);
				INI_WriteInt(File,"Admin",0);
				INI_WriteInt(File,"Score",0);
				INI_WriteInt(File,"Bankmoney",0);
				INI_WriteInt(File,"Banned",0);
				INI_WriteInt(File,"OrgID",-1);
				INI_WriteInt(File,"Rank",0);
				PlayerInfo[playerid][pOrgID] = -1;
				INI_Close(File);
			}
		}
		case DIALOG_LOGIN:
		{
		    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][pCash]);
				    SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
				    SendClientMessage(playerid,-1,"Uspijesno ste se logovali u svoj profil!");
				}
				else
				{
				    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login:","Password netacan! Molimo pokusajte ponovo.","Retry","Quit");
				    }
				}
			}
		}
	return 1;
}
Reply
#2

nonterminated string means you have a missing
Код:
"
in a string on line 220 i couldnt see it in your post tho check it for yourself

also udb_hash is the worst hash you could use. either make your database(your server files in this case because its ini) unreachable outside of 127.0.0.1 and dont use a hash at all(i dont recommend this). or start using something like whirlpool if you cant make another hash

also if you can post your codeblock of line 220 here i can have a look at it.
Reply
#3

Quote:
Originally Posted by grymtn
Посмотреть сообщение
nonterminated string means you have a missing
Код:
"
in a string on line 220 i couldnt see it in your post tho check it for yourself

also udb_hash is the worst hash you could use. either make your database(your server files in this case because its ini) unreachable outside of 127.0.0.1 and dont use a hash at all(i dont recommend this). or start using something like whirlpool if you cant make another hash

also if you can post your codeblock of line 220 here i can have a look at it.
i commented error here on line 220 its string line almost on top of script
Reply
#4

where you wrote error here shouldnt have any error if you want try changing sizeof(playername) to 24 which would mean same but give it a try. where you wrote error here doesnt even have a string so it cant be unterminated. also you cant load your file because where do you load it from exactly?
Код:
public LoadUser_data(playerid,name[],value[])
{
	INI_Int("Password",PlayerInfo[playerid][pPass]);
	INI_Int("Cash",PlayerInfo[playerid][pCash]);
	INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
	INI_Int("Score",PlayerInfo[playerid][pScore]);
	INI_Int("Bankmoney",PlayerInfo[playerid][pBankmoney]);
	INI_Int("Banned",PlayerInfo[playerid][pBanned]);
	INI_Int("Org",PlayerInfo[playerid][pOrgID]);
	INI_Int("Rank",PlayerInfo[playerid][pRank]);
	return 1;
}
i dont see any path to load from here
Reply
#5

i load it from path accounts
[CODE]
#define PATH "/Accounts/%s.ini
[\CODE]
Reply
#6

but you didnt use define any path to load from in loadUser_data and your predefined variables
Код:
playerid,name[],value[]
does not carry any path info. see when you are saving
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid)); //right here
	INI_SetTag(File,"data");
	INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
	INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
	INI_WriteInt(File,"Score",GetPlayerScore(playerid));
	INI_WriteInt(File,"Bankmoney",PlayerInfo[playerid][pBankmoney]);
	INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
	INI_WriteInt(File,"Org",PlayerInfo[playerid][pOrgID]);
	INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
	INI_Close(File);
	return 1;
}
you are using a path to save file to but you dont use a path to load from in your loadUser_data
Reply
#7

so can someone write how its supposted to look like. i dont have much time left
Reply
#8

you have a iniparse file in your on player connect. first of all you can put it in the directory of loaduser_data

also you probably have used this tutorial https://sampforum.blast.hk/showthread.php?tid=273088. which is not newbie friendly in ways of collecting stuff together. if you are not good with how they actually work you cant collect those codes together easily its a try and learn tutorial.

-----EDIT---- sorry my bad theres a get name in UserPath stock
Reply
#9

Im confused just type code id apreciate it very much
Reply
#10

Quote:
Originally Posted by n00blek
Посмотреть сообщение
Im confused just type code id apreciate it very much
This is so unrespectful
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)