hi,
Wie speichere ich hier admin?
Ich hab schon angefangen aber es klappt i-wie nicht^^
new eingeloggt[MAX_PLAYERS], kills[MAX_PLAYERS], geld[MAX_PLAYERS];
new admin[MAX_PLAYERS];
dcmd_register(playerid,params[]) {
if(!strlen(params)) return SendClientMessage(playerid,FARBE,"/register Passwort");
new name[MAX_PLAYER_NAME], s[256];//sollte die variable "s" zu klein sein, dann mach aus der 20 ne 256
GetPlayerName(playerid,name,sizeof(name));
format(s,sizeof(s),"%s.ini",name);
if(!dini_Exists(s)) {
dini_Create(s);
new ip[15];
GetPlayerIp(playerid,ip,sizeof(ip));
dini_Set(s,"ip",ip);
dini_IntSet(s,"passwort",udb_hash(params));
dini_IntSet(s,"kills",0);
dini_IntSet(s,"geld",GetPlayerMoney(playerid));
dini_IntSet(s,"admin",admin[playerid]);
}
return 1;
}
dcmd_login(playerid,params[]) {
if(eingeloggt[playerid]==0) {
if(!strlen(params)) return SendClientMessage(playerid,FARBE,"/login Passwort");
new name[MAX_PLAYER_NAME], s[256], s2[256];
GetPlayerName(playerid,name,sizeof(name));
format(s,sizeof(s),"%s.ini",name);
if(dini_Exists(s)) {
s2=dini_Get(s,"passwort");
if(strval(s2)==udb_hash(params)) {
kills[playerid]=dini_Int(s,"kills");
admin[playerid]=dini_Int(s,"admin");
geld[playerid]=dini_Int(s,"geld");
eingeloggt[playerid]=1;
} else {
SendClientMessage(playerid,Farbe,"Du bist bereits eingeloggt"); }}}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(eingeloggt[playerid]==1) {
eingeloggt[playerid]=0;
new name[21];
GetPlayerName(playerid,name,sizeof(name));
format(name,sizeof(name),"%s.ini",name);
dini_IntSet(name,"geld",GetPlayerMoney(playerid));
dini_IntSet(admin,"admin",admin[playerid]);
}
return 1;
}