enum spieler_daten
{
skin,
// usw...
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
SetPlayerSkin(playerid, dini_Int(accFormat,"skin"));
public OnPlayerDisconnect(playerid, reason)
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"%s.datei",pname);
dini_IntSet(accFormat, "skin", GetPlayerSkin(playerid));
if(fexist(accFormat) && Spieler[playerid][eingeloggt])
{
dini_IntSet(accFormat,"wanted",Spieler[playerid][wanted]);
dini_IntSet(accFormat,"jail",Spieler[playerid][jail]);
dini_IntSet(accFormat,"jailtime",Spieler[playerid][jailtime]);
dini_IntSet(accFormat,"pduty",Spieler[playerid][pduty]);
dini_IntSet(accFormat,"leader",Spieler[playerid][leader]);
dini_IntSet(accFormat,"team",Spieler[playerid][team]);
dini_IntSet(accFormat,"skin",Spieler[playerid][skin]);
dini_IntSet(accFormat,"Geld",GetPlayerMoney(playerid));
dini_IntSet(accFormat,"Score",GetPlayerScore(playerid));
dini_IntSet(accFormat,"Admin",Spieler[playerid][Admin]);
}
Spieler[playerid][eingeloggt] = 0;
Spieler[playerid][wanted] = 0;
Spieler[playerid][jail] = 0;
Spieler[playerid][jailtime] = 0;
Spieler[playerid][pduty] = 0;
Spieler[playerid][leader] = 0;
Spieler[playerid][team] = 0;
Spieler[playerid][skin] = 0;
Spieler[playerid][Admin] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"%s.datei",pname);
SetPlayerSkin(playerid, dini_Int(accFormat,"skin"));
{
if(Spieler[playerid][team] == 0) //team zivi
{
SetPlayerPos(playerid, 1219.0143,-1812.4454,16.5938);
SetPlayerColor(playerid, COLOR_WHITE);
}
if(Spieler[playerid][team] == 1) //team ninjas
{
SetPlayerPos(playerid, 864.0807,-1642.5531,13.8480 );
GivePlayerWeapon(playerid, 4, 1); GivePlayerWeapon(playerid, 24, 50);
SetPlayerColor(playerid, COLOR_LIGHTBLUE);
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"%s.datei",pname);
if(response)
{
switch(dialogid) // dialogid auswählen
{
case DIALOG_LOGIN: // ID Login
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen");
return SendClientMessage(playerid,0xFFFFFFFF,"Kein Passwort angegeben!");
}
if(strcmp(inputtext,dini_Get(accFormat,"Passwort")) == 0) // Passwort Direkt aus der Datei Laden
{
Spieler[playerid][wanted] = dini_Int(accFormat,"wanted");
Spieler[playerid][jail] = dini_Int(accFormat,"jail");
Spieler[playerid][jailtime] = dini_Int(accFormat,"jailtime");
Spieler[playerid][pduty] = dini_Int(accFormat,"pduty");
Spieler[playerid][leader] = dini_Int(accFormat,"leader");
Spieler[playerid][team] = dini_Int(accFormat,"team");
Spieler[playerid][skin] = dini_Int(accFormat,"skin");
GivePlayerMoney(playerid,dini_Int(accFormat,"Geld"));
SetPlayerScore(playerid,dini_Int(accFormat,"Score"));
Spieler[playerid][Admin] = dini_Int(accFormat,"Admin");
Spieler[playerid][eingeloggt] = 1; // Spieler ist nun erfolgreich eingeloggt
SendClientMessage(playerid,0xFFFFFFFF,"Du wurdest erfolgreich eingeloggt.");
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen");
SendClientMessage(playerid,0xFFFFFFFF,"Das Passwort war Falsch!");
}
}
case DIALOG_REG: // ID Registrieren
{
if(!strlen(inputtext)) // Text darf nicht = Null sein Null im Sinne von nichts
{
ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","Bitte Registriere dich","Weiter","Abbrechen");
return SendClientMessage(playerid,0xFFFFFFFF,"Das Passwort ist zu kurz!");
}
dini_Create(accFormat);
dini_Set(accFormat,"Passwort",inputtext);
Spieler[playerid][eingeloggt] = 1;
SetPlayerSkin(playerid, dini_Int(accFormat,"skin"));
SendClientMessage(playerid,0xFFFFFFFF,"Account wurde angelegt und du wurdest eingeloggt.");
}
}
}
else
{
switch(dialogid)
{
case DIALOG_LOGIN:ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen");
case DIALOG_REG:ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","Bitte Registriere dich","Weiter","Abbrechen");
}
}
return 1;
}
so speichere ich