/dm (spawnt nicht im DM)

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
  • Hey ich habe ein problemchen..
    Unzwar spawnt der Spieler nach dem Tot nicht wieder im dm
    Das ist bei /dm und /dm2 so.
    Hier der Code


    new rand;
    new dmTrue[MAX_PLAYERS];
    new dm2True[MAX_PLAYERS];


    public OnFilterScriptInit()
    {
    CreateObject(19377, 1820.38, -1702.17, 2002.24, 0.00, 90.00, 90.00);
    CreateObject(19377, -2326.50, -1637.13, 919.04, 0.00, 90.00, 90.00);


    }


    public OnPlayerConnect(playerid)
    {
    dmTrue[playerid] = 0;
    dm2True[playerid] = 0;
    }



    public OnPlayerSpawn(playerid)
    {


    new Float:DmRandomSpawn[2][3] = {
    {1772.8252,-1299.7113,120.2586},
    {1825.3895,-1301.6090,120.2656}
    };


    if(dmTrue[playerid] == 1)
    {
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,500);

    rand = random(sizeof(DmRandomSpawn));
    SetPlayerPos(playerid,DmRandomSpawn[rand][0],DmRandomSpawn[rand][1],DmRandomSpawn[rand][2]);


    }
    new Float:Dm2RandomSpawn[2][3] = {
    {1304.1869,2105.3921,11.0156},
    {1405.1962,2206.7361,12.0156}
    };


    if(dm2True[playerid] == 1)
    {
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,25,500);
    GivePlayerWeapon(playerid,30,1000);


    rand = random(sizeof(Dm2RandomSpawn));
    SetPlayerPos(playerid,Dm2RandomSpawn[rand][0],Dm2RandomSpawn[rand][1],Dm2RandomSpawn[rand][2]);


    }
    }




    public OnPlayerDeath(playerid, killerid, reason)
    {
    SendDeathMessage(killerid, playerid, reason);
    SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
    GivePlayerMoney(killerid, 1000);
    GivePlayerMoney(playerid,-500);
    new str[100], str2[100], name[50], name2[50];
    GetPlayerName(killerid, name, sizeof(name));
    format(str, sizeof(str), "Du wurdest von --> %s <-- umgebracht", name);
    GetPlayerName(playerid, name2, sizeof(name2));
    format(str2, sizeof(str2), "Du hast --> %s <-- umgebracht", name2);
    GameTextForPlayer(playerid, str, 3000, 3);
    GameTextForPlayer(killerid, str2, 3000, 3);
    ResetPlayerWeapons(playerid);
    }




    ocmd:dm(playerid,params[])
    {
    if(dm2True[playerid] == 0)
    {
    new Float:DmRandomSpawn[2][3] = {
    {1772.8252,-1299.7113,120.2586},
    {1825.3895,-1301.6090,120.2656}
    };


    ResetPlayerWeapons(playerid);
    SetPlayerVirtualWorld(playerid, 7);
    GivePlayerWeapon(playerid,25,500);
    GivePlayerWeapon(playerid,24,5000);


    rand = random(sizeof(DmRandomSpawn));
    SetPlayerPos(playerid,DmRandomSpawn[rand][0],DmRandomSpawn[rand][1],DmRandomSpawn[rand][2]);
    dmTrue[playerid] = 1;
    return 1;
    }
    else
    {
    SendClientMessage(playerid, ROT,"Du bist zurzeit in einem DM! Benutze /exit2 um zu Verlassen.");
    return 1;
    }
    }



    ocmd:dm2(playerid,params[])
    {
    if(dmTrue[playerid] == 0)
    {
    new Float:Dm2RandomSpawn[2][3] = {
    {1393.0228,2194.3276,11.0234},
    {1405.1962,2206.7361,12.0156}
    };


    ResetPlayerWeapons(playerid);
    SetPlayerVirtualWorld(playerid, 7);
    GivePlayerWeapon(playerid,25,500);
    GivePlayerWeapon(playerid,30,1000);


    rand = random(sizeof(Dm2RandomSpawn));
    SetPlayerPos(playerid,Dm2RandomSpawn[rand][0],Dm2RandomSpawn[rand][1],Dm2RandomSpawn[rand][2]);
    dm2True[playerid] = 1;
    return 1;
    }
    else
    {
    SendClientMessage(playerid, ROT,"Du bist zurzeit in einem DM! Benutze /exit um zu Verlassen.");
    return 1;
    }
    }


    ocmd:exit(playerid,params[])
    {
    if(dmTrue[playerid] == 1)
    {
    SpawnPlayer(playerid);
    SetPlayerVirtualWorld(playerid, 0);
    dmTrue[playerid] = 0;
    return 1;
    }
    else
    {
    SendClientMessage(playerid, ROT,"Du bist in keinem dm! (Vielleicht /exit2)");
    }
    return 1;
    }


    ocmd:exit2(playerid,params[])
    {
    if(dm2True[playerid] == 1)
    {
    SpawnPlayer(playerid);
    SetPlayerVirtualWorld(playerid, 0);
    dm2True[playerid] = 0;
    return 1;
    }
    else
    {
    SendClientMessage(playerid, ROT,"Du bist in keinem dm!");
    }
    return 1;
    }


  • Warum erstellst du immer wieder die Float:DMRandomspawn?


    Mach die mal Global und nicht immer wieder ^^


    MfG
    Geronimo