Command unknow
#6

Ok new problem now i started on a account system and ust got stuck on saving my money i will post what i have done so far.

Problem:Money is not saving after exiting the server and you do not lose money when you die.


Код:
enum _PINFO
{
	pKills,
	pMoney,
	pDeaths,
	pLevel,
	Float:pLastX,
	Float:pLastY,
	Float:pLastZ,
	pMuted,
	pMutedReason
}


public OnPlayerDisconnect(playerid, reason)
{
    new
		CString[50];
    format(CString, sizeof(CString), "Player: %s(%d) has left the server!", pName(playerid), playerid);
    SendClientMessageToAll(COLOR_GREY, CString);

	new File[50]; format(File, sizeof(File), PFiles, pName(playerid));

	GetPlayerPos(playerid, PVar[playerid][pLastX], PVar[playerid][pLastY], PVar[playerid][pLastZ]);
	
	
	djSetInt		(File, "Kills", 	PVar[playerid][pKills]);
	djSetInt		(File, "Money", 	PVar[playerid][pMoney]);
	djSetInt		(File, "Deaths", 	PVar[playerid][pDeaths]);
	djSetInt		(File, "Level", 	PVar[playerid][pLevel]);
	djSetInt        (File, "Muted",     PVar[playerid][pMuted]);
	djSet           (File, "MutedReason", PVar[playerid][pMutedReason]);

	djSetFloat		(File, "LastX", 	PVar[playerid][pLastX]);
	djSetFloat		(File, "LastY", 	PVar[playerid][pLastY]);
	djSetFloat		(File, "LastZ", 	PVar[playerid][pLastZ]);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	PVar[killerid][pKills] += 1;
	PVar[killerid][pMoney] += -250;
	PVar[playerid][pDeaths] += 1;
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new File[50];
	format(File, sizeof(File), PFiles, pName(playerid));
	switch(dialogid)
	{
		case LOGIN:
		{
		    if(response)
		    {
		        if(strlen(inputtext) == 0)
		        {
					new
						iStr[128];

					format(iStr, sizeof(iStr), ""#CBLUE"Welcome back: "#CDGREEN"%s(%d)\n"#CBLUE"Enter your password to login:", pName(playerid), playerid);
					return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""#CBLUE"Login", iStr, "Login", "Leave");
				}
    			if(strcmp(inputtext, dj(File, "Password", 40), true) == 0)
		    	{
		        	SendClientMessage(playerid, COLOR_LIGHTGREEN, "You are now logged in!");
		        
					PVar[playerid][pKills] 		= djInt		(File, "Kills");
					PVar[playerid][pMoney] 		= djInt		(File, "Money");
					PVar[playerid][pDeaths] 	= djInt		(File, "Deaths");
					PVar[playerid][pLevel] 		= djInt		(File, "Level");
					PVar[playerid][pMuted]      = djInt     (File, "Muted");
					format(PVar[playerid][pMutedReason], 52, "%s", dj(File, "MutedReason"));
					
					PVar[playerid][pLastX]      = djFloat	(File, "LastX");
					PVar[playerid][pLastY]      = djFloat	(File, "LastY");
					PVar[playerid][pLastZ]      = djFloat	(File, "LastZ");
				}
				else
				{
Any idea for tis would be great also i do not get any error or anything it complies fines.

Many Thanks.
Reply


Messages In This Thread
Command unknow - by manchestera - 14.10.2011, 21:16
Re: Command unknow - by Kush - 14.10.2011, 21:25
Re: Command unknow - by manchestera - 14.10.2011, 21:32
Re: Command unknow - by [MG]Dimi - 14.10.2011, 21:38
Re: Command unknow - by manchestera - 14.10.2011, 21:44
Re: Command unknow - by manchestera - 14.10.2011, 23:19
Re: Command unknow - by AeroBlast - 14.10.2011, 23:27
Re: Command unknow - by manchestera - 14.10.2011, 23:33
Re: Command unknow - by [MG]Dimi - 15.10.2011, 14:34

Forum Jump:


Users browsing this thread: 4 Guest(s)