Login Script

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
  • Hab ein Filterscript, das ich aber nicht hinbekomme. Ich hoffe ihr könnt mir helfen.



    #include <a_samp>
    #include <core>
    #include <float>


    #define COLOR_GREEN 0x33AA33AA
    #define dcmd(%1,%2,%3) if ((strcmp(%3, "/%1", true, %2+1) == 0)&&(((%3[%2+1]==0)&&(dcmd_%1(playerid,"")))||((%3[%2+1]==32)&&(dcmd_%1(playerid,%3[%2+2]))))) return 1


    new PLAYERLIST_authed[MAX_PLAYERS];
    new IsSpawned[MAX_PLAYERS];


    main()
    {
    print("------------------------------------");
    print(" Login Script ");
    print("------------------------------------");
    }


    public OnPlayerConnect(playerid)
    {
    SendClientMessage(playerid, COLOR_GREEN, "Login Script");
    return 1;
    }


    dcmd_register(playerid,params[]) {


    // The command shouldn't work if we already are authed
    if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"*** Already authed.");


    // The command shouldn't work if an account with this
    // nick already exists
    if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"*** Account already exists, please use '/login password'.");


    // Did he forgot the password?
    if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '*** /register password'");


    // We save the money to the accstate
    if (udb_Create(PlayerName(playerid),params)) return SystemMsg(playerid,"*** Account successfully created. Login with '/login password' now.");
    return true;


    }


    dcmd_login(playerid,params[]) {
    if(IsSpawned[playerid] == 1){
    // The command shouldn't work if we already are authed
    if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"*** Already authed.");


    // The command shouldn't work if an account with this
    // nick does not exists
    if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"*** Account doesn't exist, please use '/register password'.");


    // Did he forgot the password?
    if (strlen(params)==0) return SystemMsg(playerid,"*** Correct usage: '/login password'");


    if (udb_CheckLogin(PlayerName(playerid),params)) {
    // Login was correct


    // Following thing is the same like the missing SetPlayerCommand
    GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
    GivePlayerWeapon(playerid,dUserINT(PlayerName(playerid)).("shotgun"),99999);
    GivePlayerWeapon(playerid,dUserINT(PlayerName(playerid)).("pistole"),99999);
    GivePlayerWeapon(playerid,dUserINT(PlayerName(playerid)).("mitra"),99999);
    shotgun[playerid] = dUserINT(PlayerName(playerid)).("shotgun");
    pistole[playerid] = dUserINT(PlayerName(playerid)).("pistole");
    mitra[playerid] = dUserINT(PlayerName(playerid)).("mitra");
    bank[playerid] = dUserINT(PlayerName(playerid)).("bank");
    character[playerid] = dUserINT(PlayerName(playerid)).("character");
    PLAYERLIST_authed[playerid]=true;
    if(GetPlayerMoney(playerid) == 0){
    GivePlayerMoney(playerid,5000);
    }
    if(character[playerid] != 0){
    SetPlayerSkin(playerid, character[playerid]);
    }
    return SystemMsg(playerid,"*** Successfully authed!");
    } else {
    // Login was incorrect
    return SystemMsg(playerid,"*** Login failed!");
    }
    }else{SystemMsg(playerid,"*** Spawn before logging!"); }
    return true;
    }

    public OnPlayerCommandText(playerid, cmdtext[], i)
    {
    new cmd[256];
    new idx;
    new say[256];


    dcmd(login,5,cmdtext); // because login has 5 characters
    dcmd(register,8,cmdtext); // because register has 8 characters


    if (PLAYERLIST_authed[playerid]) {


    }
    return 0;
    }


    public SystemMsg(playerid,msg[]) {
    if ((IsPlayerConnected(playerid))&&(strlen(msg)>0)) {
    SendClientMessage(playerid,COLOR_SYSTEM,msg);
    }
    return 1;
    }




    Schon mal Danke. Für euere Hilfe

  • Warum funktioniert das nicht wenn ich das ganze script kopiere , mir die Dudb-datei runterlade und im script einfüge?


    Beim compilen wird mir dann das angezeigt:


    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(32) : error 017: undefined symbol "PlayerName"
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(38) : error 017: undefined symbol "PlayerName"
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(50) : error 017: undefined symbol "PlayerName"
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(55) : error 017: undefined symbol "PlayerName"
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(59) : error 017: undefined symbol "PlayerName"
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(60) : error 017: undefined symbol "PlayerName"
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(61) : error 017: undefined symbol "PlayerName"
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(62) : error 017: undefined symbol "PlayerName"
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(63) : error 017: undefined symbol "shotgun"
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(63) : warning 215: expression has no effect
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(63) : error 001: expected token: ";", but found "]"
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(63) : error 029: invalid expression, assumed zero
    D:\Grand Theft Auto San Andreas multiplayer\samp022server.win32\pawno\login.pwn(63) : fatal error 107: too many error messages on one line


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



    12 Errors.


    mein script ist im anhang

  • Ok,
    nachdem ich


    stock PlayerName(playerid)
    {
    new name[36];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
    }


    eingefügt habe habe ich noch folgende fehler:


    C:\DOKUME~1\ADMINI~1\Desktop\Internet\DOWNLO~1\gta\script\LOGINR~1\login.pwn(69) : error 017: undefined symbol "shotgun"
    C:\DOKUME~1\ADMINI~1\Desktop\Internet\DOWNLO~1\gta\script\LOGINR~1\login.pwn(69) : warning 215: expression has no effect
    C:\DOKUME~1\ADMINI~1\Desktop\Internet\DOWNLO~1\gta\script\LOGINR~1\login.pwn(69) : error 001: expected token: ";", but found "]"
    C:\DOKUME~1\ADMINI~1\Desktop\Internet\DOWNLO~1\gta\script\LOGINR~1\login.pwn(69) : error 029: invalid expression, assumed zero
    C:\DOKUME~1\ADMINI~1\Desktop\Internet\DOWNLO~1\gta\script\LOGINR~1\login.pwn(69) : fatal error 107: too many error messages on one line


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



    4 Errors.


    Wie kann ich die waffen definieren?
    Oder was ist wenn ich die einfach weglasse?