Kleine Frage bezüglich OnPlayerRequestclass/OnPlayerRequestSpawn

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 wollte mal wissen was die bessere Varriante wäre von Beiden


    so
    public OnPlayerRequestClass(playerid, classid)
    {
    SetSpawnInfo(playerid,0,26,0.0,0.0,0.0,0,0,0,0,0,0,0);
    SpawnPlayer(playerid);
    return 1;

    }


    public OnPlayerRequestSpawn(playerid)
    {
    if(sInfo[playerid][PTot] == 1)
    {
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"Du bist soeben gestorben!");
    SendClientMessageEx(playerid,weiß,"Gleich wird ein Wunder passieren!");
    SetTimer("sekunde",sInfo[playerid][tott],0);
    SetPlayerVirtualWorld(playerid,89);
    SetSpawnInfo(playerid,0,sInfo[playerid][Skin],816.6987,-1103.0229,25.7914,271.5753,0,0,0,0,0,0);
    SetCameraBehindPlayer(playerid);
    SpawnPlayer(playerid);
    SetCameraBehindPlayer(playerid);
    return 1;
    }
    else if(sInfo[playerid][jailtime] > 0)
    {
    SendClientMessageEx(playerid,IGELB,"Du musst deine Zeit im Knast noch absitzen!");
    SetTimer("sekunde",sInfo[playerid][jailtime],0);
    SetPlayerInterior(playerid,10);
    SetPlayerVirtualWorld(playerid,24);
    SetSpawnInfo(playerid,0,sInfo[playerid][Skin],sInfo[playerid][kx],sInfo[playerid][ky],sInfo[playerid][kz],0.0,0,0,0,0,0,0);
    SetCameraBehindPlayer(playerid);
    SpawnPlayer(playerid);
    SetCameraBehindPlayer(playerid);
    return 1;
    }
    else
    {
    if(sInfo[playerid][spawnchange]==0)
    {
    SetSpawnInfo(playerid,0,sInfo[playerid][Skin],1760.8271,-1895.8221,13.5615,268.2114,0,0,0,0,0,0);
    SetCameraBehindPlayer(playerid);
    SetPlayerInterior(playerid,0);
    SetPlayerVirtualWorld(playerid,0);
    SpawnPlayer(playerid);
    SetCameraBehindPlayer(playerid);
    return 1;
    }
    else if(sInfo[playerid][spawnchange]==1)
    {
    new fID;
    fID = sInfo[playerid][fraktion];
    SetSpawnInfo(playerid,0,sInfo[playerid][Skin], fInfo[fID][f_x],fInfo[fID][f_y],fInfo[fID][f_z],fInfo[fID][f_r],0,0,0,0,0,0);
    SetCameraBehindPlayer(playerid);
    SetPlayerInterior(playerid, fInfo[fID][f_inter]);
    SetPlayerVirtualWorld(playerid, fInfo[fID][f_world]);
    SetPlayerSkin(playerid,sInfo[playerid][Skin]);
    GivePlayerWeapon(playerid, fInfo[fID][f_waffe1], fInfo[fID][f_ammo1]);
    GivePlayerWeapon(playerid, fInfo[fID][f_waffe2], fInfo[fID][f_ammo2]);
    GivePlayerWeapon(playerid, fInfo[fID][f_waffe3], fInfo[fID][f_ammo3]);
    GivePlayerWeapon(playerid, fInfo[fID][f_waffe4], fInfo[fID][f_ammo4]);
    SpawnPlayer(playerid);
    SetCameraBehindPlayer(playerid);
    return 1;
    }
    }
    return 1;
    }



    oder so


    public OnPlayerRequestClass(playerid)
    {
    if(sInfo[playerid][PTot] == 1)
    {
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"Du bist soeben gestorben!");
    SendClientMessageEx(playerid,weiß,"Gleich wird ein Wunder passieren!");
    SetTimer("sekunde",sInfo[playerid][tott],0);
    SetPlayerVirtualWorld(playerid,89);
    SetSpawnInfo(playerid,0,sInfo[playerid][Skin],816.6987,-1103.0229,25.7914,271.5753,0,0,0,0,0,0);
    SetCameraBehindPlayer(playerid);
    SpawnPlayer(playerid);
    SetCameraBehindPlayer(playerid);
    return 1;
    }
    else if(sInfo[playerid][jailtime] > 0)
    {
    SendClientMessageEx(playerid,IGELB,"Du musst deine Zeit im Knast noch absitzen!");
    SetTimer("sekunde",sInfo[playerid][jailtime],0);
    SetPlayerInterior(playerid,10);
    SetPlayerVirtualWorld(playerid,24);
    SetSpawnInfo(playerid,0,sInfo[playerid][Skin],sInfo[playerid][kx],sInfo[playerid][ky],sInfo[playerid][kz],0.0,0,0,0,0,0,0);
    SetCameraBehindPlayer(playerid);
    SpawnPlayer(playerid);
    SetCameraBehindPlayer(playerid);
    return 1;
    }
    else
    {
    if(sInfo[playerid][spawnchange]==0)
    {
    SetSpawnInfo(playerid,0,sInfo[playerid][Skin],1760.8271,-1895.8221,13.5615,268.2114,0,0,0,0,0,0);
    SetCameraBehindPlayer(playerid);
    SetPlayerInterior(playerid,0);
    SetPlayerVirtualWorld(playerid,0);
    SpawnPlayer(playerid);
    SetCameraBehindPlayer(playerid);
    return 1;
    }
    else if(sInfo[playerid][spawnchange]==1)
    {
    new fID;
    fID = sInfo[playerid][fraktion];
    SetSpawnInfo(playerid,0,sInfo[playerid][Skin], fInfo[fID][f_x],fInfo[fID][f_y],fInfo[fID][f_z],fInfo[fID][f_r],0,0,0,0,0,0);
    SetCameraBehindPlayer(playerid);
    SetPlayerInterior(playerid, fInfo[fID][f_inter]);
    SetPlayerVirtualWorld(playerid, fInfo[fID][f_world]);
    SetPlayerSkin(playerid,sInfo[playerid][Skin]);
    GivePlayerWeapon(playerid, fInfo[fID][f_waffe1], fInfo[fID][f_ammo1]);
    GivePlayerWeapon(playerid, fInfo[fID][f_waffe2], fInfo[fID][f_ammo2]);
    GivePlayerWeapon(playerid, fInfo[fID][f_waffe3], fInfo[fID][f_ammo3]);
    GivePlayerWeapon(playerid, fInfo[fID][f_waffe4], fInfo[fID][f_ammo4]);
    SpawnPlayer(playerid);
    SetCameraBehindPlayer(playerid);
    return 1;
    }
    }
    return 1;
    }

  • Was genau hast du denn vor? Generell ist es so, dass OnPlayerRequestSpawn nur dann aufgerufen wird, wenn du auf den Spawn Button drückst, in der Standard Class Selection, daher würde die erste Variante relativ wenig bringen.


    Gegebenenfalls sollte der Code stattdessen zu OnPlayerSpawn.

  • Ich will es ja so machen
    Spieler Stribt und wenn man ihn Spawnt er wieder aufm Friedhof ist habe ich gemacht
    und wenn er connectet das das hier
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"");
    SendClientMessageEx(playerid,weiß,"Du bist soeben gestorben!");
    SendClientMessageEx(playerid,weiß,"Gleich wird ein Wunder passieren!");
    da stehen soll und er dann aufm Friedhof spawnt