Paintballl

  • da ist kein befehl zum starten -.- und ich habe 0 ahnung wie ic hdas machen soll
    [pwn]new Float:PaintballSpawns[7][3] = {
    {-394.8027,2232.2317,42.4297},
    {-430.8412,2240.5371,42.9834},
    {-369.2361,2248.3127,42.4844},
    {-350.8910,2218.0215,42.4912},
    {-384.0544,2206.2908,42.4235},
    {-395.7100,2214.9480,42.4297},
    {-445.3718,2222.5481,42.4297}
    };
    [/pwn]

    [pwn]Function PreparePaintball()
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(PlayerPaintballing != 0)
    {
    SendClientMessage(i, COLOR_YELLOW, "Paintball startet in 20 Sekunden.");
    }
    }
    }
    SetTimer("StartPaintball", 20000, 0);
    return 1;
    }
    Function StartPaintball()
    {
    PaintballRound = 1;
    StartingPaintballRound = 0;
    PaintballWinner = 999;
    PaintballWinnerKills = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(PlayerPaintballing[i] != 0)
    {
    ResetPlayerWeapons(i);
    GivePlayerWeapon(i, 24, 999);
    GivePlayerWeapon(i, 29, 999);
    UnFreezePlayer(i);
    SendClientMessage(i, COLOR_YELLOW, "Paintball gestartet. 4 Minuten verbleibend.");
    PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
    }
    }
    }
    SetTimer("PaintballEnded", 240000, 0);
    return 1;
    }
    Function PaintballEnded()
    {
    new string[256];
    new name[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(PlayerPaintballing[i] != 0)
    {
    if(IsPlayerConnected(PaintballWinner))
    {
    GetPlayerName(PaintballWinner, name, sizeof(name));
    format(string,sizeof(string), "** %s hat das Paintballspiel mit %d Treffern gewonnen **",name,PaintballWinnerKills);
    SendClientMessage(i, COLOR_WHITE, string);
    SetTimer("Ende", 2000, 0);
    }
    ResetPlayerWeapons(i);
    PlayerPaintballing[i] = 0;
    SetPlayerPos(i, SBizzInfo[6][sbEntranceX],SBizzInfo[6][sbEntranceY],SBizzInfo[6][sbEntranceZ]);
    }
    }
    }
    AnnouncedPaintballRound = 0;
    PaintballRound = 0;
    return 1;
    }[/pwn]

    [pwn] if(PlayerPaintballing[playerid] != 0)
    {
    PaintballPlayers --;
    }[/pwn]

    [pwn] new rand;
    new house = PlayerInfo[playerid][pPhousekey];
    if(PlayerPaintballing[playerid] != 0)
    {
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid, 29, 999);
    GivePlayerWeapon(playerid, 24, 999);
    rand = random(sizeof(PaintballSpawns));
    SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
    return 1;
    }[/pwn]

    [pwn]if(PlayerPaintballing[playerid] != 0)
    {
    PlayerPaintballKills[killerid] ++;
    if(PlayerPaintballKills[killerid] > PaintballWinnerKills)
    {
    new killer[MAX_PLAYER_NAME];
    PaintballWinner = killerid;
    PaintballWinnerKills = PlayerPaintballKills[killerid];
    GetPlayerName(killerid, killer, sizeof(killer));
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(PlayerPaintballing[i] != 0)
    {
    format(string, sizeof(string), "* %s ist mit %d Kills in Führung.",killer,PaintballWinnerKills);
    SendClientMessage(i, COLOR_WHITE, string);
    }
    }
    }
    }
    return 1;
    }[/pwn]

    [pwn] if(PaintballPlayers >= 2 && PaintballRound != 1 && StartingPaintballRound != 1)
    {
    StartingPaintballRound = 1;
    SetTimer("PreparePaintball", 15000, 0);
    }[/pwn]

    [pwn] if(StartingPaintballRound == 1 && AnnouncedPaintballRound == 0)
    {
    AnnouncedPaintballRound = 1;
    if(PlayerPaintballing[i] != 0)
    {
    SendClientMessage(i, COLOR_YELLOW, "Paintball Match wird angekündigt in 15 Sekunden (für mehr Paintball Spieler)");
    }
    }[/pwn]

    [pwn] if(i == 6)
    {
    PaintballPlayers ++;
    PlayerPaintballing[playerid] = 1;
    new rand = random(sizeof(PaintballSpawns));
    SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
    ResetPlayerWeapons(playerid);
    SetPlayerArmour(playerid, 0);
    SetPlayerHealth(playerid, 100);
    }
    else
    {
    return 1;
    }[/pwn]

    [pwn]Function Ende()
    {
    PaintballWinnerKills = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    PlayerPaintballKills[i] = 0;
    }
    return 1;
    }
    [/pwn]
  • Also du hast aber eine Funktion,
    die scheinbar das ganze startet:
    [pwn]StartPaintball()[/pwn]


    z.B.:

    [pwn]
    ocmd:startpaintball(playerid,params[])
    {
    #pragma unused params
    StartPaintball();
    return 1;
    }
    [/pwn]

    Würde nun die Funktion starten (Wenn ich die Funktion nu richtig deute),
    als Befehl (ocmd).

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von Dennis321 ()

  • Aus welchem Callback stammt folgender Code:
    [pwn]if(i == 6)
    {
    PaintballPlayers ++;
    PlayerPaintballing[playerid] = 1;
    new rand = random(sizeof(PaintballSpawns));
    SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
    ResetPlayerWeapons(playerid);
    SetPlayerArmour(playerid, 0);
    SetPlayerHealth(playerid, 100);
    }
    else
    {
    return 1;
    }[/pwn]
    Dieser Teil scheint nämlich dafür verantwortlich zu sein, einen Spieler ins Paintball zu stecken.
    Um das genau zu beurteilen bräuchte man aber noch etwas mehr Code, der vorher und nachher steht (da ich nicht weis, für was die Abfrage i == 6 hier verwendet wird).
  • Zur Erklärung:

    Wir brauchen von dem was du gepostet ahst eig. erstmal nur das:
    [pwn]
    Function StartPaintball()
    {
    PaintballRound = 1;
    StartingPaintballRound = 0;
    PaintballWinner = 999;
    PaintballWinnerKills = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(PlayerPaintballing != 0)
    {
    ResetPlayerWeapons(i);
    GivePlayerWeapon(i, 24, 999);
    GivePlayerWeapon(i, 29, 999);
    UnFreezePlayer(i);
    SendClientMessage(i, COLOR_YELLOW, "Paintball gestartet. 4 Minuten verbleibend.");
    PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
    }
    }
    }
    SetTimer("PaintballEnded", 240000, 0);
    return 1;
    }
    [/pwn]

    Dies ist eine Funktion,
    mit dem Namen: StartPaintball().

    Nutzen, also aufrufen tust du sie mit StartPaintball();.

    Nun kannst du einen Befehl machen,
    ich mach das einfach mal mit ocmd:
    [pwn]
    ocmd:startpaintball(playerid,params[]) // Der Befehl, also ingame: /startpaintball
    {
    #pragma unused params
    StartPaintball(); // Ruft die Funktion auf
    return 1;
    }
    [/pwn]

    mehr wäre das nun erstmal nicht im Zusammenhang.

    Noch einmal als "Standart" befehlsart strcmp:
    [pwn]
    if (strcmp("/startpaintball",cmdtext,true) == 0)
    {
    StartPaintball();
    }
    [/pwn]


    Im Endeffekt musst du also einfach nur "StartPaintball();" aufrufen.
    Gruß,
    Dennis
  • Wen du auch immer mit "pawno" meinst (ein solcher ist hier nicht anwesend)...
    In dem System wird das Paintball scheinbar automatisch gestartet, wenn mindestens zwei Spieler dem Paintball
    beigetreten sind (kann ich nur vermuten, da die dazugehörigen Funktionen nicht beim Code dabei geschrieben sind).

    Solltest du also etwas anderes wollen (wie beispielsweise einen Befehl, womit alle Spieler auf dem Server zum Paintball
    geschickt werden), so solltest du deine Frage-/Problemstellung mal konkretisieren, damit ich dir auch richtig helfen kann.
  • [pwn]Function StartPaintball()
    {
    PaintballRound = 1;
    StartingPaintballRound = 0;
    PaintballWinner = 999;
    PaintballWinnerKills = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(PlayerPaintballing != 0)
    {
    ResetPlayerWeapons(i);
    GivePlayerWeapon(i, 24, 999);
    GivePlayerWeapon(i, 29, 999);
    UnFreezePlayer(i);
    SendClientMessage(i, COLOR_YELLOW, "Paintball gestartet. 4 Minuten verbleibend.");
    PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
    }
    }
    }[/pwn]