String 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
  • Tag


    Ich bin gerade dabei mein Script von DINI auf MySQL zu machen nun habe ich folgendes Problem. Ich habe einen String den ich nicht Definiert bekomme.


    Wenn ich es ohne new string[128]; oder new string[256]; mache


    public OnPlayerRegister(playerid, password[])
    {
    if(IsPlayerConnected(playerid))
    {
    new name[MAX_PLAYER_NAME],zielip[MAX_PLAYERS];
    GetPlayerName(playerid,name,sizeof(name));
    if(GetPlayerId(playerid) < 1)
    {
    new ID = GetPlayerIdFromName(SpielerName(playerid));
    if(ID != -1) return SendClientMessage(playerid, cRed, "Spieler existiert bereits!");
    ID = CreateSql();
    SetPlayerId(playerid,ID);
    }
    {
    PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
    if(PlayerInfo[playerid][pSex]) PlayerInfo[playerid][pModel] = 101;
    else if(PlayerInfo[playerid][pSex] == 2) PlayerInfo[playerid][pModel] = 12;
    PlayerInfo[playerid][pHouseKey] = MAX_HOUSES+1;
    PlayerInfo[playerid][pRentHouseKey] = MAX_HOUSES+1;
    mysql_Set(playerid,"Key",password);
    mysql_SetInt(playerid,"Sicherheit", PlayerInfo[playerid][pSicherheit]);
    mysql_SetInt(playerid,"Nieban",PlayerInfo[playerid][pNieban]);
    mysql_SetInt(playerid,"Ban",PlayerInfo[playerid][pBan]);
    mysql_SetInt(playerid,"AdminLevel",PlayerInfo[playerid][pAdmin]);
    mysql_SetInt(playerid,"DonateRank",PlayerInfo[playerid][pDonateRank]);
    mysql_SetInt(playerid,"Registered",PlayerInfo[playerid][pReg]);
    mysql_SetInt(playerid,"Sex",PlayerInfo[playerid][pSex]);
    mysql_SetInt(playerid,"Age",PlayerInfo[playerid][pAge]);
    mysql_SetInt(playerid,"Origin",PlayerInfo[playerid][pOrigin]);
    mysql_SetInt(playerid,"Premium",PlayerInfo[playerid][pPrempunkte]);
    mysql_SetInt(playerid,"CK",PlayerInfo[playerid][pCK]);
    mysql_SetInt(playerid,"Muted",PlayerInfo[playerid][pMuted]);
    mysql_SetInt(playerid,"Respect",PlayerInfo[playerid][pExp]);
    mysql_SetInt(playerid,"RentCarKey", PlayerInfo[playerid][pRentCarKey]);
    mysql_SetInt(playerid,"Money",PlayerInfo[playerid][pCash]);
    mysql_SetInt(playerid,"Bank",PlayerInfo[playerid][pAccount]);
    mysql_SetInt(playerid,"Crimes",PlayerInfo[playerid][pCrimes]);
    mysql_SetInt(playerid,"Kills",PlayerInfo[playerid][pKills]);
    mysql_SetInt(playerid,"Deaths",PlayerInfo[playerid][pDeaths]);
    mysql_SetInt(playerid,"Arrested",PlayerInfo[playerid][pArrested]);
    mysql_SetInt(playerid,"WantedDeaths",PlayerInfo[playerid][pWantedDeaths]);
    mysql_SetInt(playerid,"Ticket",PlayerInfo[playerid][pTicket]);
    mysql_SetInt(playerid,"APTicket",PlayerInfo[playerid][pAPTicket]);
    mysql_SetInt(playerid,"Phonebook",PlayerInfo[playerid][pPhoneBook]);
    mysql_SetInt(playerid,"Level",PlayerInfo[playerid][pLevel]);
    mysql_SetInt(playerid,"GPS",PlayerInfo[playerid][pGPS]);
    mysql_SetInt(playerid,"Einleitung",PlayerInfo[playerid][pEinleitung]);
    mysql_SetInt(playerid,"LottoNr",PlayerInfo[playerid][pLottoNr]);
    mysql_SetInt(playerid,"Fishes",PlayerInfo[playerid][pFishes]);
    mysql_SetInt(playerid,"BiggestFish",PlayerInfo[playerid][pBiggestFish]);
    mysql_SetInt(playerid,"Job",PlayerInfo[playerid][pJob]);
    mysql_SetInt(playerid,"HeadValue",PlayerInfo[playerid][pHeadValue]);
    mysql_SetInt(playerid,"Jailed",PlayerInfo[playerid][pJailed]);
    mysql_SetInt(playerid,"JailTime",PlayerInfo[playerid][pJailTime]);
    mysql_SetInt(playerid,"Drugs",PlayerInfo[playerid][pDrugs]);
    mysql_SetInt(playerid,"Waffen1",PlayerInfo[playerid][pWaffen1]);
    mysql_SetInt(playerid,"Waffen2",PlayerInfo[playerid][pWaffen2]);
    mysql_SetInt(playerid,"Waffen3",PlayerInfo[playerid][pWaffen3]);
    mysql_SetInt(playerid,"Waffen4",PlayerInfo[playerid][pWaffen4]);
    mysql_SetInt(playerid,"Waffen5",PlayerInfo[playerid][pWaffen5]);
    mysql_SetInt(playerid,"Waffen6",PlayerInfo[playerid][pWaffen6]);
    mysql_SetInt(playerid,"Waffen7",PlayerInfo[playerid][pWaffen7]);
    mysql_SetInt(playerid,"Waffen8",PlayerInfo[playerid][pWaffen8]);
    mysql_SetInt(playerid,"Sonnenbrille",PlayerInfo[playerid][pSonnenBrille]);
    mysql_SetInt(playerid,"DrogenAbhängig",PlayerInfo[playerid][pDabhaengig]);
    mysql_SetInt(playerid,"Leader",PlayerInfo[playerid][pChef]);
    mysql_SetInt(playerid,"Member",PlayerInfo[playerid][pArbeiter]);
    mysql_SetInt(playerid,"Rank",PlayerInfo[playerid][pRank]);
    mysql_SetInt(playerid,"Char",PlayerInfo[playerid][pChar]);
    mysql_SetInt(playerid,"DetSkill",PlayerInfo[playerid][pDetSkill]);
    mysql_SetInt(playerid,"SexSkill",PlayerInfo[playerid][pSexSkill]);
    mysql_SetInt(playerid,"LawSkill",PlayerInfo[playerid][pLawSkill]);
    mysql_SetInt(playerid,"MechSkill",PlayerInfo[playerid][pMechSkill]);
    mysql_SetInt(playerid,"JackSkill",PlayerInfo[playerid][pJackSkill]);
    mysql_SetInt(playerid,"CarSkill",PlayerInfo[playerid][pCarSkill]);
    mysql_SetInt(playerid,"NewsSkill",PlayerInfo[playerid][pNewsSkill]);
    mysql_SetInt(playerid,"DrugsSkill",PlayerInfo[playerid][pDrugsSkill]);
    mysql_SetInt(playerid,"FishSkill",PlayerInfo[playerid][pFishSkill]);
    mysql_SetInt(playerid,"pSHealth",PlayerInfo[playerid][pSHealth]);
    GetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
    mysql_SetInt(playerid,"pHealth",PlayerInfo[playerid][pHealth]);
    mysql_SetInt(playerid,"Int",PlayerInfo[playerid][pInt]);
    mysql_SetInt(playerid,"Local",PlayerInfo[playerid][pLocal]);
    mysql_SetInt(playerid,"Team",PlayerInfo[playerid][pTeam]);
    mysql_SetInt(playerid,"Model",PlayerInfo[playerid][pModel]);
    mysql_SetInt(playerid,"ContractTime",PlayerInfo[playerid][pContractTime]);
    mysql_SetInt(playerid,"PhoneNr",PlayerInfo[playerid][pHandynummer]);
    mysql_SetInt(playerid,"Handyakku",PlayerInfo[playerid][pHandyakku]);
    mysql_SetInt(playerid,"Hotel",PlayerInfo[playerid][pHotel]);
    mysql_SetInt(playerid,"Pos_x",PlayerInfo[playerid][pPos_x]);
    mysql_SetInt(playerid,"Pos_y",PlayerInfo[playerid][pPos_y]);
    mysql_SetInt(playerid,"Timeout",PlayerInfo[playerid][pTimeOut]);
    mysql_SetInt(playerid,"Pos_z",PlayerInfo[playerid][pPos_z]);
    mysql_SetInt(playerid,"CarLic",PlayerInfo[playerid][pCarLic]);
    mysql_SetInt(playerid,"NewLic",PlayerInfo[playerid][pNewLic]);
    mysql_SetInt(playerid,"FlyLic",PlayerInfo[playerid][pFlyLic]);
    mysql_SetInt(playerid,"BusLic",PlayerInfo[playerid][pBusLic]);
    mysql_SetInt(playerid,"BoatLic",PlayerInfo[playerid][pBoatLic]);
    mysql_SetInt(playerid,"Kredit",PlayerInfo[playerid][pKredit]);
    mysql_SetInt(playerid,"Kreditzahlen",PlayerInfo[playerid][pKreditbezahlen]);
    mysql_SetInt(playerid,"FishLic",PlayerInfo[playerid][pFishLic]);
    mysql_SetInt(playerid,"Versicherung",PlayerInfo[playerid][pVersicherung]);
    mysql_SetInt(playerid,"Handyrechnung",PlayerInfo[playerid][pHandyrechnung]);
    mysql_SetInt(playerid,"Anbieter",PlayerInfo[playerid][pAnbieter]);
    mysql_SetInt(playerid,"GunLic",PlayerInfo[playerid][pGunLic]);
    mysql_SetInt(playerid,"Zinsen",PlayerInfo[playerid][pZinsen]);
    mysql_SetInt(playerid,"MehrCars",PlayerInfo[playerid][pMehrCars]);
    mysql_SetInt(playerid,"IRC",PlayerInfo[playerid][pIRC]);
    mysql_SetInt(playerid,"CarLic",PlayerInfo[playerid][pCarLic]);
    mysql_SetInt(playerid,"BusLic",PlayerInfo[playerid][pBusLic]);
    mysql_SetInt(playerid,"NewLic",PlayerInfo[playerid][pNewLic]);
    mysql_SetInt(playerid,"Krank",PlayerInfo[playerid][pKrank]);
    mysql_SetInt(playerid,"LKWLic",PlayerInfo[playerid][pLKWLic]);
    mysql_SetInt(playerid,"MotoLic",PlayerInfo[playerid][pMotoLic]);
    mysql_SetInt(playerid,"Impf",PlayerInfo[playerid][pImpf]);
    mysql_SetInt(playerid,"Sender",PlayerInfo[playerid][pSender]);
    mysql_SetInt(playerid,"Zig",PlayerInfo[playerid][pZig]);
    mysql_SetInt(playerid,"Radio",PlayerInfo[playerid][pRadio]);
    mysql_SetInt(playerid,"Kasten",PlayerInfo[playerid][pKasten]);
    mysql_SetInt(playerid,"Teleport",PlayerInfo[playerid][pTeleport]);
    mysql_SetInt(playerid,"Gun1",PlayerInfo[playerid][pGun1]);
    mysql_SetInt(playerid,"Gun2",PlayerInfo[playerid][pGun2]);
    mysql_SetInt(playerid,"Gun3",PlayerInfo[playerid][pGun3]);
    mysql_SetInt(playerid,"Gun4",PlayerInfo[playerid][pGun4]);
    mysql_SetInt(playerid,"Ammo1",PlayerInfo[playerid][pAmmo1]);
    mysql_SetInt(playerid,"Ammo2",PlayerInfo[playerid][pAmmo2]);
    mysql_SetInt(playerid,"Ammo3",PlayerInfo[playerid][pAmmo3]);
    mysql_SetInt(playerid,"Ammo4",PlayerInfo[playerid][pAmmo4]);
    mysql_SetInt(playerid,"CarTime",PlayerInfo[playerid][pCarTime]);
    mysql_SetInt(playerid,"CDPlayer",PlayerInfo[playerid][pCDPlayer]);
    mysql_SetInt(playerid,"Wins",PlayerInfo[playerid][pWins]);
    mysql_SetInt(playerid,"Loses",PlayerInfo[playerid][pLoses]);
    mysql_SetInt(playerid,"Tutorial",PlayerInfo[playerid][pTut]);
    mysql_SetInt(playerid,"Warnings",PlayerInfo[playerid][pWarns]);
    mysql_SetInt(playerid,"Adjustable",PlayerInfo[playerid][pAdjustable]);
    mysql_SetInt(playerid,"Fuel",PlayerInfo[playerid][pFuel]);
    mysql_SetInt(playerid,"Married",PlayerInfo[playerid][pMarried]);
    mysql_SetInt(playerid,"MarriedTo",PlayerInfo[playerid][pMarriedTo]);
    mysql_SetInt(playerid,"SpawnChange",SpawnChange[playerid]);
    mysql_SetInt(playerid,"WantedLevel",WantedLevel[playerid]);
    mysql_SetInt(playerid,"WantedPoints",WantedPoints[playerid]);
    mysql_SetInt(playerid,"PlayMinutes",PlayerInfo[playerid][pPlayMinutes]);
    mysql_SetInt(playerid,"GesamtMinutes",PlayerInfo[playerid][pGesamtMinutes]);
    mysql_SetInt(playerid,"MinutesSinceAn",PlayerInfo[playerid][pMinutesSinceAn]);
    mysql_SetInt(playerid,"Knast",Knast[playerid]);
    mysql_SetInt(playerid,"Uhr",PlayerInfo[playerid][pUhrID]);
    mysql_SetInt(playerid,"Handy",PlayerInfo[playerid][pHandyID]);
    mysql_SetInt(playerid,"KnastTime",KnastTime[playerid]);
    mysql_SetInt(playerid,"Perso",PlayerInfo[playerid][pOwnPerso]);
    mysql_SetInt(playerid,"FrakSperre",PlayerInfo[playerid][pFrakSperre]);
    mysql_SetInt(playerid,"PayDay",PlayerInfo[playerid][pPayDay]);
    mysql_SetInt(playerid,"Paydayzeit",PlayerInfo[playerid][pPaydayzeit]);
    mysql_SetInt(playerid,"PayDayHad",PlayerInfo[playerid][pPayDayHad]);
    mysql_SetInt(playerid,"CarsOwn", PlayerInfo[playerid][pCarsOwn]);
    mysql_SetInt(playerid,"HouseKey", PlayerInfo[playerid][pHouseKey]);
    mysql_SetInt(playerid,"RentHouseKey", PlayerInfo[playerid][pRentHouseKey]);
    format(string,sizeof(string)," {FFFFFF}Willkommen zurück!\n Spieler: {FF8A05}%s{FFFFFF}, Ping: %d\n Um den Server zu betreten.\nGeb bitte unten dein Passwort ein.\nVerwende dein Passwort niemals auf andern Servern!",pn(playerid),GetPlayerPing(playerid));
    ShowPlayerDialog(playerid,LOGINDIALOG,DIALOG_STYLE_PASSWORD,"{FF8A05} Revolution-Roleplay ",string,"Login","Abbrechen");
    }
    }
    return 1;
    }



    Ich bekomme dann die Errors:


    C:\Users\Fabian\Desktop\Servers\\gamemodes\Selfmade.pwn(13644) : error 017: undefined symbol "string"
    C:\Users\Fabian\Desktop\Servers\Selfmade\Selfmade.pwn(13644) : error 017: undefined symbol "string"
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13644) : error 029: invalid expression, assumed zero



    Und Wenn ich es mit new string[128]; oder new string[256]; mache bekomme ich anstatt die 3 bzw. 4 Errors aufeinmal 26 Errors und das nur wegen new string



    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(9646) : warning 219: local variable "text1" shadows a variable at a preceding level
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(12982) : warning 213: tag mismatch
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(12984) : warning 213: tag mismatch
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(12992) : warning 213: tag mismatch
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(12994) : warning 213: tag mismatch
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(12995) : warning 213: tag mismatch
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13168) : warning 219: local variable "hours" shadows a variable at a preceding level
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13168) : warning 219: local variable "minutes" shadows a variable at a preceding level
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13168) : warning 219: local variable "seconds" shadows a variable at a preceding level
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13567) : warning 213: tag mismatch
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13569) : warning 213: tag mismatch
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13578) : warning 213: tag mismatch
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13579) : warning 213: tag mismatch
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13581) : warning 213: tag mismatch
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13492) : warning 204: symbol is assigned a value that is never used: "zielip"
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13690) : error 017: undefined symbol "pWaffen"
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13789) : error 017: undefined symbol "key"
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13793) : warning 209: function "OnPlayerLogin" should return a value
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13794) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13798) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13799) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13801) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13805) : error 021: symbol already defined: "SendClientMessage"
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13806) : error 021: symbol already defined: "M_Kick"
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13807) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13810) : error 021: symbol already defined: "M_ResetPlayerMoney"
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13812) : error 021: symbol already defined: "M_GivePlayerMoney"
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13814) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13828) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13833) : error 021: symbol already defined: "M_GivePlayerMoney"
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13834) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13838) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13841) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13842) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13843) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13844) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13845) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13846) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13847) : error 010: invalid function or declaration
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13855) : error 021: symbol already defined: "gettime"
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13867) : error 054: unmatched closing brace ("}")
    C:\Users\Fabian\Desktop\Servers\Selfmade\gamemodes\Selfmade.pwn(13868) : error 010: invalid function or declaration


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



    26 Errors.


    Ich hoffe mir kann einer Helfen um den String definiert zu Bekommen ohne Erros.



    Danke im Vorraus an alle die Helfen



    Mit freundlichen Grüßen
    JAGHAX

  • Sieht aus wie ein Klammerfehler, was sucht den diese Klammer hier: ?



    public OnPlayerRegister(playerid, password[])
    {
    if(IsPlayerConnected(playerid))
    {
    new name[MAX_PLAYER_NAME],zielip[MAX_PLAYERS];
    GetPlayerName(playerid,name,sizeof(name));
    if(GetPlayerId(playerid) < 1)
    {
    new ID = GetPlayerIdFromName(SpielerName(playerid));
    if(ID != -1) return SendClientMessage(playerid, cRed, "Spieler existiert bereits!");
    ID = CreateSql();
    SetPlayerId(playerid,ID);
    }
    { // Ich sehe keine Abfragen o.ä - Diese Klammer und die dazugehörige entfernen..