Why doesn't this work? enums
#1

So, I don't get any starting Money and Level when I first register to my server, even though I'm sure that I defined it:

Код:
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registracija...",""COL_RED"Unijeli ste pogresnu lozinku.\n"COL_WHITE"Upisite lozinku ispod da registrirate novi racun","Registracija","Odustani");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",5000);//STARTING CASH DEFINED HERE//
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Sex",0);
                INI_WriteInt(File,"Age",0);
	        INI_WriteInt(File,"Paytime",0);
		INI_WriteInt(File,"Respekti",0);
		INI_WriteInt(File,"Level",1);//STARTING LEVEL DEFINED HERE//
		INI_WriteInt(File,"Job",0);
		INI_WriteInt(File,"Accent",1);
    		INI_Close(File);
                ShowPlayerDialog(playerid,DIALOG_REGISTERMES,DIALOG_STYLE_MSGBOX,"Roleplay Kviz", "Prije nego sto pocnete igrati, morate proci kroz Roleplay kviz.\n Roleplay pravila mozete procitati na nasem forumu\n www.classic-samp.com.\n Sretno!","Ok","Odustani");
			}
        }
Oh, and this is my OnPlayerConnect:

Код:
public OnPlayerConnect(playerid)
{
	if(!IsValidName(playerid))
	{
	    SendClientMessage(playerid,COLOR_RED,"Molimo promjenite ime u format: Ime_Prezime");
	    Kick(playerid);
	}
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Prijavi se",""COL_WHITE"Dobrodosli natrag na Classic Gaming Roleplay server. \nUpisite lozinku ispod da se logirate.","Prijava","Odustani");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Registracija",""COL_WHITE"Dobrodosli na Classic Gaming Roleplay server. \n"COL_WHITE" Nemate registriran account. \nUpisite lozinku ispod da se registrirate.","OK","Odustani");
    }
    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,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
    INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
	INI_WriteInt(File,"Paytime",PlayerInfo[playerid][pPaytime]);
	INI_WriteInt(File,"Respekti",PlayerInfo[playerid][pRespekti]);
	INI_WriteInt(File,"Level",GetPlayerScore(playerid));
 	INI_WriteInt( File, "Bank_Wealth", PlayerInfo[playerid][BankWealth] );
 	INI_WriteInt( File, "Bank_Logged", 0 );
	INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
	INI_WriteInt(File,"Job",PlayerInfo[playerid][pJob]);
	INI_WriteInt(File,"Accent",PlayerInfo[playerid][pAccent]);
    INI_Close(File);
    return 1;
}
Reply
#2

Well, yeah, but: INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)) ; - I thought that should do it?
Reply
#3

So, if I do, let's say GivePlayerMoney 5k, and put it after the register dialogue, will it save and load?
Reply
#4

Great, thaaanks.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)