Wenn ich das richtig gelesen habe benutzt er eine "Datenbank" im Scriptfiles Ordner und nicht über MYSQL also PHPmyAdmin und so
//edit mit em SQL lite komm ich nicht zurecht sry
aber ich probiere da gerade an was rum und immer nach
Get Name OK schmiert server ab warum?
hier Code
public OnPlayerLogin(playerid,password[]) // by Luk0r v1.0
{
MySQLCheckConnection();
printf("Check OK");
// new tmp2[256];
new string2[256];
printf("String OK");
new playername2[MAX_PLAYER_NAME];
printf("new name OK");
GetPlayerName(playerid, playername2, sizeof(playername2));
printf("Get Name OK");
MySQLFetchAcctSingle(PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pKey]);
printf("PW OK");
if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
{
new Data[1024];
new Field[64];
new rcnt = 1;
MySQLFetchAcctRecord(PlayerInfo[playerid][pSQLID], Data);
samp_mysql_strtok(Field, "|", Data);
while (samp_mysql_strtok(Field, "|", "")==1)
{
// The rcnt values here represent the order of the columns in the characters table, so don't mess with them
// If you add a column to the table, just add a new line with a +1 rcnt to the block below
// Start it at 3 to skip the first few records we don't need (id, player name, password)
if (rcnt == 3) PlayerInfo[playerid][pLevel] = strval(Field);
rcnt++;
}
samp_mysql_free_result();
printf("Load OK");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Falsches Passwort");
//fclose(UserFile);
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
printf("PW OK");
return 1;
}
// Add an entry to the login log
/* new ipaddress[16];
GetPlayerIp(playerid,ipaddress,sizeof(ipaddress));
MySQLAddLoginRecord(PlayerInfo[playerid][pSQLID], ipaddress);*/
ClearChatbox(playerid, 8);
printf("Chat OK");
format(string2, sizeof(string2), "Willkommen auf [RoA] - Reallife on Air, %s.",playername2);
SendClientMessage(playerid, COLOR_WHITE, string2);
SendClientMessage(playerid, COLOR_WHITE, " ");
printf("%s hat sich eingeloggt.",playername2);
printf("All OK");
return 1;
}
public MySQLFetchAcctSingle(sqlplayerid, sqlvalname[], sqlresult[])
{
new query[128];
format(query, sizeof(query), "SELECT %s FROM players WHERE id = %d LIMIT 1", sqlvalname, sqlplayerid);
samp_mysql_query(query);
samp_mysql_store_result();
if(samp_mysql_fetch_row(sqlresult)==1)
{
return 1;
}
return 0;
}