Guten Tag, Ich habe mir grade ein Tutorial durchgelesen, Über Textdraws mit einen Programm erstellen und dann Als OnPlayerClick machen. Aber Der Hat nicht Alles gezeigt und Weil mein Login/Register System schon ein bischen weiter ausarbeitet ist, Weiß Ich nicht wie Das gehen Soll Ich poste mal unten Alles.
//Textdraw
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new Text:Textdraw3;
new Text:Textdraw4;
new Text:Textdraw5;
new Text:Textdraw6;
new PlayerText:Textdraw7[MAX_PLAYERS];
public OnGameModeInit()
{
Textdraw0 = TextDrawCreate(59.159591, 110.000030, "usebox");
TextDrawLetterSize(Textdraw0, 0.000000, 36.627773);
TextDrawTextSize(Textdraw0, 585.993957, 0.000000);
TextDrawAlignment(Textdraw0, 1);
TextDrawColor(Textdraw0, 0);
TextDrawUseBox(Textdraw0, true);
TextDrawBoxColor(Textdraw0, 102);
TextDrawSetShadow(Textdraw0, 0);
TextDrawSetOutline(Textdraw0, 0);
TextDrawFont(Textdraw0, 0);
Textdraw1 = TextDrawCreate(440.409973, 186.083297, "LD_SPAC:white");
TextDrawLetterSize(Textdraw1, 0.001402, -0.017500);
TextDrawTextSize(Textdraw1, -240.819900, 121.916633);
TextDrawAlignment(Textdraw1, 1);
TextDrawColor(Textdraw1, -1061109505);
TextDrawSetShadow(Textdraw1, 0);
TextDrawSetOutline(Textdraw1, 0);
TextDrawBackgroundColor(Textdraw1, -1061109505);
TextDrawFont(Textdraw1, 4);
Textdraw2 = TextDrawCreate(66.061508, 131.833389, "Tipp des Tages!");
TextDrawLetterSize(Textdraw2, 0.449999, 1.600000);
TextDrawAlignment(Textdraw2, 1);
TextDrawColor(Textdraw2, -16776961);
TextDrawSetShadow(Textdraw2, 0);
TextDrawSetOutline(Textdraw2, 1);
TextDrawBackgroundColor(Textdraw2, -1061109505);
TextDrawFont(Textdraw2, 3);
TextDrawSetProportional(Textdraw2, 1);
Textdraw3 = TextDrawCreate(454.465637, 132.416656, "Tipp der Woche!");
TextDrawLetterSize(Textdraw3, 0.449999, 1.600000);
TextDrawAlignment(Textdraw3, 1);
TextDrawColor(Textdraw3, 65413);
TextDrawSetShadow(Textdraw3, 0);
TextDrawSetOutline(Textdraw3, 1);
TextDrawBackgroundColor(Textdraw3, -1061109505);
TextDrawFont(Textdraw3, 3);
TextDrawSetProportional(Textdraw3, 1);
Textdraw4 = TextDrawCreate(220.205047, 366.916687, "DayDream-Roleplay");
TextDrawLetterSize(Textdraw4, 0.449999, 1.600000);
TextDrawAlignment(Textdraw4, 1);
TextDrawColor(Textdraw4, 16711935);
TextDrawSetShadow(Textdraw4, 0);
TextDrawSetOutline(Textdraw4, 1);
TextDrawBackgroundColor(Textdraw4, 65535);
TextDrawFont(Textdraw4, 2);
TextDrawSetProportional(Textdraw4, 1);
Textdraw5 = TextDrawCreate(91.361633, 229.833343, "Test");
TextDrawLetterSize(Textdraw5, 0.449999, 1.600000);
TextDrawAlignment(Textdraw5, 1);
TextDrawColor(Textdraw5, -1);
TextDrawSetShadow(Textdraw5, 0);
TextDrawSetOutline(Textdraw5, 1);
TextDrawBackgroundColor(Textdraw5, 51);
TextDrawFont(Textdraw5, 3);
TextDrawSetProportional(Textdraw5, 1);
Textdraw6 = TextDrawCreate(494.758514, 228.083343, "Test");
TextDrawLetterSize(Textdraw6, 0.449999, 1.600000);
TextDrawAlignment(Textdraw6, 1);
TextDrawColor(Textdraw6, -1);
TextDrawSetShadow(Textdraw6, 0);
TextDrawSetOutline(Textdraw6, 1);
TextDrawBackgroundColor(Textdraw6, 51);
TextDrawFont(Textdraw6, 2);
TextDrawSetProportional(Textdraw6, 1);
EnableStuntBonusForAll(0);
DisableInteriorEnterExits();
AntiDeAMX();
//Mysql
dbhandle = mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_DATA,MYSQL_PASS);
if(mysql_errno() < 1)print("MySQL: Die Verbindung wurde erfolgreich hergestellt."),mysql_log(LOG_DEBUG); else print("MySQL: Die Verbindung zur MySQL Datenbank konnte nicht hergestellt werden | Der Server wird nun heruntergefahren."), SendRconCommand("exit");
//Timer
SetTimer("ChangeServerName", 1000, 1);
SetTimer("mapname",3000,1);
SetTimer("gamemode",3000,1);
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnPlayerConnect(playerid)
{
Textdraw7[playerid] = CreatePlayerTextDraw(playerid, 243.162261, 234.500076, "Login/Register");
PlayerTextDrawLetterSize(playerid, Textdraw7[playerid], 0.449999, 1.600000);
PlayerTextDrawTextSize(playerid, Textdraw7[playerid], -69.341133, 205.916732);
PlayerTextDrawAlignment(playerid, Textdraw7[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw7[playerid], 65535);
PlayerTextDrawSetShadow(playerid, Textdraw7[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw7[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, Textdraw7[playerid], -1061109505);
PlayerTextDrawFont(playerid, Textdraw7[playerid], 2);
PlayerTextDrawSetProportional(playerid, Textdraw7[playerid], 1);
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
TextDrawShowForPlayer(playerid,Textdraw3);
TextDrawShowForPlayer(playerid,Textdraw4);
TextDrawShowForPlayer(playerid,Textdraw5);
TextDrawShowForPlayer(playerid,Textdraw6);
PlayerTextDrawShow(playerid,Textdraw7[playerid]);
SelectTextDraw(playerid, 0x00FF00FF);
new nachricht[128];
format(nachricht,sizeof(nachricht),"Du bist mit der ID %i verbunden.",playerid);
SendClientMessage(playerid,Rot,nachricht);
//Login/Register
new name[MAX_PLAYER_NAME],query[128];
GetPlayerName(playerid,name,sizeof(name));
format(query,sizeof(query),"SELECT id FROM spieler WHERE name='%s'",name);
mysql_function_query(dbhandle,query,true,"OnPlayerClickPlayerTextDraw","i",playerid);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==DIALOG_LOGIN)
{
if(response)
{
new name[MAX_PLAYER_NAME],query[128],passwort[35];
GetPlayerName(playerid,name,sizeof(name));
if(strlen(inputtext)>0)
{
mysql_escape_string(inputtext,passwort,dbhandle);
format(query,sizeof(query),"SELECT * FROM spieler WHERE name='%s' AND password=MD5('%s')",name,passwort);
mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid);
}
else
{
//Keine Eingabe
SendClientMessage(playerid,Rot,"Gibt bitte dein Passwort ein.");
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Herzlich Willkommen zurück auf dem Island-Roleplay Server. \nDie Datenbank hat einen Account unter diesen namen gefunden! \nBitte geben Sie ihr Passwort ein.","Login","Abbrechen");
}
}
else
{
Kick(playerid);
}
return 1;
}
if(dialogid==DIALOG_REGISTER)
{
if(response)
{
new name[MAX_PLAYER_NAME],query[128],passwort[35];
GetPlayerName(playerid,name,sizeof(name));
if(strlen(inputtext)>3)
{
//Registrierungsfunktion
mysql_escape_string(inputtext,passwort,dbhandle);
format(query,sizeof(query),"INSERT INTO spieler (name,password) VALUES ('%s',MD5('%s')) ",name,passwort);
mysql_function_query(dbhandle,query,true,"OnPlayerRegister","i",playerid);
SpawnPlayer(playerid);
SetPlayerSkin(playerid,22);
}
else
{
//Kleiner als 4 Zeichen
SendClientMessage(playerid,Rot,"Dein Passwort muss mindestens 4 Zeichen lang sein.");
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registrierung","Herzlich Willkommen auf dem Island-Roleplay Server. \n Die Datenbank hat keinen Account unter diesen namen gefunden! \nBitte erstellen Sie sich einen Account!","Registrieren","Abbrechen");
}
}
else
{
Kick(playerid);
}
return 1;
}
public OnPasswordResponse(playerid)
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandle);
if(num_rows==1)
{
//Passwort richtig
sStats[playerid][sEingeloggt] = 1;
sStats[playerid][sLevel] = cache_get_field_content_int(0,"Level",dbhandle);
SetPlayerScore(playerid,sStats[playerid][sLevel]);
sStats[playerid][sid] = cache_get_field_content_int(0,"id",dbhandle);
SetPlayerMoney(playerid,cache_get_field_content_int(0,"Money",dbhandle));
sStats[playerid][sAdmin] = cache_get_field_content_int(0,"Admin",dbhandle);
sStats[playerid][sWanteds] = cache_get_field_content_int(0,"Wanteds",dbhandle);
SetPlayerWantedLevel(playerid,sStats[playerid][sWanteds]);
sStats[playerid][sTimeBan] = cache_get_field_content_int(0,"TimeBan",dbhandle);
sStats[playerid][sWarning1] = cache_get_field_content_int(0,"Warning1",dbhandle);
sStats[playerid][sWarning2] = cache_get_field_content_int(0,"Warning2",dbhandle);
sStats[playerid][sWarning3] = cache_get_field_content_int(0,"Warning3",dbhandle);
SpawnPlayer(playerid);
SetPlayerSkin(playerid,22);
//Timeban
if(gettime()<sStats[playerid][sTimeBan] && sStats[playerid][sTimeBan] > 0)
{
new string[128];
new days,hours,mins;
new wartezeit = sStats[playerid][sTimeBan];
new restzeit= wartezeit -gettime();
days = floatround(restzeit / 86400,floatround_floor);
hours = restzeit - (days * 86400);
hours = floatround(hours / 3600,floatround_floor);
mins = restzeit - ( (days * 86400) + (hours * 3600) );
mins = floatround(mins / 60,floatround_floor);
format(string, sizeof(string), "Du bist noch für %d Minuten gebannt.(%d Stunden).",mins,hours);
SendClientMessage(playerid, Rot,string);
TogglePlayerControllable(playerid, false);
savePlayer(playerid);
Kick(playerid);
return 1;
}
else
{
sStats[playerid][sTimeBan] = 0;
}
if(sStats[playerid][sLevel] == 999)
{
sStats[playerid][sLevel] = 2;
return 1;
}
}
else
{
//Passwort falsch
SendClientMessage(playerid,Rot,"Das eingegebene Passwort ist falsch.");
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Herzlich Willkommen zurück auf dem Island-Roleplay Server. \nDie Datenbank hat einen Account unter diesen namen gefunden! \nBitte geben Sie ihr Passwort ein.","Login","Abbrechen");
}
return 1;
}
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
if(playertextid==Textdraw7[playerid])
{
new num_rows,num_fields;
cache_get_data(num_rows,num_fields,dbhandle);
if(num_rows==0)
{
//Registrierung
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registrierung","Herzlich Willkommen auf dem Island-Roleplay Server. \n Die Datenbank hat keinen Account unter diesen namen gefunden! \nBitte erstellen Sie sich einen Account!","Registrieren","Abbrechen");
}
else
{
//Login
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Herzlich Willkommen zurück auf dem Island-Roleplay Server. \nDie Datenbank hat einen Account unter diesen namen gefunden! \nBitte geben Sie ihr Passwort ein.","Login","Abbrechen");
}
}
return 1;
}