Help with dudb
#1

hi....
i wanted to save the money of a player when he/she disconnects in his profile...i added this:
Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(PlayerData[playerid][Logged])
	{
	  new PlayerName2[30];
	  GetPlayerName(playerid, PlayerName2, 30);
      new year,month,day;	getdate(year, month, day);
	  new strdate[20];	format(strdate, sizeof(strdate), "%d.%d.%d",day,month,year);
	  new file[256]; format(file,256,"/base/users/%s.sav",udb_encode(PlayerName2));  
 	  dini_Set(file,"LastOn",strdate);
	  dUserSetINT(PlayerName(playerid)).("Money",GetPlayerMoney(playerid));
	  dUserSetINT(PlayerName(playerid)).("Kicks",PlayerData[playerid][Kicks]);
	  dUserSetINT(PlayerName(playerid)).("AdminLevel",PlayerData[playerid][AdminLevel]);
	  dUserSetINT(PlayerName(playerid)).("TimesOnServer",(dUserINT(PlayerName(playerid)).("TimesOnServer"))+1);
  	}
    return 1;
}
and...
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 1)
	{
	  if(response == 0){
	    SendClientMessage(playerid, RED, "You canceled the login");
		}
		if(response == 1){
			if(udb_CheckLogin(PlayerName(playerid),inputtext))
			{
			 SetPlayerMoney(playerid,(dUserINT(PlayerName(playerid)).("Money")));
  		  	PlayerData[playerid][AdminLevel] = (dUserINT(PlayerName(playerid)).("AdminLevel"));
	  	  	new file[256],name[24]; GetPlayerName(playerid,name,24); format(file,256,"/base/users/%s.sav",udb_encode(name));
            }
         }
       } 
    }
    return 1;
}
when the player disconnects, the money doesnt get saved in his/her profile...
(if i change the number at "Money" in the profile, the player gets it when he/she loggs in, so the problem should be at the disconnect).
....
ty
Reply
#2

reply..please...this is really important for me (sorry for double posting)
Reply


Forum Jump:


Users browsing this thread: