Hallo liebe Scripting Community,
ich habe folgendes Anliegen, ich möchte gerne ein Adminsystem in meinem Script haben und weiß nur nich wie. Mein Register- /Loginsystem basiert leider nicht auf "Stock" und kann somit nicht auf dem Tutorial von MrMonatTutorials zurückgreifen. Daher meine bitte, ob mir jemand das Adminsystem soweit einrichten könnte das es lädt und speichert, wenn es geht bitte C&P, da ich so besser lernen kann. Wie gesagt nur so anfertigen das es das Adminlevel lädt und speichert, den Rest werde ich dann machen!
Im voraus schonmal DANKE!
Hier mein Script..
#include <a_samp>
#include <dini>
//Dialoge
#define DIALOG_LOGIN 3
#define DIALOG_REG 4
//Farben
#define RED 0xFF0000FF
#define GREEN 0x2DFF00FF
#define WHITE 0xFAFAFAFF
#define ORANGE 0xFF7800FF
//forward's
forward clock();
forward restart();
enum spieler_daten
{
wanted,
skin,
Float:lastx,Float:lasty,Float:lastz,
eingeloggt
}
//new's
new Spieler[MAX_PLAYERS][spieler_daten];
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
#endif
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
public OnGameModeInit()
{
UsePlayerPedAnims();
SetGameModeText("Blank Script");
AddPlayerClass(0,1640.7678,-2332.2886,13.5469,69.8155,0,0,0,0,0,0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1640.7678,-2332.2886,13.5469);
SetPlayerCameraPos(playerid, 1640.7678,-2332.2886,13.5469);
SetPlayerCameraLookAt(playerid, 1640.7678,-2332.2886,13.5469);
return 1;
}
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"%s.datei",pname);
if(fexist(accFormat))
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich mit deinem Passwort ein","Weiter","Abbrechen");
}
else
{
ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","Bitte Registriere dich mit einem Passwort deiner Wahl","Weiter","Abbrechen");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"%s.datei",pname);
if(dini_Isset(accFormat,"lastx,lasty,lastx"))
{
SetPlayerPos(playerid,Spieler[playerid][lastx],Spieler[playerid][lasty],Spieler[playerid][lastz]);
}
{
clock();
return 1;
}
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/svn1", cmdtext, true, 10) ==0)
{
SendClientMessageToAll(ORANGE, "***************************************** Server Nachricht *****************************************");
SendClientMessageToAll(ORANGE, "Aufgrund eines Scriptupdates wird der Server in wenigen Minuten neugestartet!");
return 1;
}
if(strcmp("/restart", cmdtext, true, 10) ==0)
{
SendRconCommand("gmx");
GameTextForAll("Server wird neugestartet", 10000,0);
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
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)
{
case DIALOG_LOGIN:
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen");
return SendClientMessage(playerid, RED,"Kein Passwort angegeben!");
}
if(strcmp(inputtext,dini_Get(accFormat,"Passwort")) == 0)
{
Spieler[playerid][wanted] = dini_Int(accFormat,"wanted");
Spieler[playerid][skin] = dini_Int(accFormat,"skin");
Spieler[playerid][lastx] = dini_Float(accFormat,"lastx");
Spieler[playerid][lasty] = dini_Float(accFormat,"lasty");
Spieler[playerid][lastz] = dini_Float(accFormat,"lastz");
GivePlayerMoney(playerid,dini_Int(accFormat,"Geld"));
SetPlayerScore(playerid,dini_Int(accFormat,"Score"));
SetPVarInt(playerid,"Adminlevel",dini_Int(accFormat,"Adminlevel"));
Spieler[playerid][eingeloggt] = 1;
SendClientMessage(playerid,WHITE,"Du wurdest erfolgreich eingeloggt.");
}
else
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen");
SendClientMessage(playerid,0xFFFFFFFF,"Das Passwort war Falsch!");
}
}
case DIALOG_REG:
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","Bitte Registriere dich","Weiter","Abbrechen");
return SendClientMessage(playerid,RED,"Das Passwort ist zu kurz!");
}
dini_Create(accFormat);
dini_Set(accFormat,"Passwort",inputtext);
Spieler[playerid][eingeloggt] = 1;
SendClientMessage(playerid,GREEN,"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;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
public clock()
{
new Text:Clock;
new hour,minute,second;
new string[10];
gettime(hour,minute,second);
format(string, sizeof string, "%s%d:%s%d:%s%d", (hour < 10) ? ("0") : (""), hour, (minute < 10) ? ("0") : (""), minute, (second < 10) ? ("0") : (""), second);
TextDrawHideForAll(Clock);
Clock = TextDrawCreate(542.0, 24.0, string); // Koordinaten, wo die Uhr angezeigt wird
TextDrawLetterSize(Clock, 0.6, 1.8);
TextDrawFont(Clock, 3); // Uhrschrift
TextDrawSetOutline(Clock, 2);
TextDrawShowForAll(Clock);
SetTimer("clock",1000,0);
return 1;
}
stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}