OnPlayerSpawn verbuggt...

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
  • Hallo liebe Community...


    Anscheinend ist OnPlayerSpawn total verbuggt...
    Er zeigt manchmal dinge an, die eigtl. garnicht da sein sollten wie Premium etc...


    public OnPlayerSpawn(playerid)
    {
    switch(GetPVarInt(playerid,"Gang"))
    {
    case 0:{SetPlayerPos(playerid,ballasspawn);SetPlayerColor(playerid,PINK);}
    case 1:{SetPlayerPos(playerid,grovespawn);SetPlayerColor(playerid,GRÜN);}
    case 2:{SetPlayerPos(playerid,vagosspawn);SetPlayerColor(playerid,GELB);}
    case 3:{SetPlayerPos(playerid,brigadaspawn);SetPlayerColor(playerid,GRAU);}
    case 4:{SetPlayerPos(playerid,lcnspawn);SetPlayerColor(playerid,SCHWARZ);}
    }

    GivePlayerWeapon(playerid,24,250);//Deagle
    GivePlayerWeapon(playerid,30,300);//AK
    SetPlayerScore(playerid,1);
    if(GetPVarInt(playerid, "Premium") == 1)
    {
    GivePlayerWeapon(playerid,34,100);//Sniper
    GivePlayerWeapon(playerid,31,250);//M4
    GivePlayerWeapon(playerid,25,250);//Pumpe
    SetPlayerScore(playerid,2);
    }
    if(GetPVarInt(playerid, "Admin") == 1)
    {
    SetPlayerScore(playerid, 3);
    }
    if(GetPVarInt(playerid, "Admin") == 2)
    {
    SetPlayerScore(playerid, 4);
    }
    if(DM1[playerid]==1)
    {
    new rand = random(sizeof(DM1Spawns));
    SetPlayerPos(playerid,DM1Spawns[rand][0],DM1Spawns[rand][1],DM1Spawns[rand][2]);
    SetPlayerFacingAngle(playerid,DM1Spawns[rand][3]);
    ResetPlayerWeapons(playerid); // Spieler Waffen entnehmen
    GivePlayerWeapon(playerid,24,250);
    GivePlayerWeapon(playerid,27,250);
    }
    if(DM2[playerid]==1)
    {
    new rand = random(sizeof(DM2Spawns));
    SetPlayerPos(playerid,DM2Spawns[rand][0],DM2Spawns[rand][1],DM2Spawns[rand][2]);
    SetPlayerFacingAngle(playerid,DM2Spawns[rand][3]);
    ResetPlayerWeapons(playerid); // Spieler Waffen entnehmen
    GivePlayerWeapon(playerid,28,500);
    GivePlayerWeapon(playerid,24,250);
    }
    if(MINIGUN[playerid]==1)
    {
    new rand = random(sizeof(MINISpawns));
    SetPlayerPos(playerid,MINISpawns[rand][0],MINISpawns[rand][1],MINISpawns[rand][2]);
    SetPlayerFacingAngle(playerid,MINISpawns[rand][3]);
    ResetPlayerWeapons(playerid); // Spieler Waffen entnehmen
    GivePlayerWeapon(playerid,38,5000); //gibt Spieler Minigun
    }
    if(NORMALSPAWN[playerid]==1)
    {
    //WIllkommensnachricht
    new WelcomeSystem[256];
    new string1[256],string2[256],string3[356],string4[256],string5[256],string6[256],string7[256],mstring[1900];
    format(string5,sizeof string5,"Willkommen auf National Deathmatch\n___________________________________________________________________");
    format(string1, sizeof string1, "\nWir sind ein deutscher Deathmatch Server!.\n");
    format(string2, sizeof string2, "Hier kannst du dich austoben oder auch neue Dinge probieren.\n");
    format(string3, sizeof string3, "Je Mehr Kills du hast, desto einen besseren Rang bekommst du etc.\n");
    format(string4, sizeof string4, "Die Accounts werden gespeichert und man kann immer wieder auf diese zugreifen.");
    format(string6, sizeof string6, "\nEs gibt auch einen Donatorrang, den man für einmalige 4,99€ bekommt!");
    format(string7, sizeof string7, "\n------------------------------------------------------------------------------------------------");
    format(mstring, sizeof mstring, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",string5,string1,string2,string3,string4,string7,string6,string7);
    format(WelcomeSystem, sizeof WelcomeSystem, "Willkommen");
    ShowPlayerDialog(playerid,DIALOG_WILLKOMMEN,0,WelcomeSystem,mstring,"Spielen","");
    }

    if(GetPVarInt(playerid, "RegTut") == 1)
    {
    ShowPlayerDialog(playerid,DIALOG_TUTORIAL,DIALOG_STYLE_MSGBOX,"Tutorial","Möchtest du das Tutorial anschauen?","Ja","Nein");
    }
    new str_Update[32];
    format(str_Update, 32, "Kills: %d", GetPVarInt(playerid, "Kills"));
    UpdateTextDraw(playerid, Death_Kills[playerid], str_Update);
    format(str_Update, 32, "Deaths: %d", GetPVarInt(playerid, "Deaths"));
    UpdateTextDraw(playerid, Death_Deaths[playerid], str_Update);


    new Float: Health;
    GetPlayerHealth(playerid, Health);
    format(str_Update, 32, "Energie: %d", floatround(Health));
    UpdateTextDraw(playerid, Death_Energie[playerid], str_Update);


    TextDrawShowForPlayer(playerid, Name_Display[playerid]);
    return 1;
    }


    Grüße :love:

  • Habe mitlerweile die größten Fehler gefunden...


    Ist daran denn was falsch?


    if(killerid == playerid)
    {
    GameTextForPlayer(playerid,"~r~Selbstmord!",5000,2);
    SetPVarInt(playerid,"Deaths", GetPVarInt(playerid,"Deaths")+1);
    }
    else
    {
    Kills[killerid] ++;
    Deaths[playerid] ++;
    new str_Update[32];
    format(str_Update, 32, "Kills: %d", GetPVarInt(killerid,"Kills"));
    UpdateTextDraw(killerid, Death_Kills[killerid], str_Update);
    format(str_Update, 32, "Deaths: %d", GetPVarInt(playerid,"Deaths"));
    UpdateTextDraw(killerid, Death_Deaths[playerid], str_Update);
    SetPVarInt(playerid,"Deaths", GetPVarInt(playerid,"Deaths")+1);
    SetPVarInt(killerid,"Kills", GetPVarInt(killerid,"Kills")+1);

    GameTextForPlayer(playerid,"~r~Getoetet!",1,2);

  • [color=blue]if[/color](killerid [color=green]=[/color][color=green]=[/color] playerid)
    {
    GameTextForPlayer(playerid,[color=red]"~r~Selbstmord!"[/color],[color=#ff8c00]5000[/color],[color=#ff8c00]2[/color]);
    SetPVarInt(playerid,[color=red]"Deaths"[/color], GetPVarInt(playerid,[color=red]"Deaths"[/color])[color=green]+[/color][color=#ff8c00]1[/color]);
    }
    [color=blue]else[/color]
    {
    Kills[killerid] [color=green]++[/color];
    Deaths[playerid] [color=green]++[/color];
    [color=blue]new[/color] str_Update[[color=#ff8c00]32[/color]];
    format(str_Update, [color=#ff8c00]32[/color], [color=red]"Kills: %d"[/color], GetPVarInt(killerid,[color=red]"Kills"[/color]));
    UpdateTextDraw(killerid, Death_Kills[killerid], str_Update);
    format(str_Update, [color=#ff8c00]32[/color], [color=red]"Deaths: %d"[/color], GetPVarInt(playerid,[color=red]"Deaths"[/color]));
    UpdateTextDraw(killerid, Death_Deaths[playerid], str_Update);
    SetPVarInt(playerid,[color=red]"Deaths"[/color], GetPVarInt(playerid,[color=red]"Deaths"[/color])[color=green]+[/color][color=#ff8c00]1[/color]);
    SetPVarInt(killerid,[color=red]"Kills"[/color], GetPVarInt(killerid,[color=red]"Kills"[/color])[color=green]+[/color][color=#ff8c00]1[/color]);


    GameTextForPlayer(playerid,[color=red]"~r~Getoetet!"[/color],[color=#ff8c00]1[/color],[color=#ff8c00]2[/color]);
    } // HIER GEHÖRT EINE KLAMMER HIN :D



    Ansonsten ist eigentlich nichts falsch...
    Wo genau liegt denn der Fehler?

    Selfmade Reallife Script..


    |||||||||||||||||||||||||||||||||||||||||||||||||||||| 80%/100%

    10.352 Zeilen