Jump to content
  • 0

pomoc Problém s ukládáním


Pulpisek

Dotaz

Zdravím chtěl bych v jednom FS udělat dvojí ukládání a nevím jak na to tak experimentuju. Ale furt výsledku.


 

public OnPlayerConnect(playerid)
{
//----------------------------------------Ukládání jobů------------------------------------
new cesta[50];
	format(cesta,50,"JOBS/%s.sav",PlayerName(playerid));
	Job[playerid] = dini_Int(cesta,"JOBS");



    if(Job[playerid] == 2) return SendClientMessage(playerid, COLOR_ZELENA,"Jsi zaměstnaný jako řidič kamionu");
    if(Job[playerid] == 1) return SendClientMessage(playerid, COLOR_ZELENA,"Jsi zaměstnaný jako řidič společnosti PPL");
    if(Job[playerid] == 0) return SendClientMessage(playerid, COLOR_ZELENA,"Jsi nezaměstnany");
    

new cestas[50];
format(cestas,50,"autoskola/%s.sav",PlayerName(playerid));
if(dini_Exists(cestas)){
ridicak[playerid] = dini_Int(cesta,"ridic");
}else{
dini_Create(cestas);

}


if(ridicak[playerid] == 1) SendClientMessage(playerid, COLOR_ZELENA,"Už vlastníš řidický průkaz");
if(ridicak[playerid] == 0) SendClientMessage(playerid, COLOR_ZELENA,"Nevlastníš řidický průkaz.");



	return 1;
}



public OnPlayerDisconnect(playerid, reason)
{

//------------------------------Ukládání jobů---------------------------------------------------------
	new cesta[50];
	format(cesta,50,"JOBS/%s.sav",PlayerName(playerid));
	if(!dini_Exists(cesta))
	{
	    dini_Create(cesta);
	}
	else
	{
		dini_IntSet(cesta,"JOBS",Job[playerid]);
	}
//-------------------------------------Konec-----------------------------------------------


new cestas[50];
format(cestas,50,"autoskola/%s.sav",PlayerName(playerid));
dini_IntSet(cestas,"ridic",ridicak[playerid]);


	return 1;
}


Takto to mám, tuším že je to strašná volovina. :d


Tak už asi vím zatím dobrý dám vědět kdyby ne :)

Link to comment
Share on other sites

3 odpovědí na tuto otázku

Recommended Posts

  • 0

A když to mám takto je to kravina ? 
:d 
 

public OnPlayerConnect(playerid)
{
//----------------------------------------Ukládání jobů------------------------------------
new cesta[50];
	format(cesta,50,"JOBS/%s.sav",PlayerName(playerid));
	Job[playerid] = dini_Int(cesta,"JOBS");
    ridicak[playerid] = dini_Int(cesta,"ridicak");

    
    if(Job[playerid] == 2) return SendClientMessage(playerid, COLOR_ZELENA,"Jsi zaměstnaný jako řidič kamionu.");
    if(Job[playerid] == 1) return SendClientMessage(playerid, COLOR_ZELENA,"Jsi zaměstnaný jako řidič společnosti PPL.");
    if(Job[playerid] == 0) return SendClientMessage(playerid, COLOR_ZELENA,"Jsi nezaměstnany.");
    if(ridicak[playerid] == 0) return SendClientMessage(playerid, COLOR_ZELENA,"Nemáš řidický průkaz udělej si ho v autoškole v LV za 15 000$.");
    if(ridicak[playerid] == 1) return SendClientMessage(playerid, COLOR_ZELENA,"Máš řidický průkaz.");



	return 1;
}



public OnPlayerDisconnect(playerid, reason)
{

//------------------------------Ukládání jobů---------------------------------------------------------
	new cesta[50];
	format(cesta,50,"JOBS/%s.sav",PlayerName(playerid));
	if(!dini_Exists(cesta))
	{
	    dini_Create(cesta);
	}
	else
	{
		dini_IntSet(cesta,"JOBS",Job[playerid]);
		dini_IntSet(cesta,"ridicak",ridicak[playerid]);
	}
//-------------------------------------Konec-----------------------------------------------



	return 1;
}


Nejsme si jist a byl bych rád kdyby někdo mi to pomohl upravit. 
Nejspíš nejde moc dobře načítání. Protože mi nechce v conncetu zobrazit to že mám nebo nemám řidičák. Ale job mi to ukáže co stím ? :(

Link to comment
Share on other sites

  • 0

Řekl jsem ti, co s tím máš udělat, ne?

//
 

public OnPlayerConnect(playerid)
{
//----------------------------------------Ukládání jobů------------------------------------
new cesta[50];
	format(cesta,50,"JOBS/%s.sav",PlayerName(playerid));
        if(!dini_Exists(cesta)) dini_Create(cesta);
	Job[playerid] = dini_Int(cesta,"JOBS");


    if(Job[playerid] == 2) return SendClientMessage(playerid, COLOR_ZELENA,"Jsi zaměstnaný jako řidič kamionu");
    if(Job[playerid] == 1) return SendClientMessage(playerid, COLOR_ZELENA,"Jsi zaměstnaný jako řidič společnosti PPL");
    if(Job[playerid] == 0) return SendClientMessage(playerid, COLOR_ZELENA,"Jsi nezaměstnany");
    

new cestas[50];
format(cestas,50,"autoskola/%s.sav",PlayerName(playerid));
if(dini_Exists(cestas)){
ridicak[playerid] = dini_Int(cesta,"ridic");
}else{
dini_Create(cestas);

}


if(ridicak[playerid] == 1) SendClientMessage(playerid, COLOR_ZELENA,"Už vlastníš řidický průkaz");
if(ridicak[playerid] == 0) SendClientMessage(playerid, COLOR_ZELENA,"Nevlastníš řidický průkaz.");



	return 1;
}



public OnPlayerDisconnect(playerid, reason)
{

//------------------------------Ukládání jobů---------------------------------------------------------
	new cesta[50];
	format(cesta,50,"JOBS/%s.sav",PlayerName(playerid));
	dini_IntSet(cesta,"JOBS",Job[playerid]);
//-------------------------------------Konec-----------------------------------------------


new cestas[50];
format(cestas,50,"autoskola/%s.sav",PlayerName(playerid));
dini_IntSet(cestas,"ridic",ridicak[playerid]);


	return 1;
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...