Poste bitte den Code zu den 4 Prints, da du das ja offensichtlich abgewandelt hast.
Register Dialog
case DIALOG_CREATE_CHARACTER_MALE:
{
new hour,minute,second,day,month,year;
new tag,monat,jahr,stunde,minuten,sekunde;
gettime(stunde,minuten,sekunde);
getdate(jahr,monat,tag);
if(!response) return ShowPlayerDialog(playerid, DIALOG_CREATE_CHARACTER_NAME, DIALOG_STYLE_INPUT, "{FFFFFF}Charakter - Erstellen", "{FFFFFF}Wie soll der Charakter heißen? Gebe bitte einen Namen im Roleplay-Format an!\n(Beispiel: Hans_Meier, Helmut_Schmidt)", "{FFFFFF}Weiter", "{FFFFFF}Zurück");
if(strcmp("Männlich",inputtext , true ) == 0)
{
format(CharacterInfo[playerid][character_Register], 50, "%02d.%02d.%d | %02d:%02d:%02d ",tag,monat,jahr,stunde,minuten,sekunde);
format(CharacterInfo[playerid][character_LastLogin], 50, "%02d.%02d.%d | %02d:%02d:%02d ",day,month,year,hour,minute,second);
mysql_format(handle, string, sizeof(string), "UPDATE `character` SET `Geschlecht` = '1',`Skin` = '187|0|0',`Level` = '1',`Register` = '%e' ,`LastLogin` = '%e' WHERE `AccountID` = '%d' AND `Slot` = '%d'",CharacterInfo[playerid][character_Register],CharacterInfo[playerid][character_LastLogin],AccountInfo[playerid][account_ID],AccountInfo[playerid][account_SelectedChar]);
mysql_tquery(handle, string);
mysql_format(handle, string, sizeof(string), "SELECT * FROM `character` WHERE `AccountID` = '%d'", AccountInfo[playerid][account_ID]);
mysql_tquery(handle, string, "ShowCharacter", "d", playerid);
DeletePVar(playerid, "CharErstellungSlot");
return 1;
}
else if(strcmp("Weiblich",inputtext , true ) == 0)
{
format(CharacterInfo[playerid][character_Register], 50, "%02d.%02d.%d | %02d:%02d:%02d ",tag,monat,jahr,stunde,minuten,sekunde);
format(CharacterInfo[playerid][character_LastLogin], 50, "%02d.%02d.%d | %02d:%02d:%02d ",day,month,year,hour,minute,second);
mysql_format(handle, string, sizeof(string), "UPDATE `character` SET `Geschlecht` = '2',`Skin` = '141|0|0',`Level` = '1',`Register` = '%e' ,`LastLogin` = '%e' WHERE `AccountID` = '%d' AND `Slot` = '%d'",CharacterInfo[playerid][character_Register],CharacterInfo[playerid][character_LastLogin],AccountInfo[playerid][account_ID],AccountInfo[playerid][account_SelectedChar]);
mysql_tquery(handle, string);
mysql_format(handle, string, sizeof(string), "SELECT * FROM `character` WHERE `AccountID` = '%d'", AccountInfo[playerid][account_ID]);
mysql_tquery(handle, string, "ShowCharacter", "d", playerid);
DeletePVar(playerid, "CharErstellungSlot");
return 1;
}
ShowPlayerDialog(playerid, DIALOG_CREATE_CHARACTER_MALE, DIALOG_STYLE_INPUT, "{FFFFFF}Charakter - Erstellen", "{FFFFFF}Welches Geschlecht soll dein Charakter haben?\n(Beispiel: Männlich, Weiblich)", "{FFFFFF}Weiter", "{FFFFFF}Zurck");
return 1;
}
Alles anzeigen
Hier sind die Account Register Login Werte
FUNCTION OnPasswordHashed(playerid)
{
new hash[BCRYPT_HASH_LENGTH],query[256];
new tag,monat,jahr,stunde,minuten,sekunde;
new day,month,year,hour,minute,second;
gettime(stunde, minuten, sekunde);
getdate(jahr, monat, tag);
bcrypt_get_hash(hash);
format(AccountInfo[playerid][account_LastLogin], 50, "%02d.%02d.%d | %02d:%02d:%02d ",day,month,year,hour,minute,second);
format(AccountInfo[playerid][account_Register], 50, "%02d.%02d.%d | %02d:%02d:%02d ",tag,monat,jahr,stunde,minuten,sekunde);
mysql_format(handle, query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Passwort`,`Register`,`LastLogin`) VALUES ('%e', '%e','%e','%e')", AccountInfo[playerid][account_Name], hash,AccountInfo[playerid][account_Register],AccountInfo[playerid][account_LastLogin]);
//mysql_format(handle, query, sizeof(query), "UPDATE `accounts` SET `LastLogin` = '%e' WHERE `ID` = '%d'",AccountInfo[playerid][account_LastLogin],AccountInfo[playerid][account_ID]);
mysql_pquery(handle, query, "AccountRegister", "d", playerid);
return 1;
}
Alles anzeigen
AccountLogin
FUNCTION AccountLogin(playerid)
{
new rows,string[512];
new hour,minute,second,day,month,year;
new tag,monat,jahr,stunde,minuten,sekunde;
gettime(hour, minute, second);
getdate(year, month, day);
cache_get_row_count(rows);
if(rows)
{
cache_get_value_name_int(0, "ID", AccountInfo[playerid][account_ID]);
cache_get_value_name_int(0, "Slot1", AccountInfo[playerid][account_Slot][0]);
cache_get_value_name_int(0, "Slot2", AccountInfo[playerid][account_Slot][1]);
cache_get_value_name_int(0, "Admin", AccountInfo[playerid][account_Admin]);
cache_get_value_name_int(0, "Scripter", AccountInfo[playerid][account_Scripter]);
cache_get_value_name_int(0, "Mapper", AccountInfo[playerid][account_Mapper]);
cache_get_value_name_int(0, "Maintenance", AccountInfo[playerid][account_Maintenance]);
cache_get_value_name_int(0, "Interact", AccountInfo[playerid][account_Interact]);
cache_get_value_name(0, "Register", AccountInfo[playerid][account_Register],50);
cache_get_value_name(0, "LastLogin", AccountInfo[playerid][account_LastLogin],50);
printf("Register: %s", AccountInfo[playerid][account_Register]);
printf("Login: %s", AccountInfo[playerid][account_LastLogin]);
format(AccountInfo[playerid][account_Register], 50, "%02d.%02d.%d | %02d:%02d:%02d ",tag,monat,jahr,stunde,minuten,sekunde);
format(AccountInfo[playerid][account_LastLogin], 50, "%02d.%02d.%d | %02d:%02d:%02d ",day,month,year,hour,minute,second);
mysql_format(handle, string, sizeof(string), "INSERT INTO `accounts` (`LastLogin`) VALUES ('%e')", AccountInfo[playerid][account_LastLogin]);
mysql_format(handle, string, sizeof(string), "SELECT LastLogin FROM `accounts` WHERE `ID` = '%d'", AccountInfo[playerid][account_ID]);
mysql_format(handle, string, sizeof(string), "SELECT Register FROM `accounts` WHERE `ID` = '%d'", AccountInfo[playerid][account_ID]);
mysql_format(handle, string, sizeof(string), "UPDATE `accounts` SET `LastLogin` = '%e' WHERE `ID` = '%d'",AccountInfo[playerid][account_LastLogin],AccountInfo[playerid][account_ID]);
mysql_tquery(handle, string);
mysql_format(handle, string, sizeof(string), "SELECT * FROM `character` WHERE `AccountID` = '%d'", AccountInfo[playerid][account_ID]);
mysql_tquery(handle, string, "ShowCharacter", "d", playerid);
//CancelSelectTextDraw(playerid);
}
return 1;
}
Alles anzeigen
LoadCharacter
FUNCTION LoadCharacter(playerid)
{
new rows,string[128],skins[128];
new pname[MAX_PLAYER_NAME], string1[128],string3[128],string4[80];
new oldtime = GetTickCount();
SetPVarInt(playerid,"time",oldtime);
cache_get_row_count(rows);
if(rows)
{
cache_get_value_name_int(0, "Lock", CharacterInfo[playerid][character_Lock]);
if(CharacterInfo[playerid][character_Lock])
{
mysql_format(handle, string, sizeof(string), "SELECT * FROM `character` WHERE `AccountID` = '%d'", AccountInfo[playerid][account_ID]);
mysql_tquery(handle, string, "ShowCharacter", "d", playerid);
SendInfo(playerid,"Der Charakter ist noch nicht freigeschaltet");
return 1;
}
cache_get_value_name_int(0, "ID", CharacterInfo[playerid][character_ID]);
cache_get_value_name_int(0, "Slot", CharacterInfo[playerid][character_Slot]);
cache_get_value_name(0, "Name", CharacterInfo[playerid][character_Name], 255);
cache_get_value_name_int(0, "Level", CharacterInfo[playerid][character_Level]);
cache_get_value_name_int(0, "Respektpunkte", CharacterInfo[playerid][character_Respektpunkte]);
cache_get_value_name_float(0, "Geld", CharacterInfo[playerid][character_Geld]);
cache_get_value_name_float(0, "Health",CharacterInfo[playerid][character_Health]);
cache_get_value_name_float(0, "Armour",CharacterInfo[playerid][character_Armour]);
cache_get_value_name_int(0, "Food", CharacterInfo[playerid][character_Food]);
cache_get_value_name_int(0, "Thirst", CharacterInfo[playerid][character_Thirst]);
cache_get_value_name(0, "Skin", string, 255);
format(skins,128,"%s",string);
sscanf(skins, "p<|>iii",CharacterInfo[playerid][character_Skin][0],CharacterInfo[playerid][character_Skin][1],CharacterInfo[playerid][character_Skin][2]);
cache_get_value_name_int(0, "Geschlecht", CharacterInfo[playerid][character_Geschlecht]);
cache_get_value_name_float(0, "X",CharacterInfo[playerid][character_Pos][0]);
cache_get_value_name_float(0, "Y",CharacterInfo[playerid][character_Pos][1]);
cache_get_value_name_float(0, "Z",CharacterInfo[playerid][character_Pos][2]);
cache_get_value_name_float(0, "R",CharacterInfo[playerid][character_Pos][3]);
cache_get_value_name_int(0, "Interior", CharacterInfo[playerid][character_Interior]);
cache_get_value_name_int(0, "World", CharacterInfo[playerid][character_World]);
cache_get_value_name_int(0, "Fraktion", CharacterInfo[playerid][character_Fraktion]);
cache_get_value_name_int(0, "Rang", CharacterInfo[playerid][character_Rang]);
cache_get_value_name_int(0, "Duty", CharacterInfo[playerid][character_Duty]);
cache_get_value_name_int(0, "Job", CharacterInfo[playerid][character_Job]);
cache_get_value_name(0, "Register", CharacterInfo[playerid][character_Register],50);
cache_get_value_name(0, "LastLogin", CharacterInfo[playerid][character_LastLogin],50);
printf("Register1: %s", CharacterInfo[playerid][character_Register]);
printf("Login1: %s", CharacterInfo[playerid][character_LastLogin]);
CharacterInfo[playerid][character_Eingeloggt] = true;
TogglePlayerSpectating(playerid, false);
TogglePlayerControllable(playerid, true);
SetPlayerColor(playerid,COLOR_WHITE);
SetPlayerScore(playerid,CharacterInfo[playerid][character_Level]);
//SetPlayerProgressBarValue(playerid,BAR_Food[playerid],CharacterInfo[playerid][character_Food]);
//SetPlayerProgressBarValue(playerid,BAR_Thirst[playerid],CharacterInfo[playerid][character_Thirst]);
//UpdateHud(playerid);
//ShowHud(playerid);
new hour,minute,second,day,month,year;
new tag,monat,jahr,stunde,minuten,sekunde;
gettime(hour, minute, second);
getdate(year, month, day);
SetPlayerHealth(playerid,CharacterInfo[playerid][character_Health]);
SetPlayerArmour(playerid,CharacterInfo[playerid][character_Armour]);
format(CharacterInfo[playerid][character_Register], 50, "%02d.%02d.%d | %02d:%02d:%02d ",tag,monat,jahr,stunde,minuten,sekunde);
format(CharacterInfo[playerid][character_LastLogin], 50, "%02d.%02d.%d | %02d:%02d:%02d ",day,month,year,hour,minute,second);
mysql_format(handle,string,sizeof(string),"SELECT Register FROM `character` WHERE `AccountID`='%d'",CharacterInfo[playerid][character_ID]);
mysql_tquery(handle,string);
format(string,50,"Dein Account wurde in %d ms geladen",GetTickCount()-oldtime);
if(!strcmp("Daniel",AccountInfo[playerid][account_Name]))
SendInfo(playerid,string);
/* Inventar */
mysql_format(handle,string,sizeof(string),"SELECT * FROM `inventory` WHERE `CharacterID`='%d'",CharacterInfo[playerid][character_ID]);
mysql_tquery(handle,string,"LoadPlayerInventory","i",playerid);
/* Scheine */
mysql_format(handle,string,sizeof(string),"SELECT * FROM `character_license` WHERE `CharacterID`='%d'",CharacterInfo[playerid][character_ID]);
mysql_tquery(handle,string,"LoadPlayerLicense","i",playerid);
GetPlayerName(playerid, pname, sizeof(pname));
format(string1,sizeof(string1),"%s[%d] hat den Server betreten",pname,playerid);
format(string3,50,"Der Login hat %d ms gedauert",GetTickCount()-oldtime);
format(string4,sizeof(string4),"Mit {FF0000}/logout {FFFFFF}kommst du zurück zur Charakterauswahl");
SendInfoToAll(string1);
SendInfo(playerid, string3);
SendInfo(playerid, string4);
HideServerInfo(playerid);
}
return 1;
}
Alles anzeigen
ShowStats
stock ShowStats(playerid,targetid)
{
new string[1024],geschlecht[50],string1[2000],string2[128],header[200];
if(CharacterInfo[targetid][character_Geschlecht] == 1){geschlecht = "Männlich";}
else if(CharacterInfo[targetid][character_Geschlecht] == 2){geschlecht = "Weiblich";}
switch(AccountInfo[targetid][account_Admin])
{
case 0: format(string2,sizeof(string2), "Rang: %s", GetAdminRang(AccountInfo[targetid][account_Admin], true));
case 1: format(string2,sizeof(string2), "Rang: %s", GetDevRang(targetid, true));
case 2: format(string2,sizeof(string2), "Rang: %s", GetAdminRang(AccountInfo[targetid][account_Admin], true));
case 3: format(string2,sizeof(string2), "Rang: %s", GetAdminRang(AccountInfo[targetid][account_Admin], true));
case 4: format(string2,sizeof(string2), "Rang: %s", GetAdminRang(AccountInfo[targetid][account_Admin], true));
case 5: format(string2,sizeof(string2), "Rang: %s", GetAdminRang(AccountInfo[targetid][account_Admin], true));
case 6: format(string2,sizeof(string2), "Rang: %s", GetAdminRang(AccountInfo[targetid][account_Admin], true));
}
//new hour,minute,second,day,month,year;
//gettime(hour, minute, second);
//getdate(year, month, day);
//new tag,monat,jahr,stunde,minuten,sekunde;
//format(AccountInfo[targetid][account_LastLogin], 50, "%02d.%02d.%d | %02d:%02d:%02d ",day,month,year,hour,minute,second);
//format(AccountInfo[targetid][account_Register], 50, "%02d.%02d.%d | %02d:%02d:%02d ",tag,monat,jahr,stunde,minuten,sekunde);
//format(CharacterInfo[targetid][character_LastLogin], 50, "%02d.%02d.%d | %02d:%02d:%02d ",day,month,year,hour,minute,second);
format(string,sizeof(string),"{FF0000}[OOC]{FFFFFF}\nID: %d | %s | OOC Name: %s | Registriert seit: %s | Letzter Login: %s\n\n{FF0000}[IC]{FFFFFF}\nRegistriert seit: %s | Letzter Login: %s | Geschlecht: %s | RP Name: %s",
AccountInfo[targetid][account_ID],string2,AccountInfo[targetid][account_Name],AccountInfo[targetid][account_Register],AccountInfo[targetid][account_LastLogin],
CharacterInfo[targetid][character_Register],CharacterInfo[targetid][character_LastLogin],geschlecht, RemoveUnderscore(CharacterInfo[targetid][character_Name]));
strcat(string1,string);
strdel(string,0,sizeof(string));
format(header,sizeof(header),"{FFFFFF}Statistiken von %s",AccountInfo[targetid][account_Name]);
ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, header, string1, "{FFFFFF}Weiter", "");
return 1;
}
Alles anzeigen
AccountRegister
FUNCTION AccountRegister(playerid)
{
new string[512];
AccountInfo[playerid][account_ID] = cache_insert_id();
AccountInfo[playerid][account_Eingeloggt] = true;
mysql_format(handle, string, sizeof(string), "INSERT INTO `accounts` (`Register`,`LastLogin`) VALUES ('%e','%e')",AccountInfo[playerid][account_Register],AccountInfo[playerid][account_LastLogin]);
mysql_format(handle, string, sizeof(string), "SELECT Register, LastLogin FROM `accounts` WHERE `AccountID` = '%d'", AccountInfo[playerid][account_ID]);
mysql_format(handle, string, sizeof(string), "INSERT INTO `character` (`AccountID`,`Name`,`Slot`,`Level`, `Skin`,`Geschlecht`,`X`,`Y`,`Z`,`R`,`Interior`,`World`,`Register`,`LastLogin`) VALUES ('%d','Keiner','1','1','187|0|0','1','1480.5341','-1770.5804','18.7958','0.3109','0','0','00.00.0000 | 00:00:00','00.00.0000 | 00:00:00')",AccountInfo[playerid][account_ID]);
mysql_tquery(handle, string);
mysql_format(handle, string, sizeof(string), "INSERT INTO `character` (`AccountID`,`Name`,`Slot`,`Level`, `Skin`,`Geschlecht`,`X`,`Y`,`Z`,`R`,`Interior`,`World`,`Register`,`LastLogin`) VALUES ('%d','Keiner','2','1','187|0|0','1','1480.5341','-1770.5804','18.7958','0.3109','0','0','00.00.0000 | 00:00:00','00.00.0000 | 00:00:00')",AccountInfo[playerid][account_ID]);
mysql_tquery(handle, string);
mysql_format(handle, string, sizeof(string), "SELECT * FROM `character` WHERE `AccountID` = '%d'", AccountInfo[playerid][account_ID]);
mysql_tquery(handle, string, "ShowCharacter", "d", playerid);
return 1;
}
Alles anzeigen
SaveCharacter
stock SaveCharacter(playerid)
{
new string[1024],hour, minute, second,year, month, day;
new tag,monat,jahr,stunde,minuten,sekunde;
gettime(hour, minute, second);
getdate(year, month, day);
GetPlayerPos(playerid, CharacterInfo[playerid][character_Pos][0], CharacterInfo[playerid][character_Pos][1], CharacterInfo[playerid][character_Pos][2]);
GetPlayerFacingAngle(playerid, CharacterInfo[playerid][character_Pos][3]);
CharacterInfo[playerid][character_Interior] = GetPlayerInterior(playerid);
CharacterInfo[playerid][character_World] = GetPlayerVirtualWorld(playerid);
GetPlayerHealth(playerid,CharacterInfo[playerid][character_Health]);
GetPlayerArmour(playerid,CharacterInfo[playerid][character_Armour]);
//format(AccountInfo[playerid][account_Register], 50, "%02d.%02d.%d | %02d:%02d:%02d ",tag,monat,jahr,stunde,minuten,sekunde);
//format(AccountInfo[playerid][account_LastLogin], 50, "%02d.%02d.%d | %02d:%02d:%02d ",day,month,year,hour,minute,second);
//format(CharacterInfo[playerid][character_LastLogin], 50, "%02d.%02d.%d | %02d:%02d:%02d ",day,month,year,hour,minute,second);
/* LEBEN,RÜSTUNG,ESSEN,TRINKEN,LEVEL,RESPEKTPUNKTE */
mysql_format(handle, string, sizeof(string), "UPDATE `character` SET `Health` = '%f',`Armour` = '%f', `Food` = '%d', `Thirst` = '%d', `Level` = '%d', `Respektpunkte` = '%d', `LastLogin` = '%e' WHERE `ID` = '%d'",
CharacterInfo[playerid][character_Health],CharacterInfo[playerid][character_Armour],CharacterInfo[playerid][character_Food],CharacterInfo[playerid][character_Thirst],CharacterInfo[playerid][character_Level],CharacterInfo[playerid][character_Respektpunkte],
CharacterInfo[playerid][character_LastLogin],CharacterInfo[playerid][character_ID]);
mysql_tquery(handle,string);
/* SKINS,GELD,X,Y,Z,R */
mysql_format(handle, string, sizeof(string), "UPDATE `character` SET `Skin` = '%d|%d|%d',`Geld` = '%.2f', `X` = '%f', `Y` = '%f', `Z` = '%f', `R` = '%f' WHERE `ID` = '%d'",
CharacterInfo[playerid][character_Skin][0],CharacterInfo[playerid][character_Skin][1],CharacterInfo[playerid][character_Skin][2],CharacterInfo[playerid][character_Geld],
CharacterInfo[playerid][character_Pos][0], CharacterInfo[playerid][character_Pos][1], CharacterInfo[playerid][character_Pos][2],CharacterInfo[playerid][character_Pos][3],
CharacterInfo[playerid][character_ID]);
mysql_tquery(handle,string);
/* INT,WORLD,FRAKTION,RANG,JOB,DUTY */
mysql_format(handle, string, sizeof(string), "UPDATE `character` SET `Interior` = '%i',`World` = '%i', `Fraktion` = '%d', `Rang` = '%d', `Job` = '%d', `Duty` = '%d' WHERE `ID` = '%d'",
CharacterInfo[playerid][character_Interior],CharacterInfo[playerid][character_World],CharacterInfo[playerid][character_Fraktion],CharacterInfo[playerid][character_Rang],
CharacterInfo[playerid][character_Job],CharacterInfo[playerid][character_Duty],CharacterInfo[playerid][character_ID]);
mysql_tquery(handle,string);
/* Inventar */
mysql_format(handle,string,sizeof(string),"DELETE FROM `inventory` WHERE `CharacterID`='%d'",CharacterInfo[playerid][character_ID]);
mysql_tquery(handle,string);
for(new i; i<MAX_INV_SLOT; i++)
{
if(!Inventory[playerid][i][inventory_Name]) continue;
mysql_format(handle,string,sizeof(string),"INSERT INTO `inventory` (`CharacterID`,`RefID`,`Item`) VALUES ('%d','%d','%d')",
CharacterInfo[playerid][character_ID],Inventory[playerid][i][inventory_Ref],Inventory[playerid][i][inventory_Name]);
mysql_tquery(handle,string);
}
return 1;
}
Alles anzeigen
CheckPassword
FUNCTION CheckPassword(playerid)
{
new bool:match = bcrypt_is_equal(),string[512],string1[80];
if(!match)
{
SendFehler(playerid,"Das angegebene Passwort ist falsch");
format(string1, sizeof(string1), "{FF0000}%s{FFFFFF} - Anmeldung",ServerInfo[0][server_Name]);
format(string,sizeof(string),"{FFFFFF}Willkommen zurück auf {FF0000}%s{FFFFFF}, {E8BD1A}%s{FFFFFF}.\nBitte gebe dein Passwort ein.",ServerInfo[0][server_Name],AccountInfo[playerid][account_Name]);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, string1,string, "{FFFFFF}Weiter", "{FFFFFF}Abbrechen");
cache_get_value_name_int(0, "Interact", AccountInfo[playerid][account_Interact]);
//SetTimerEx("TextDrawSelect",500,false,"i",playerid);
return 1;
}
else
{
new tag,monat,jahr,stunde,minuten,sekunde;
format(AccountInfo[playerid][account_Register], 50, "%02d.%02d.%d | %02d:%02d:%02d ",tag,monat,jahr,stunde,minuten,sekunde);
mysql_format(handle,string,sizeof(string),"SELECT * FROM `accounts` WHERE `Name` = '%e'",AccountInfo[playerid][account_Name]);
mysql_tquery(handle,string,"AccountLogin","d",playerid);
}
return 1;
}
Alles anzeigen
Edit: Fehler bei Werten im Dialog ausgebessert