Hallo,
also erst ma das script:
C
#include <dini>
#include <dudb>
#define SERVER_USER_FILE "cslogin/users/%s.ini"
#define COLOR_RED 0xFFF0000FF
#define COLOR_BLUE 0x0000BBAA
#define COLOR_YELLOW 0xFFFF00AA
Code
#pragma unused ret_memcpy
enum pInfo
{
pAdminLevel,
pCash,
pScore,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
#define SERVER_USER_FILE "myserver/%s.ini"
Alles anzeigen
beim Connecten:
Code
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Wilkommen. Du bist nicht regristriert!", "Tippe bitte dein passwort ein", "Regristrieren", "Verlassen");
}
if(fexist(file))
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Acc.name Regristriert", "Bitte Passwort eingeben", "Login", "Verlassen");
}
Alles anzeigen
Disconnect:
Code
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
}
gPlayerLogged[playerid] = 0;
So nun die warns : S
Code
C:\Users\****\Desktop\server\gamemodes\Reallife.pwn(53) : warning 201: redefinition of constant/macro (symbol "SERVER_USER_FILE")
C:\Users\****\Desktop\server\gamemodes\Reallife.pwn(71) : warning 217: loose indentation
C:\Users\*****\Desktop\server\gamemodes\Reallife.pwn(90) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
3 Warnings.
wenn mir einer helfen könnte bitte? : S
Den es wird nicht gespeichert beim ausloggen.
D.h. immer neu reggen aber nix passiert.
Ich denke es liegt an den ersten warn.
mfg
sushii.
msn: per pn pls^^
*EDIT* srry response vergessen
Code
if (dialogid == 1)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Wilkommen! Du bist nicht Regristriert!.", "Bitte gib ein Passwort ein...", "Regristrieren", "Verlassen");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 5000);
dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
format(string, 128, "[SYSTEM]: Du hast deinen Namen %s erfolgreich Regristriert! mit dem Passwort: %s, und wurdest Automatisch eingeloggt!", name, inputtext);
SendClientMessage(playerid, COLOR_YELLOW, string);
gPlayerLogged[playerid] = 1;
}
else if (dialogid == 2)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hallo, Acc.name erkannt.", "Bitte Passwort eingeben", "Login", "Verlassen");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp)
{
SendClientMessage(playerid, COLOR_RED, "Falsches Passwort!");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hallo, Acc.name erkannt.", "Bitte Passwort eingeben zum einloggen...", "Login", "Verlassen");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
SendClientMessage(playerid,COLOR_RED, "[SYSTEM]: Erfolgreich eingeloggt!");
}
}
Alles anzeigen