SA-MP Forums Archive
Problem with RegisterSystem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with RegisterSystem (/showthread.php?tid=177445)



Problem with RegisterSystem - Kwarde - 18.09.2010

Hi everyone!
I am making a script, and I have a usersystem, but it isn't really working. Well, you can register and login (no bugs ) but he isn't working when I save the file.
Here's the code:

Код:
public SavePlayer(playerid)
{
	if(PlayerInfo[playerid][pLogged] == 1)
	{
	    new string[128];
	    format(string, sizeof(string), "RP4L/Users/%s.user", PlayerName[playerid]);
	    new File:userfile = fopen(string, io_write);
	    new ln[32],read[128];
	    fread(userfile, read);strmid(PlayerInfo[playerid][pPassword], read, false, strlen(read)-1, 75);
	    format(ln, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(userfile, ln);
		format(ln, 32, "%.2f pHealth\n", PlayerInfo[playerid][pHealth]);fwrite(userfile, ln);
		format(ln, 32, "%.2f pArmour\n", PlayerInfo[playerid][pArmour]);fwrite(userfile, ln);
		format(ln, 32, "%d pAdmin\n", PlayerInfo[playerid][pAdmin]);fwrite(userfile, ln);
		format(ln, 32, "%d pVip\n", PlayerInfo[playerid][pVip]);fwrite(userfile, ln);
		format(ln, 32, "%d pSkin\n", PlayerInfo[playerid][pSkin]);fwrite(userfile, ln);
		format(ln, 32, "%d pTeam\n", PlayerInfo[playerid][pTeam]);fwrite(userfile, ln);
		format(ln, 32, "%d pLevel\n", PlayerInfo[playerid][pLevel]);fwrite(userfile, ln);
		format(ln, 32, "%d pExp\n", PlayerInfo[playerid][pExp]);fwrite(userfile, ln);
		format(ln, 32, "%d pMoney\n", PlayerInfo[playerid][pMoney]);fwrite(userfile, ln);
		format(ln, 32, "%d pBank\n", PlayerInfo[playerid][pBank]);fwrite(userfile, ln);
		format(ln, 32, "%d pDrugs\n", PlayerInfo[playerid][pDrugs]);fwrite(userfile, ln);
		format(ln, 32, "%d pDrank\n", PlayerInfo[playerid][pDrank]);fwrite(userfile, ln);
		format(ln, 32, "%d pMaried\n", PlayerInfo[playerid][pMaried]);fwrite(userfile, ln);
		format(ln, 32, "%s pMariedUser\n", PlayerInfo[playerid][pMariedUser]);fwrite(userfile, ln);
		format(ln, 32, "%d pW1\n", PlayerInfo[playerid][pW1]);fwrite(userfile, ln);
		format(ln, 32, "%d pW2\n", PlayerInfo[playerid][pW2]);fwrite(userfile, ln);
		format(ln, 32, "%d pW3\n", PlayerInfo[playerid][pW3]);fwrite(userfile, ln);
		format(ln, 32, "%d pW4\n", PlayerInfo[playerid][pW4]);fwrite(userfile, ln);
		format(ln, 32, "%d pAW1\n", PlayerInfo[playerid][pAW1]);fwrite(userfile, ln);
		format(ln, 32, "%d pAW2\n", PlayerInfo[playerid][pAW2]);fwrite(userfile, ln);
		format(ln, 32, "%d pAW3\n", PlayerInfo[playerid][pAW3]);fwrite(userfile, ln);
		format(ln, 32, "%d pAW4\n", PlayerInfo[playerid][pAW4]);fwrite(userfile, ln);
		format(ln, 32, "%d pBizId\n", PlayerInfo[playerid][pBizId]);fwrite(userfile, ln);
		format(ln, 32, "%d pHouseID1\n", PlayerInfo[playerid][pHouseID1]);fwrite(userfile, ln);
		format(ln, 32, "%d pHouseID2\n", PlayerInfo[playerid][pHouseID2]);fwrite(userfile, ln);
		format(ln, 32, "%d pHouseID3\n", PlayerInfo[playerid][pHouseID3]);fwrite(userfile, ln);
		format(ln, 32, "%d pHouseID4\n", PlayerInfo[playerid][pHouseID4]);fwrite(userfile, ln);
		format(ln, 32, "%d pHouseSpawn\n", PlayerInfo[playerid][pHouseSpawn]);fwrite(userfile, ln);
		format(ln, 32, "%d pWanted\n", PlayerInfo[playerid][pWanted]);fwrite(userfile, ln);
		format(ln, 32, "%s pCrime\n", PlayerInfo[playerid][pCrime]);fwrite(userfile, ln);
		format(ln, 32, "%.4f pPosX\n", PlayerInfo[playerid][pPosX]);fwrite(userfile, ln);
		format(ln, 32, "%.4f pPosY\n", PlayerInfo[playerid][pPosY]);fwrite(userfile, ln);
		format(ln, 32, "%.4f pPosZ\n", PlayerInfo[playerid][pPosZ]);fwrite(userfile, ln);
		format(ln, 32, "%d pVir\n", PlayerInfo[playerid][pVir]);fwrite(userfile, ln);
		format(ln, 32, "%d pInt\n", PlayerInfo[playerid][pInt]);fwrite(userfile, ln);
		format(ln, 32, "%s pIP\n", PlayerInfo[playerid][pIP]);fwrite(userfile, ln);
		fclose(userfile);
	}
	else return SendClientMessage(playerid, COLOR_RED, "** ERROR: Cannot save your stats: You are not logged in! Use /register or /login NOW!");
	return 1;
}
Only the '%s' strings aren't working, so you can login with every password, the IP is like this: [UNKNOWN].0.0.1 (LAN), and you aren't maried anymore :') (RolePlay script )

Can anyone help me? I don't know the problem

Kind Regards,
Kwarde


Re: Problem with RegisterSystem - PinkFloydLover - 18.09.2010

wow, use dini or another file system


Re: Problem with RegisterSystem - Kwarde - 18.09.2010

No! I don't really like Dini :')
And I ever had a script (slrpg), and that script had this usersystem too, and it is working good for me!
I like this one more :')


This forum requires that you wait 120 seconds between posts. Please try again in 56 seconds.

:X X-( ..l..