Brauche für das /aduty Godmode Timer

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
  • Sehr geehrte Damen und Herren , ich kriege einfach nirgends einen Timer her , da ich noch nie einen Timer gebastelt hab für das HP Setzen , ich brauche jediglich den Timer wo das Godmode Aktiviert wird und ganz unten den Kill Timer , ich bin seit
    stunden am Suchen , doch erfolgslos , bitte helft mir .
    if (strcmp(cmd, "/adminduty", true) == 0 || strcmp(cmd, "/aduty", true) == 0)
    {
    if(AdminDuty[playerid] == 0)
    {
    if(PlayerInfo[playerid][pAdmin] == 1)
    {
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Level 1 - Supporter on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 2)
    {
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Level 2 - Moderator on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 3)
    {
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Level 3 - Administrator on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x932200FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 4)
    {
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Level 4 - Administrator on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 5)
    {
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Level 5 - Administrator on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 1337)
    {
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als 1337 Administrator on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 2001)
    {
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Stellvertretender Projektleiter on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 2002)
    {
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Projektleiter on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 2003)
    {
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als 1337 - Support Admin on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    }
    if(AdminDuty[playerid] == 1)
    {
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun nichtmehr On Duty!");
    RemovePlayerAttachedObject(playerid,0);
    SetPlayerArmour(playerid, 0);
    SetPlayerHealth(playerid,100);
    AdminDuty[playerid] = 0;
    {
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
    {
    }
    else
    {
    SetPlayerColor(playerid,TEAM_HIT_COLOR);
    }
    }
    return 1;
    }
    return 1;
    }


    Danke im Vorraus ,
    mit freundlichen Grüßen
    .Croo

  • das einfachste wäre, mach jeweils da wo du es haben möchtest, diesen Timer:


    SetTimer("AdutyGomo",100,true);


    Dann erstell irgendwo in deinem Script (ganz oben oder ganz unten) diesen Callback


    forward AdutyGomo(playerid);
    public AdutyGomo(playerid)
    {
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    return 1;
    }

  • Ja jede 0,1 Sek wird HP + Armour wieder auf 100 gesetzt..
    Am besten macht du ein PVar ins Script, um abzufragen, ob der schon aktiv ist. (Der Godmode)


    SetPVarInt(playerid,"Gomo",1); //Wenn der Godmode aktiviert wird, auf 1 setzen



    if(GetPVarInt(playerid,"Gomo") == 0)



    {



    SetTimer("AdutyGomo",100,true);



    SetPVarInt(playerid,"Gomo",0);
    //...



    }
    if(GetPVarInt(playerid,"Gomo") == 1)
    {
    KillTimer(timerid);
    SetPVarInt(playerid,"Gomo",0);
    //...
    }


    Für die TimerID machst du ganz oben im Script:


    new agod;


    Dann wenn du den Timer startest..



    agod = SetTimer("AdutyGomo",100,true);


    Um Timer zu killen



    KilLTimer(agod);


    Naja, bisschen durcheinander finde ich.. Aber ich hoffe, du hast verstanden, was ich meine ^^

  • forward AdutyGomo(playerid);
    public AdutyGomo(playerid)
    {
    if(AdminDuty[playerid] == true)
    {
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    return 1;
    }
    }
    da bruachste keinen Timer killen, da fraen wir ab oder der admin OnDuty ist

  • Wow nice [LP]Tochnas.. Um ehrlich zu sein, darauf wär ich nicht gekommen, auf so eine einfache, simple Lösung :huh:
    Dann kann man mein Kram vom letzten Post eigentlich in Papierkorb werfen. "Rechtklick -> Papierkorb leeren" :D

  • Zuviel durcheinander :D Ich versuchs mal , ich willst halt da oben einbauen ^^ ist wichtig :D
    Danke im Vorraus ich komm drauf zurück obs klappt !


    //EDIT Narushi was meinst du mit if(GetPVarInt(playerid,"Gomo") == 0)



    if(GetPVarInt(playerid,"Gomo") == 0)



    {



    SetTimer("AdutyGomo",100,true);



    SetPVarInt(playerid,"Gomo",0);
    //...



    }
    if(GetPVarInt(playerid,"Gomo") == 1)
    {
    KillTimer(timerid);
    SetPVarInt(playerid,"Gomo",0);
    //...
    }

  • Wenn man /aduty geht bekommt man

    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);


    und wenn man wieder /aduty macht geht man raus und wird alles wieder normal ? ist doch dann richtig?
    wenn du so gesagt "Godmode" willst ?


    dann benötigst du doch meinens wissens keinen Timer?

    Mit freundlichen Grüßen


    Digny

  • if (strcmp(cmd, "/adminduty", true) == 0 || strcmp(cmd, "/aduty", true) == 0)
    {
    if(AdminDuty[playerid] == 0)
    {
    if(PlayerInfo[playerid][pAdmin] == 1)
    {
    agod = SetTimer("AdutyGomo",100,true);
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Level 1 - Supporter on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 2)
    {
    agod = SetTimer("AdutyGomo",100,true);
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Level 2 - Moderator on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 3)
    {
    agod = SetTimer("AdutyGomo",100,true);
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Level 3 - Administrator on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x932200FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 4)
    {
    agod = SetTimer("AdutyGomo",100,true);
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Level 4 - Administrator on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 5)
    {
    agod = SetTimer("AdutyGomo",100,true);
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Level 5 - Administrator on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 1337)
    {
    agod = SetTimer("AdutyGomo",100,true);
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als 1337 Administrator on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 2001)
    {
    agod = SetTimer("AdutyGomo",100,true);
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Stellvertretender Projektleiter on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 2002)
    {
    agod = SetTimer("AdutyGomo",100,true);
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als Projektleiter on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] == 2003)
    {
    agod = SetTimer("AdutyGomo",100,true);
    SetPlayerAttachedObject(playerid, 0, 18646, 2, 0.200000, 0.000000, 0.000000, -0.000000, 90.000000, 0.000000, 0.799999, 0.899999, 1.000000);
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun als 1337 - Administrator on Duty!");
    SetPlayerColor(playerid,0x870000FF);
    AdminDuty[playerid] = 1;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string,sizeof(string),"Ein Admin ist on Duty !",sendername,playerid);
    SendClientMessageToAll(0x870000FF, string);
    SetPlayerArmour(playerid, 999999);
    SetPlayerHealth(playerid, 999999);
    return 1;
    }
    }
    if(AdminDuty[playerid] == 1)
    {
    SendClientMessage(playerid,COLOR_YELLOW,"Du bist nun nichtmehr On Duty!");
    RemovePlayerAttachedObject(playerid,0);
    KillTimer(agod);
    SetPlayerArmour(playerid, 0);
    SetPlayerHealth(playerid,100);
    AdminDuty[playerid] = 0;
    {
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
    {
    }
    else
    {
    SetPlayerColor(playerid,TEAM_HIT_COLOR);
    }
    }
    return 1;
    }
    return 1;
    }


    PROBLEM : Er hat immer Godmode , obwohl der Timer gekillt wird :/ !!

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • if(GetPVarInt(playerid,"Gomo") == 0)


    Das bedeutet: Wenn GodMode nicht aktiviert ist, soll ... geschehen