score wird nicht gespeichert, warum? need help

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
  • ich komm nicht weiter, es wird kein score gespeichert. wer kann mir helfen



    #include <a_samp>
    #include <dini>
    #include "dudb"
    #define SERVER_NAME "Team SRT Deathmatch" // Enter your server name here!
    #define TEAM_1 1
    #define TEAM_2 2
    #define TEAM_3 3
    #pragma unused ret_memcpy
    #define ADMIN_SPEC_TYPE_NONE 0
    #define ADMIN_SPEC_TYPE_PLAYER 1
    #define ADMIN_SPEC_TYPE_VEHICLE 2
    #define SPECIAL_ACTION_PISSING 68
    #define ADMINFS_MESSAGE_COLOR 0xFF0000FF
    #define PM_INCOMING_COLOR 0xFFFF22AA
    #define PM_OUTGOING_COLOR 0xFFCC2299
    #define DIALOG_LOGIN 1
    #define DIALOG_REG 2


    enum spieler_daten
    {
    eingeloggt,
    Admin,
    Geld,
    Score
    }
    new Spieler[MAX_PLAYERS][spieler_daten];


    new bool:FirstPress[MAX_PLAYERS];
    new bool:InDmZone[MAX_PLAYERS];
    new bool:suicide[MAX_PLAYERS];
    new pmsoff[MAX_PLAYERS];
    new giveplayerid;
    new gSpectateID[MAX_PLAYERS];
    new gSpectateType[MAX_PLAYERS];
    forward DrunkMSG(playerid);
    forward SendMSG();
    forward die(playerid);
    //new tmp[MAX_STRING];
    #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
    #pragma tabsize 0
    new gTeam[MAX_PLAYERS];
    new inf[MAX_PLAYERS];
    new Float:Pos[MAX_PLAYERS][4];
    new RandomMSG[][] =
    {
    "Haltet euch an die Regeln! Team SRT sieht alles!" // This message appear every meanwhile, Feel free to change it.
    };


    main()
    {
    print("Gang War Training");
    }
    public OnGameModeInit()
    {
    SetTimer("SendMSG", 600000, true);
    SetGameModeText("Team SRT DM");
    ShowPlayerMarkers(1);
    ShowNameTags(1);
    AllowInteriorWeapons(1);
    DisableInteriorEnterExits();
    //Gay Bikers
    AddPlayerClass(100,-85.9417,1375.1703,10.2734,281.0971,24,100,0,0,0,0); //
    AddPlayerClass(247,-85.9417,1375.1703,10.2734,281.0971,29,100,0,0,0,0); //
    //Mafia
    AddPlayerClass(221,-685.3557,928.3540,13.6293,179.5008,24,100,0,0,0,0); //
    AddPlayerClass(213,-685.3557,928.3540,13.6293,179.5008,29,500,0,0,0,0); //
    //President
    AddPlayerClass(113, -2625.9587,1394.3763,7.1016,178.6232,29,500,0,0,0,0);
    return 1;
    }
    public SendMSG()
    {
    new randMSG = random(sizeof(RandomMSG));
    SendClientMessageToAll(0xFFAA00FF, RandomMSG[randMSG]);
    return 1;
    }
    public OnPlayerConnect(playerid)
    {
    /*new name[MAX_PLAYER_NAME], string[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "*** %s (%d) Has Joined The Server.", name);
    SendClientMessageToAll(COLOR_LIGHTBLUE, string);*/
    SendClientMessage(playerid, 0xFFFFFFFF, "");
    FirstPress[playerid] = true;
    InDmZone[playerid] = false;
    suicide[playerid] = false;
    pmsoff[playerid] = 0;

    new string[64];
    new pname[MAX_PLAYERS],accFormat[128];
    GetPlayerName(playerid,pname,sizeof pname);
    format(accFormat,sizeof accFormat,"Spieler/%s.ini",pname); //Prüft ob Datei schon Existiert
    if(fexist(accFormat))
    {
    ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Dein Account wurde gefunden! Du kannst dich nun Einloggen.","Abbrechen","Weiter");
    format(string, sizeof(string), "Herzlich Willkommen %s!", pname) ;
    }
    else // Wenn nicht schreibt er:
    {
    ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","{FFFFFF}Dein Account wurde {CC0000}nicht{FFFFFF} gefunden. Wir freuen uns das du unseren\n Server gefunden hast. Bitte gib dein Passwort ein!","Abbrechen","Weiter");
    GivePlayerMoney(playerid, 15000); // GGF. ANPASSEN !!!!
    }
    }
    public OnPlayerDisconnect(playerid, reason)
    {
    new PlayerName[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    switch (reason)
    {
    case 0: format(str, sizeof(str), "*** %s (%d) Has Left The Server. (Timeout)", PlayerName, playerid);
    case 1: format(str, sizeof(str), "*** %s (%d) Has Left The Server. (Quit)", PlayerName, playerid);
    case 2: format(str, sizeof(str), "*** %s (%d) Has Left The Server. (Kicked)", PlayerName, playerid);
    }
    SendClientMessageToAll(0x9F9F9FFF, str);

    new pname[MAX_PLAYERS],accFormat[128];
    GetPlayerName(playerid,pname,sizeof pname);
    format(accFormat,sizeof accFormat,"Spieler/%s.ini",pname);//Öffnet seine Datei
    if(fexist(accFormat) && Spieler[playerid][eingeloggt])
    {//Speichert alles<!>
    dini_IntSet(accFormat,"Admin",Spieler[playerid][Admin]);
    dini_IntSet(accFormat,"Geld",Spieler[playerid][Geld]);
    //dini_IntSet(accFormat,"Score",Spieler[playerid][Score]);
    }
    Spieler[playerid][eingeloggt] = 0;// Loggt den Spieler aus der Dini aus
    }
    public OnPlayerRequestClass(playerid, classid)
    {
    SetPlayerInterior(playerid,0);
    SetPlayerFacingAngle(playerid,45.0);
    SetPlayerPos(playerid,-1521.0341,677.5056,139.2734);
    SetPlayerCameraPos(playerid,-1524.9583,681.2976,136.5882);
    SetPlayerCameraLookAt(playerid,-1521.0341,677.5056,139.2734);
    if(FirstPress[playerid] == true)
    {
    FirstPress[playerid] = false;
    ApplyAnimation(playerid,"DANCING","DANCE_LOOP",4.1,1,1,1,1,1);
    }
    ApplyAnimation(playerid,"DANCING","DANCE_LOOP",4.1,1,1,1,1,1);
    if(classid == 0 || classid == 1)
    {
    gTeam[playerid] = TEAM_1;
    GameTextForPlayer(playerid, "~r~Team1", 1000,3);
    }
    else if(classid == 2 || classid == 3)
    {
    gTeam[playerid] = TEAM_2;
    GameTextForPlayer(playerid, "~g~Team2", 1000,3);
    }
    else if(classid == 4)
    {
    gTeam[playerid] = TEAM_3;
    GameTextForPlayer(playerid, "~b~Team3", 1000,3);
    }
    return 1;
    }
    public OnPlayerSpawn(playerid)
    {
    SetPlayerInterior(playerid,0);
    if(gTeam[playerid] == TEAM_1)
    SetPlayerColor(playerid, 0xFF0000FF);
    else if(gTeam[playerid] == TEAM_2)
    SetPlayerColor(playerid, 0x00FF00FF);
    else if(gTeam[playerid] == TEAM_3)
    SetPlayerColor(playerid, 0x0000FFFF);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid, 24, 100);
    GivePlayerWeapon(playerid, 29, 1500);
    return 1;
    }
    public OnPlayerDeath(playerid, killerid, reason)
    {
    new str[80], fName[MAX_PLAYER_NAME], sName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,sName,MAX_PLAYER_NAME);
    if(killerid == INVALID_PLAYER_ID)
    {
    if(GetPlayerDrunkLevel(playerid) > 20000)
    {
    format(str,sizeof(str),"%s (%i) ist an einer Alkoholvergiftung gestorben.",sName,playerid);
    SendClientMessageToAll(0xBB0000FF,str);
    }
    else if(suicide[playerid] == true)
    {
    SendDeathMessage(INVALID_PLAYER_ID, playerid, reason);
    GameTextForPlayer(playerid, "~r~selbstmord",4000,2);
    format(str,sizeof(str),"%s (%i) hat Selbsmord begangen.",sName,playerid);
    SendClientMessageToAll(COLOR_PINK,str);
    suicide[playerid] = false;
    }
    else
    {
    SendDeathMessage(INVALID_PLAYER_ID, playerid, reason);
    GameTextForPlayer(playerid, "~r~Wasted",4000,2);
    format(str,sizeof(str),"%s (%i) ist gestorben.",sName,playerid);
    SendClientMessageToAll(0xBB0000FF,str);
    }
    }
    else
    {
    if(suicide[playerid] == true)
    {
    SendDeathMessage(INVALID_PLAYER_ID, playerid, reason);
    GameTextForPlayer(playerid, "~r~selbstmord",4000,2);
    format(str,sizeof(str),"%s (%i) hat Selbsmord begangen.",sName,playerid);
    SendClientMessageToAll(COLOR_PINK,str);
    suicide[playerid] = false;
    }
    else
    {
    GetPlayerName(killerid,fName,MAX_PLAYER_NAME);
    /*format(str,sizeof(str),"%s (%i) wurde von %s (%i) mittels %s getötet.",sName,playerid,fName,killerid,aWeaponNames[reason]);
    SendClientMessageToAll(0xBB0000FF,str);*/
    SendDeathMessage(killerid, playerid, reason);
    if(gTeam[killerid] != gTeam[playerid])
    {
    SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    new pname[MAX_PLAYERS],accFormat[128];
    GetPlayerName(playerid,pname,sizeof pname);
    format(accFormat,sizeof accFormat,"Spieler/%s.ini",pname);
    dini_IntSet(accFormat,"Score",Spieler[playerid][Score]);
    GameTextForPlayer(killerid, "~b~treffer",2000,1);
    GivePlayerMoney(killerid, 2500);
    GameTextForPlayer(playerid, "~r~owned",2000,1);
    }
    }
    }
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, 10100);
    SetPlayerWantedLevel(playerid, 0);
    InDmZone[playerid] = false;
    return 1;
    }


    public OnPlayerText(playerid, text[])
    {
    if(text[0] == '!')
    {
    new gangChat[256];
    new playername[MAX_PLAYER_NAME];
    new string[256];
    strmid(gangChat,text,1,strlen(text));
    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
    format(string, sizeof(string),"%s [TeamChat]: %s", playername, gangChat);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(gTeam[i] == gTeam[playerid])
    {
    SendClientMessage(i, COLOR_YELLOW, string);
    }
    }
    return 0;
    }
    return 1;
    }
    dcmd_spec(playerid, params[])
    {
    new tmp[MAX_STRING];
    new index = 0;
    tmp = strtok(params, index);
    if(!strlen(tmp))
    {
    SystemMessage(playerid, "Tippe: /spec [ID]");
    return 1;
    }
    new string[MAX_STRING];
    giveplayerid = ReturnUser(tmp);
    if(IsPlayerConnected(giveplayerid))
    {
    format(string, sizeof(string), "%s schaut %s zu.", PlayerN(playerid), PlayerN(giveplayerid));
    SendClientMessageToAll(COLOR_BLUE, string);
    TogglePlayerSpectating(playerid, 1);
    PlayerSpectatePlayer(playerid, giveplayerid);
    SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
    gSpectateID[playerid] = giveplayerid;
    gSpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
    }
    else
    {
    format(string, sizeof(string), "Der Spieler ist disconnected.");
    SystemMessage(playerid, string);
    }
    return 1;
    }
    dcmd_specoff(playerid, params[])
    {
    #pragma unused params
    TogglePlayerSpectating(playerid, 0);
    gSpectateID[playerid] = INVALID_PLAYER_ID;
    gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
    return 1;
    }
    stock SystemMessage(playerid, message[])
    {
    if ((IsPlayerConnected(playerid)) && (strlen(message) > 0))
    {
    SendClientMessage(playerid, COLOR_SYSTEM, message);
    }
    return 1;
    }
    ReturnUser(text[], playerid = INVALID_PLAYER_ID)
    {
    new pos = 0;
    while (text[pos] < 0x21)
    {
    if (text[pos] == 0) return INVALID_PLAYER_ID;
    pos++;
    }
    new userid = INVALID_PLAYER_ID;
    if (IsNumeric(text[pos]))
    {
    userid = strval(text[pos]);
    if (userid >=0 && userid < MAX_PLAYERS)
    {
    if(!IsPlayerConnected(userid))
    {
    userid = INVALID_PLAYER_ID;
    }
    else
    {
    return userid;
    }
    }
    }
    new len = strlen(text[pos]);
    new count = 0;
    new name[MAX_PLAYER_NAME];
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
    if (IsPlayerConnected(i))
    {
    GetPlayerName(i, name, sizeof (name));
    if (strcmp(name, text[pos], true, len) == 0)
    {
    if (len == strlen(name))
    {
    return i;
    }
    else
    {
    count++;
    userid = i;
    }
    }
    }
    }
    if (count != 1)
    {
    if (playerid != INVALID_PLAYER_ID)
    {
    if (count)
    {
    SendClientMessage(playerid, COLOR_SYSTEM, "Schreibe den ganzen Nick.");
    }
    else
    {
    SendClientMessage(playerid, COLOR_SYSTEM, "Nicht gefunden.");
    }
    }
    userid = INVALID_PLAYER_ID;
    }
    return userid;
    }
    stock Wait(time)
    {
    new stamp = tickcount();
    while (tickcount() - stamp < time){}
    return 1;
    }
    stock IsNumeric(const string[])
    {
    for (new i = 0, j = strlen(string); i < j; i++)
    if (string[i] > '9' || string[i] < '0')
    return 0;
    return 1;
    }
    stock SystemMessageToAll(message[])
    {
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if ((IsPlayerConnected(i)) && (strlen(message) > 0))
    {
    SendClientMessage(i, COLOR_SYSTEM, message);
    }
    }
    return 1;
    }
    stock PlayerN(playerid)
    {
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
    }
    stock PlayerIp(playerid)
    {
    new ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));
    return ip;
    }
    public DrunkMSG(playerid)
    {
    if(GetPlayerDrunkLevel(playerid) > 8000 && GetPlayerDrunkLevel(playerid) < 13999)
    {
    ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
    }
    if(GetPlayerDrunkLevel(playerid) > 14000 && GetPlayerDrunkLevel(playerid) < 19999)
    {
    ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
    }
    if(GetPlayerDrunkLevel(playerid) > 20000)
    {
    SetTimerEx("die", 5000, false, "d", playerid);
    ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 1, 1, 0, 0);
    }
    return 1;
    }
    public die(playerid)
    {
    SetPlayerHealth(playerid, 0.0);
    return 1;
    }
    stock GetDistanceBetweenPlayers(playerid, playerid2)
    {
    new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2;
    new Float:tmpdis;
    GetPlayerPos(playerid, x1, y1, z1);
    GetPlayerPos(playerid2, x2, y2, z2);
    tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2, x1)), 2) + floatpower(floatabs(floatsub(y2, y1)), 2) + floatpower(floatabs(floatsub(z2, z1)), 2));
    return floatround(tmpdis);
    }
    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    new pname[MAX_PLAYERS],accFormat[128];
    GetPlayerName(playerid,pname,sizeof pname);
    format(accFormat,sizeof accFormat,"Spieler/%s.ini",pname);//Sucht Spieler's Datei
    if(response)
    {
    switch(dialogid)
    {
    case DIALOG_LOGIN:// Wenn gefunden:
    {
    if(!strlen(inputtext))
    {
    ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Dein Account wurde gefunden! Du kannst dich nun Einloggen.","Abbrechen","Weiter");
    return SendClientMessage(playerid,0xFFFFFFFF,"Du hast kein Passwort angegeben!");// Keine Passwort eingabe
    }
    if(strcmp(inputtext,dini_Get(accFormat,"Passwort")) == 0)//Wenn man erfolgreich Eingeloggt ist...
    {//Lädt alles auser der Dini
    Spieler[playerid][eingeloggt] = 1;
    SetPlayerScore(playerid, dini_Int(accFormat, "Score"));
    GivePlayerMoney(playerid, dini_Int(accFormat, "Geld")-GetPlayerMoney(playerid));
    Spieler[playerid][Admin] = dini_Int(accFormat, "Admin");
    SendClientMessage(playerid,0xFFFFFFFF,"Du hast dich {CC0000}Eingeloggt{FFFFFF}.");
    }
    else//Wenn das Passwort falsch ist
    {
    ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Dein Account wurde gefunden! Du kannst dich nun Einloggen.","Abbrechen","Weiter");
    SendClientMessage(playerid,0xFFFFFFFF,"Du hast ein falsches Passwort eingegeben!");
    }
    }
    case DIALOG_REG:// Datei nicht gefunden
    {
    if(!strlen(inputtext))
    {
    ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","Bitte Registriere dich","Abbrechen","Weiter");
    return SendClientMessage(playerid,0xFFFFFFFF,"Dein Passwort ist zukurz!");
    }// Erstellt die Ini Datei für den Spieler mit allem auf 0
    dini_Create(accFormat);
    dini_Set(accFormat,"Passwort",inputtext);
    dini_IntSet(accFormat, "Admin" , 0);
    dini_IntSet(accFormat, "Score", 0);
    dini_IntSet(accFormat, "Geld", 0);
    Spieler[playerid][Admin] = 0;
    Spieler[playerid][eingeloggt] = 1;//Loggt den Spieler automatisch ein
    SendClientMessage(playerid,0xFFFFFFFF,"Du hast dir einen Account auf /*DEINNAME*/ angelegt. Viel Spaß!");
    }
    }
    }
    else
    {
    switch(dialogid)//Bei falschem Passwort
    {
    case DIALOG_LOGIN:ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Abbrechen","Weiter");
    case DIALOG_REG:ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","{FFFFFF}Dein Account wurde {CC0000}nicht{FFFFFF} gefunden. Wir freuen uns das du unseren\n Server gefunden hast. Bitte gib dein Passwort ein!","Abbrechen","Weiter");
    }
    }
    if(strcmp(inputtext,dini_Get(accFormat,"Passwort")) == 0)//Erfolgreich eingeloggt
    {
    Spieler[playerid][Admin] = dini_Int(accFormat, "Admin"); // Das Level wird aus der Datei geladen
    SetPlayerScore(playerid, dini_Int(accFormat, "Score"));
    GivePlayerMoney(playerid, dini_Int(accFormat, "Geld")-GetPlayerMoney(playerid));
    Spieler[playerid][eingeloggt] = 1;
    SendClientMessage(playerid,0xFFFFFFFF,"Du wurdest erfolgreich eingeloggt.");
    }
    return 1;
    }

  • Also falls du den Score von der anzeigetafel willst musste es so machen
    new score = GetPlayerScore(playerid);
    dini_IntSet(accFormat,"Score",score);
    und wenn du den Score hochsetzen willst dann SetPlayerScore(playerid,GetPlayerScore(playerid)+1);

    Zitat

    naja aufm homeserver mit kumpel getestet und nix laggt von daher sollte nen richtiger server mit sowas keine probs haben

    *an Kopf schlag
    sowas kommt Raus wenn man erst absendet ohne nachzudenken. Bitte Leute Hirn einschalten beim Posten...

  • aber vergiss SetPlayerScore nicht ansonsten bleibt das nun auch wieder der gleiche ;)^^

    Zitat

    naja aufm homeserver mit kumpel getestet und nix laggt von daher sollte nen richtiger server mit sowas keine probs haben

    *an Kopf schlag
    sowas kommt Raus wenn man erst absendet ohne nachzudenken. Bitte Leute Hirn einschalten beim Posten...