MYSQL Problem

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Guten Tag Community,


    ich habe hier 10error und weis nicht warum die kommen


    Spoiler anzeigen
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(40) : error 017: undefined symbol "DatabaseConnect"
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(51) : error 017: undefined symbol "Speichern"
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(65) : error 017: undefined symbol "mysql_CheckAccount"
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(70) : error 017: undefined symbol "mysql_CheckAccount"
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(77) : error 017: undefined symbol "Speichern"
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(121) : error 017: undefined symbol "Login"
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(123) : warning 217: loose indentation
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(125) : error 017: undefined symbol "PasswortVs"
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(125) : warning 215: expression has no effect
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(125) : error 001: expected token: ";", but found "]"
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(125) : error 029: invalid expression, assumed zero
    C:\Users\Koray Bircan\Desktop\Selfmade by Koray\gamemodes\selfmade by koray.pwn(125) : fatal error 107: too many error messages on one line

    Spoiler anzeigen
    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

    Spoiler anzeigen
    10 Errors.


    Wer mir helfen will sich soll sich per pn bei mir melden pls.


    MfG


    Master

  • Sry leute bin neu im Thema MYSQL und versuche es momentan zu lernen


    Wenn du es wirklich lernen willst, denn versuch die Fehler zu verstehen.


    B2T:


    Undefined Symbol heißt soviel wie:


    Das ist nicht definiert im Script (Nicht vorhanden)


    Engelsflügel am Astonkühler, als Schutz vor dem Teufel!

  • aber es ist vorhanden unter stock


    hier das Script ist regelrecht neu habe erst heute angefangen


    Spoiler anzeigen
    #include <a_samp>
    #include <a_mysql>
    #include <streamer>
    #include <ocmd>
    #include <MD5>

    Spoiler anzeigen
    #define Rot 0xFF1300FF
    #define Grün 0x2DDB24FF
    #define Weiß 0xFFFFFFAA
    #define Grau 0xAAAAAAFF
    #define HellBlau 0x33CCFFAA

    Spoiler anzeigen
    #define HOST "localhost"
    #define USER "root"
    #define PASSWORD ""
    #define DATABASE "selfmade"

    Spoiler anzeigen
    #define DIALOG_LOGIN (0)
    #define DIALOG_REGISTER (1)

    Spoiler anzeigen
    enum SpielerDaten
    {
    pName[MAX_PLAYER_NAME],
    pLevel,
    pGeld,
    pTod,
    Float:pHealth
    }
    new SpielerInfo[MAX_PLAYERS][SpielerDaten];

    Spoiler anzeigen
    main()
    {
    print("Erstellt von Koray");
    }

    Spoiler anzeigen
    public OnGameModeInit(){
    SetGameModeText("Selfmade by Koray");
    DisableInteriorEnterExits();
    UsePlayerPedAnims();
    DatabaseConnect();
    printf("Objekte Zählen %d.",CountDynamicObjects());
    }

    Spoiler anzeigen
    public OnGameModeExit()
    {
    for(new i = 0; i <MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    SavePlayer(i);
    }
    }
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerRequestClass(playerid,classid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerConnect(playerid){
    SetPlayerColor(playerid,0xFFFFFFFF);

    Spoiler anzeigen
    if(mysql_CheckAccount(playerid) == 1)
    {
    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","\nGebe bitte dein {1C6300}Passwort {FFFFFF}ein um dich zu Registrieren. \n\nEin {1C6300}Administrator {FFFFFF}wird dich niemals nach deinem {1C6300}Passwort {FFFFFF}fragen.","Login","");
    }

    Spoiler anzeigen
    else if(mysql_CheckAccount(playerid) == 0)
    {
    ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Registrieren","{FFFFFF}Willkommen auf German Extream Reallife. \nGebe bitte dein {1C6300}Passwort {FFFFFF}ein um dich zu Registrieren. \n\nEin {1C6300}Administrator {FFFFFF}wird dich niemals nach deinem {1C6300}Passwort {FFFFFF}fragen.","Registrieren","");
    }
    }

    Spoiler anzeigen
    public OnPlayerDisconnect(playerid,reason)
    {
    SavePlayer(playerid);
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerSpawn(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerDeath(playerid,killerid,reason)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerText(playerid,text[])
    {
    return 0;
    }

    Spoiler anzeigen
    public OnPlayerEnterCheckpoint(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerCommandText(playerid,cmdtext[])
    {
    return SendClientMessage(playerid,Rot,"Dieser Befehl Existiert nicht.");
    }

    Spoiler anzeigen
    public OnPlayerStateChange(playerid,newstate,oldstate)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
    {
    new string[128];
    if(dialogid == DIALOG_LOGIN)
    {
    if(response && strlen(inputtext) > 0){Login(playerid,inputtext);
    }
    else
    {
    PasswortVs[playerid] += 1;
    if(PasswortVs[playerid] == 2)
    {
    Kick(playerid);
    }
    SendClientMessage(playerid,Rot,"Falsches Passwort.");
    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Gebe bitte dein {1C6300}Passwort {FFFFFF}ein um fortzufahren.","Login","");
    return 1;
    }
    if(dialogid==DIALOG_REGISTER)
    {
    if(response && strlen(inputtext) > 0)
    {
    ShowPlayerDialog(playerid,DIALOG_TUTA,DIALOG_STYLE_MSGBOX,"Tutorial","Willkommen auf German Extream Reallife. \nDa du unseren Server nicht kennst, wird dir das wichtigte jetzt erläutert.","Fortfahren","");
    Register(playerid,MD5_Hash(inputtext));
    SpielerInfo[playerid][Regi] = 2;
    return 1;
    }
    else
    {
    SendClientMessage(playerid,Rot,"Du musst ein Passwort eingeben.");
    ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Registrieren","{FFFFFF}Gebe bitte dein {1C6300}Passwort {FFFFFF}ein um dich zu Registrieren. \n\nEin {1C6300}Administrator {FFFFFF}wird dich niemals nach deinem {1C6300}Passwort {FFFFFF}fragen.","Registrieren","");
    return 1;
    }
    }
    }
    stock Login(playerid,key[])
    {
    new name[32];
    GetPlayerName(playerid,name,sizeof(name));
    if(!strcmp(MD5_Hash(key), mysql_ReturnPasswort(name),true))
    {
    SendClientMessage(playerid,Grün,"Erfolgreich eingelogt.");
    Laden(playerid);
    return 1;
    }
    else
    {
    PasswortVs[playerid] += 1;
    if(PasswortVs[playerid] == 3)
    {
    Kick(playerid);
    }
    SendClientMessage(playerid,Rot,"Falsches Passwort.");
    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Gebe bitte dein {1C6300}Passwort {FFFFFF}ein um fortzufahren.","Login","");
    return 1;
    }
    }

    Spoiler anzeigen
    stock Register(playerid, pass[])
    {
    new query[256],Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    mysql_real_escape_string(pass,pass);
    format(query, sizeof(query), "INSERT INTO `Accounts` (`Name`, `Passwort`) VALUES ('%s', '%s')",Name,pass);
    mysql_query(query);
    SetPlayerScore(playerid,1);
    GivePlayerMoney(playerid,3000);
    SetPVarInt(playerid,"loggedin",1);
    return true;
    }

    Spoiler anzeigen
    stock mysql_CheckAccount(playerid)
    {
    new Query[128],Name[MAX_PLAYER_NAME],count;
    GetPlayerName(playerid, Name,MAX_PLAYER_NAME);
    mysql_real_escape_string(Name,Name);
    format(Query,sizeof(Query),"SELECT * FROM `Accounts` WHERE `Name` = '%s'",Name);
    mysql_query(Query);
    mysql_store_result();
    count = mysql_num_rows();
    mysql_free_result();
    return count;
    }

    Spoiler anzeigen
    stock mysql_ReturnPasswort(Name[]){
    new query[130],Get[130];
    mysql_real_escape_string(Name, Name);
    format(query,128,"SELECT `passwort` FROM `Accounts` WHERE `Name` = '%s'",Name);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_row(Get);
    mysql_free_result();
    return Get;
    }

    Spoiler anzeigen
    stock Laden(playerid)
    {
    new name[32];
    GetPlayerName(playerid,name,sizeof(name));
    SetPlayerScore(playerid,mysql_GetInt("Accounts","Level","Name",name));
    GivePlayerMoney(playerid,mysql_GetInt("Accounts","Geld","Name",name));
    SpielerInfo[playerid][Adminlevel] = mysql_GetInt("Accounts","Adminlevel","Name",name);
    SetPVarInt(playerid,"loggedin",1);
    SpawnPlayer(playerid);
    return 1;
    }

    Spoiler anzeigen
    stock SavePlayer(playerid)
    {
    if(GetPVarInt(playerid,"loggedin")==1)
    {
    new name[32];
    mysql_SetInt("Accounts","Level",GetPlayerScore(playerid),"Name",name);
    return 1;
    }
    return 1;
    }

    Spoiler anzeigen
    stock DatabaseConnect()
    {
    mysql_connect(HOST, USER, DATABASE, PASSWORD);
    if(mysql_ping() == 1)
    {
    return true;
    }
    else
    {
    mysql_connect(HOST,USER,DATABASE,PASSWORD);
    if(mysql_ping() == 1)
    {
    return true;
    }
    else
    {
    return SendRconCommand("exit");
    }
    }
    }

    Spoiler anzeigen
    stock sscanf(string[], format[], {Float,_}:...)
    {
    #if defined isnull
    if (isnull(string))
    #else
    if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
    #endif
    {
    return format[0];
    }
    #pragma tabsize 4
    new
    formatPos = 0,
    stringPos = 0,
    paramPos = 2,
    paramCount = numargs(),
    delim = ' ';
    while (string[stringPos] && string[stringPos] <= ' ')
    {
    stringPos++;
    }
    while (paramPos < paramCount && string[stringPos])
    {
    switch (format[formatPos++])
    {
    case '\0':
    {
    return 0;
    }
    case 'i', 'd':
    {
    new
    neg = 1,
    num = 0,
    ch = string[stringPos];
    if (ch == '-')
    {
    neg = -1;
    ch = string[++stringPos];
    }
    do
    {
    stringPos++;
    if ('0' <= ch <= '9')
    {
    num = (num * 10) + (ch - '0');
    }
    else
    {
    return -1;
    }
    }
    while ((ch = string[stringPos]) > ' ' && ch != delim);
    setarg(paramPos, 0, num * neg);
    }
    case 'h', 'x':
    {
    new
    num = 0,
    ch = string[stringPos];
    do
    {
    stringPos++;
    switch (ch)
    {
    case 'x', 'X':
    {
    num = 0;
    continue;
    }
    case '0' .. '9':
    {
    num = (num << 4) | (ch - '0');
    }
    case 'a' .. 'f':
    {
    num = (num << 4) | (ch - ('a' - 10));
    }
    case 'A' .. 'F':
    {
    num = (num << 4) | (ch - ('A' - 10));
    }
    default:
    {
    return -1;
    }
    }
    }
    while ((ch = string[stringPos]) > ' ' && ch != delim);
    setarg(paramPos, 0, num);
    }
    case 'c':
    {
    setarg(paramPos, 0, string[stringPos++]);
    }
    case 'f':
    {

    Spoiler anzeigen
    new changestr[16], changepos = 0, strpos = stringPos;
    while(changepos < 16 && string[strpos] && string[strpos] != delim)
    {
    changestr[changepos++] = string[strpos++];
    }
    changestr[changepos] = '\0';
    setarg(paramPos,0,_:floatstr(changestr));
    }
    case 'p':
    {
    delim = format[formatPos++];
    continue;
    }
    case '\'':
    {
    new
    end = formatPos - 1,
    ch;
    while ((ch = format[++end]) && ch != '\'') {}
    if (!ch)
    {
    return -1;
    }
    format[end] = '\0';
    if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
    {
    if (format[end + 1])
    {
    return -1;
    }
    return 0;
    }
    format[end] = '\'';
    stringPos = ch + (end - formatPos);
    formatPos = end + 1;
    }
    case 'u':
    {
    new
    end = stringPos - 1,
    id = 0,
    bool:num = true,
    ch;
    while ((ch = string[++end]) && ch != delim)
    {
    if (num)
    {
    if ('0' <= ch <= '9')
    {
    id = (id * 10) + (ch - '0');
    }
    else
    {
    num = false;
    }
    }
    }
    if (num && IsPlayerConnected(id))
    {
    setarg(paramPos, 0, id);
    }
    else
    {
    #if !defined foreach
    #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
    #define __SSCANF_FOREACH__
    #endif
    string[end] = '\0';
    num = false;
    new
    name[MAX_PLAYER_NAME];
    id = end - stringPos;
    foreach (Player, playerid)
    {
    GetPlayerName(playerid, name, sizeof (name));
    if (!strcmp(name, string[stringPos], true, id))
    {
    setarg(paramPos, 0, playerid);
    num = true;
    break;
    }
    }
    if (!num)
    {
    setarg(paramPos, 0, INVALID_PLAYER_ID);
    }
    string[end] = ch;
    #if defined __SSCANF_FOREACH__
    #undef foreach
    #undef __SSCANF_FOREACH__
    #endif
    }
    stringPos = end;
    }
    case 's', 'z':
    {
    new
    i = 0,
    ch;
    if (format[formatPos])
    {
    while ((ch = string[stringPos++]) && ch != delim)
    {
    setarg(paramPos, i++, ch);
    }
    if (!i)
    {
    return -1;
    }
    }
    else
    {
    while ((ch = string[stringPos++]))
    {
    setarg(paramPos, i++, ch);
    }
    }
    stringPos--;
    setarg(paramPos, i, '\0');
    }
    default:
    {
    continue;
    }
    }
    while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
    {
    stringPos++;
    }
    while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
    {
    stringPos++;
    }
    paramPos++;
    }
    do
    {
    if ((delim = format[formatPos++]) > ' ')
    {
    if (delim == '\'')
    {
    while ((delim = format[formatPos++]) && delim != '\'') {}
    }
    else if (delim != 'z')
    {
    return delim;
    }
    }
    }
    while (delim > ' ');
    return 0;
    }


    //edit


    benötige immer noch hilfe :(

    Einmal editiert, zuletzt von Master147 ()