Todes System klappt nicht

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 Abend,
    Ich Arbeite gerade an meinem Todes System.
    Und zwar, sobald man Stirbt soll man auf dem Boden Liegen und nichts machen können.
    Leider klappt das ganze aber noch nicht wirklich.
    Ich zeige euch mal den Code:



    public OnPlayerSpawn(playerid)
    {
    PreloadPlayerAnims(playerid);
    SetPlayerSkin(playerid,sInfo[playerid][sSkin]);
    if(sInfo[playerid][sIsDeath] == 1)
    {
    ClearAnimations(playerid);
    SetPlayerVirtualWorld(playerid, sInfo[playerid][sDeathWorld]);
    SetPlayerInterior(playerid, sInfo[playerid][sDeathInterior]);
    SetPlayerPos(playerid, sInfo[playerid][sDeathPosX], sInfo[playerid][sDeathPosY], sInfo[playerid][sDeathPosZ]);
    ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 0, 0, 0, 0, 0);
    SetTimerEx("DeathTimer", 1000*60*2, false, "i", playerid);
    TogglePlayerControllable(playerid,1);
    return 1;
    }
    return 1;
    }


    public OnPlayerDeath(playerid, killerid, reason)
    {
    sInfo[playerid][sIsDeath] = 1;
    GetPlayerPos(playerid, sInfo[playerid][sDeathPosX], sInfo[playerid][sDeathPosY], sInfo[playerid][sDeathPosZ]);
    sInfo[playerid][sDeathInterior] = GetPlayerInterior(playerid);
    sInfo[playerid][sDeathWorld] = GetPlayerVirtualWorld(playerid);
    if(GetPVarInt(playerid,"Duty") == 1)
    {
    SetPVarInt(playerid,"Duty",0);
    SetPlayerColor(playerid,FARBE_WEISS);
    return 1;
    }
    sInfo[playerid][sDeath] += 1;
    sInfo[killerid][sKill] += 1;
    return 1;
    }


    Das ganze Klappt leider nicht wie Beschrieben.


    MfG. Dome

    Mit freundlichen Grüßen, BlvckAir :thumbup:

  • Wird das OnPlayerSpawn Callback überhaupt aufgerufen?
    Was steht im Server Log, wenn du es so schreibst?
    public OnPlayerSpawn(playerid)
    {
    printf("OnPlayerSpawn: %d", playerid);
    PreloadPlayerAnims(playerid);
    SetPlayerSkin(playerid,sInfo[playerid][sSkin]);
    printf("sIsDeath: %d", sInfo[playerid][sIsDeath]);
    if(sInfo[playerid][sIsDeath] == 1)
    {
    printf("ok");
    ClearAnimations(playerid);
    SetPlayerVirtualWorld(playerid, sInfo[playerid][sDeathWorld]);
    SetPlayerInterior(playerid, sInfo[playerid][sDeathInterior]);
    SetPlayerPos(playerid, sInfo[playerid][sDeathPosX], sInfo[playerid][sDeathPosY], sInfo[playerid][sDeathPosZ]);
    ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 0, 0, 0, 0, 0);
    SetTimerEx("DeathTimer", 1000*60*2, false, "i", playerid);
    TogglePlayerControllable(playerid,1);
    return 1;
    }
    return 1;
    }

  • So:


    public OnPlayerSpawn(playerid)
    {
    printf("OnPlayerSpawn: %d", playerid);
    PreloadPlayerAnims(playerid);
    SetPlayerSkin(playerid,sInfo[playerid][sSkin]);
    printf("sIsDeath: %d", sInfo[playerid][sIsDeath]);
    if(sInfo[playerid][sIsDeath] == 1)
    {
    printf("ok");
    ClearAnimations(playerid);
    SetPlayerVirtualWorld(playerid, sInfo[playerid][sDeathWorld]);
    SetPlayerInterior(playerid, sInfo[playerid][sDeathInterior]);
    SetPlayerPos(playerid, sInfo[playerid][sDeathPosX], sInfo[playerid][sDeathPosY], sInfo[playerid][sDeathPosZ]);
    ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 0, 0, 0, 0, 0);
    SetTimerEx("StartDeathAnim", 500, false, "i", playerid);
    SetTimerEx("DeathTimer", 1000*60*2, false, "i", playerid);
    TogglePlayerControllable(playerid,1);
    return 1;
    }
    return 1;
    }


    forward StartDeathAnim(playerid);
    public StartDeathAnim(playerid)
    {
    ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 0, 0, 0, 0, 0);
    return 1;
    }



  • Ah. :3
    Cool, die Animation klappt schon einmal. Leider wird er nun nicht mehr Gefreezt. Dies auch unter "StartDeathAnim" setzen am besten?


    MfG. Dome

    Mit freundlichen Grüßen, BlvckAir :thumbup:

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Jeffry


    Das ganze sollte doch so klappen oder?



    public OnPlayerSpawn(playerid)
    {
    SetPlayerSkin(playerid,sInfo[playerid][sSkin]);
    if(sInfo[playerid][sIsDeath] == 1)
    {
    SetTimerEx("StartDeathAnim", 500, false, "i", playerid);
    return 1;
    }
    if(IstSpielerInFraktion(playerid,1))
    {
    SetPlayerInterior(playerid,6);
    SetPlayerPos(playerid,218.8853,67.6345,1005.0391);
    return 1;
    }
    else if(IstSpielerInFraktion(playerid,2))
    {
    SetPlayerInterior(playerid,10);
    SetPlayerPos(playerid,230.1551,113.0730,1003.2188);
    return 1;
    }
    else if(IstSpielerInFraktion(playerid,3))
    {
    SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,2066.9260,-1391.1484,1717.2209);
    return 1;
    }
    return 1;
    }


    forward StartDeathAnim(playerid);
    public StartDeathAnim(playerid)
    {
    printf("ok");
    PreloadPlayerAnims(playerid);
    ClearAnimations(playerid);
    ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 0, 0, 0, 0, 0);
    SetPlayerVirtualWorld(playerid, sInfo[playerid][sDeathWorld]);
    SetPlayerInterior(playerid, sInfo[playerid][sDeathInterior]);
    SetPlayerPos(playerid, sInfo[playerid][sDeathPosX], sInfo[playerid][sDeathPosY], sInfo[playerid][sDeathPosZ]);
    ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 0, 0, 0, 0, 0);
    SetTimerEx("DeathTimer", 1000*60*2, false, "i", playerid);
    TogglePlayerControllable(playerid,0);
    return 1;
    }


    MfG. Dome


    //e Leider wird die Animaion nicht gemacht.

    Mit freundlichen Grüßen, BlvckAir :thumbup:

  • Leider nein.
    Habe denn Freez ausgeklammert aber die Animation kommt wieder nicht.



    forward StartDeathAnim(playerid);
    public StartDeathAnim(playerid)
    {
    PreloadPlayerAnims(playerid);
    ClearAnimations(playerid);
    SetPlayerVirtualWorld(playerid, sInfo[playerid][sDeathWorld]);
    SetPlayerInterior(playerid, sInfo[playerid][sDeathInterior]);
    SetPlayerPos(playerid, sInfo[playerid][sDeathPosX], sInfo[playerid][sDeathPosY], sInfo[playerid][sDeathPosZ]);
    ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 0, 0, 0, 0, 0);
    SetTimerEx("DeathTimer", 1000*60*2, false, "i", playerid);
    //TogglePlayerControllable(playerid,0);
    return 1;
    }


    MfG. Dome

    Mit freundlichen Grüßen, BlvckAir :thumbup: