Spawnchange permanent machen.

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
  • Hallo liebe Breasfish Community,
    ich habe mal eine frage, unzwar habe ich in meinem Game /spawnchange drinne, welches auch wenn man eingeloggt ist super geht, jedoch wenn sich ausloggt und dann wieder einloggt, spawnt man nicht mehr an seine fraktion...
    Hoffe eienr kann mir da helfen


    Hier der Befehl:


    if(strcmp(cmd, "/spawnchange", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(PlayerInfo[playerid][pPhousekey] != 255 || PlayerInfo[playerid][pEinmieten]==1)
    {
    if(Spectate[playerid] != 255 && PlayerInfo[playerid][pAdmin] < 1)
    {
    SendClientMessage(playerid, COLOR_RED, "Sie sind im TV.");
    return 1;
    }
    if(SpawnChange[playerid])
    {
    SendClientMessage(playerid, COLOR_GREEN, "Sie spawnen nun an ihre Fraktion.");
    SpawnChange[playerid] = 0;
    if(IsAnInstructor(playerid))
    {
    if(SchoolSpawn[playerid] == 0)
    {
    SchoolSpawn[playerid] = 1;
    SendClientMessage(playerid, COLOR_GREEN, "Sie spawnen nun an ihre Fraktion.");
    }
    else if(SchoolSpawn[playerid] == 1)
    {
    SchoolSpawn[playerid] = 0;
    SendClientMessage(playerid, COLOR_GREEN, "Sie spawnen nun an ihre Fraktion.");
    }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREEN, "Sie spawnen nun bei ihrem Wohnplatz.");
    SpawnChange[playerid] = 1;
    }
    }
    else
    {
    if(IsAnInstructor(playerid))
    {
    if(SchoolSpawn[playerid] == 0)
    {
    SchoolSpawn[playerid] = 1;
    SendClientMessage(playerid, COLOR_GREEN, "Sie spawnen nun an ihre Fraktion.");
    }
    else if(SchoolSpawn[playerid] == 1)
    {
    SchoolSpawn[playerid] = 0;
    SendClientMessage(playerid, COLOR_GREEN, "Sie spawnen nun an ihre Fraktion.");
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED, "Sie besitzten keine Unterkunft.");
    return 1;
    }
    }
    }
    return 1;
    }


    Hier die frak Spawns:


    if(house != 255)
    {
    if(SpawnChange[playerid] == 1) //If 1, then you get to your house, else spawn somewhere else
    {
    GivePlayerWeapons(playerid);
    SetPlayerToTeamColor(playerid);
    SetPlayerInterior(playerid,HouseInfo[house][hInt]);
    SetPlayerPos(playerid, HouseInfo[house][hExitx], HouseInfo[house][hExity],HouseInfo[house][hExitz]); // Warp the player
    PlayerInfo[playerid][pLocal] = house;
    PlayerInfo[playerid][pInt] = HouseInfo[house][hInt];
    SetPlayerVirtualWorld(playerid,house);
    return 1;
    }
    }
    if(PlayerInfo[playerid][pLeader] == 7 && SpawnChange[playerid] == 0 || PlayerInfo[playerid][pMember] == 7 && SpawnChange[playerid] == 0)//Mayor spawn
    {
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, 1125.5262,-2038.3003,69.8803);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerHealth(playerid,100);


    SetPlayerColor(playerid,COLOR_WHITE);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 1 && SpawnChange[playerid] == 0|| PlayerInfo[playerid][pLeader] == 1&& SpawnChange[playerid] == 0)//Police Force spawn & FBI/ATF
    {
    rand = random(sizeof(gCopPlayerSpawns));
    SetPlayerPos(playerid, gCopPlayerSpawns[rand][0], gCopPlayerSpawns[rand][1], gCopPlayerSpawns[rand][2]); // Warp the player
    SetPlayerFacingAngle(playerid, 270.0);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerPos(playerid, 1529.2499,-1669.5090,6.2188);
    SetPlayerFightingStyle(playerid,FIGHT_STYLE_BOXING);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 2 && SpawnChange[playerid] == 0|| PlayerInfo[playerid][pLeader] == 2&& SpawnChange[playerid] == 0)//Feuerwehr spawn
    {
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, -98.4841,-130.6801,985.3228);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerFightingStyle(playerid,FIGHT_STYLE_BOXING);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 3 && SpawnChange[playerid] == 0|| PlayerInfo[playerid][pLeader] == 3&& SpawnChange[playerid] == 0)//National Guard spawn
    {
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, 247.1237,1859.5850,14.0840);
    SetPlayerHealth(playerid,100);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerFightingStyle(playerid,FIGHT_STYLE_BOXING);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 4 && SpawnChange[playerid] == 0|| PlayerInfo[playerid][pLeader] == 4 && SpawnChange[playerid] == 0)//Fire/Ambulance spawn
    {
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, 1176.0070,-1323.4368,14.0000);
    SetPlayerHealth(playerid,100);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 5 && SpawnChange[playerid] == 0|| PlayerInfo[playerid][pLeader] == 5 && SpawnChange[playerid] == 0)//LaCosaNostra spawn
    {
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, 1446.5302,752.7120,10.8203);
    SetPlayerHealth(playerid,100);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 6 && SpawnChange[playerid] == 0|| PlayerInfo[playerid][pLeader] == 6 && SpawnChange[playerid] == 0)// Yakuza
    {
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, 2597.7327,1896.0011,11.0312);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerFightingStyle(playerid,FIGHT_STYLE_KUNGFU);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 8 && SpawnChange[playerid] == 0|| PlayerInfo[playerid][pLeader] == 8 && SpawnChange[playerid] == 0) //Hitman spawn
    {
    SetPlayerPos(playerid, 1045.4518,-303.5734,77.3594);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 9 && SpawnChange[playerid] == 0 || PlayerInfo[playerid][pLeader] == 9 && SpawnChange[playerid] == 0) //News Reporter Spawn
    {
    SetPlayerPos(playerid, 1788.4550,-1294.1179,13.5249);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 10 && SpawnChange[playerid] == 0 || PlayerInfo[playerid][pLeader] == 10 && SpawnChange[playerid] == 0) //Taxi Cab Company spawn
    {
    SetPlayerPos(playerid, 1764.2460,-1898.6119,13.5637);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 12 && SpawnChange[playerid] == 0 || PlayerInfo[playerid][pLeader] == 12 && SpawnChange[playerid] == 0) //Bloods spawn
    {
    SetPlayerPos(playerid, 2495.4028,-1686.7870,13.5150);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 13 && SpawnChange[playerid] == 0|| PlayerInfo[playerid][pLeader] == 13 && SpawnChange[playerid] == 0) //Crips spawn
    {
    SetPlayerPos(playerid, 2398.0854,-1207.3569,28.4055);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 14 && SpawnChange[playerid] == 0 || PlayerInfo[playerid][pLeader] == 14 && SpawnChange[playerid] == 0) //Hells Angels
    {
    SetPlayerPos(playerid, -2512.8030,1217.4124,37.4283);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerFightingStyle(playerid,FIGHT_STYLE_BOXING);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 15 && SpawnChange[playerid] == 0|| PlayerInfo[playerid][pLeader] == 15 && SpawnChange[playerid] == 0) //Aztecas spawn
    {
    SetPlayerPos(playerid, -1732.5946,1410.7190,7.1875);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 8;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if (PlayerInfo[playerid][pMember] == 17 && SpawnChange[playerid] == 0 || PlayerInfo[playerid][pLeader] == 17 && SpawnChange[playerid] == 0) //zoll spawn
    {
    SetPlayerPos(playerid, -535.8176,2594.3857,53.4154);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerFightingStyle(playerid,FIGHT_STYLE_BOXING);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if(PlayerInfo[playerid][pMember] == 16 && SpawnChange[playerid] == 0 || PlayerInfo[playerid][pLeader] == 16 && SpawnChange[playerid] == 0) //Aztecas spawn
    {
    SetPlayerPos(playerid, 2295.8992,2454.7068,10.8203);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerFightingStyle(playerid,FIGHT_STYLE_BOXING);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if(PlayerInfo[playerid][pMember] == 18 && SpawnChange[playerid] == 0 || PlayerInfo[playerid][pLeader] == 18 && SpawnChange[playerid] == 0) //BloodZ spawn
    {
    SetPlayerPos(playerid, 916.4681,-1232.2782,16.9766);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 1;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerHealth(playerid,100);
    return 1;
    }
    if(IsAnInstructor(playerid)) //Driving/Flying School spawn
    {
    if(SchoolSpawn[playerid] == 0)
    {
    SetPlayerPos(playerid, -2025.8103,-96.0586,35.1641);
    SetPlayerFacingAngle(playerid, 275.1114);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 3;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerHealth(playerid,100);
    }
    else if(SchoolSpawn[playerid] == 1)
    {
    SetPlayerPos(playerid, -2025.8103,-96.0586,35.1641);
    SetPlayerFacingAngle(playerid, 4.6505);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    SetPlayerColor(playerid,COLOR_WHITE);
    SetPlayerHealth(playerid,100);
    }
    return 1;
    }
    if(PlayerInfo[playerid][pFMember] != 255)
    {
    new family = PlayerInfo[playerid][pFMember];
    SetPlayerToTeamColor(playerid);
    SetPlayerInterior(playerid, FamilyInfo[family][FamilyInterior]);
    SetPlayerPos(playerid, FamilyInfo[family][FamilySpawn][0],FamilyInfo[family][FamilySpawn][1],FamilyInfo[family][FamilySpawn][2]);
    SetPlayerFacingAngle(playerid, FamilyInfo[family][FamilySpawn][3]);
    return 1;
    }
    else
    {
    SetPlayerToTeamColor(playerid);
    if(PlayerInfo[playerid][pOrigin] == 1 || PlayerInfo[playerid][pOrigin] == 2 || PlayerInfo[playerid][pOrigin] == 3)
    {
    SetPlayerPos(playerid,491.1983,-1494.3099,20.7957);
    SetPlayerFacingAngle(playerid,88.4209);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    }
    else
    {
    rand = random(sizeof(gRandomPlayerSpawns));
    SetPlayerPos(playerid, gRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]); // Warp the player
    SetPlayerFacingAngle(playerid, 180.0); //normal 270.0
    SetPlayerInterior(playerid,3); //normal 15
    PlayerInfo[playerid][pInt] = 3; //normal 15
    }
    return 1;
    }
    }
    return 1;
    }


    Hier beim Disconnect:


    public OnPlayerDisconnect(playerid, reason)
    {
    StreamObject_OnPlayerDisconnect(playerid);
    PlayerInfo[playerid][Bankrob]=0;
    //PlayerInfo[playerid][DM]=0;
    FirstSpawn[playerid] =1;
    new string[150];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,sendername,sizeof(sendername));
    OnPlayerCarUpdate(playerid);
    GetPlayerName(playerid,sendername,sizeof(sendername));
    ResetPlayerTimers(playerid);
    SpawnChange[playerid]=1;
    if(GetPVarInt(playerid, "TV") != 1000)
    {
    new tv;
    tv = GetPVarInt(playerid, "TV");
    SetPVarInt(tv, "TV", 1000);
    TogglePlayerSpectating(tv, 0);
    SetCameraBehindPlayer(tv);
    SendClientMessage(tv, 0xFFFFFF, "Der Spieler hat den Server verlassen!");
    }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(PlayerInfo[i][TogJoin] == 1)
    {
    switch(reason)
    {
    case 0:
    {
    format(string, sizeof(string), "(%d)%s hat den Server verlassen. (Timeout)",playerid,sendername);
    SendClientMessage(i,COLOR_WHITE,string);
    }
    case 1:
    {
    format(string, sizeof(string), "(%d)%s hat den Server verlassen.",playerid,sendername);
    SendClientMessage(i,COLOR_WHITE,string);
    }
    case 2:
    {
    format(string, sizeof(string), "(%d)%s hat den Server verlassen. (Crash)",playerid,sendername);
    SendClientMessage(i,COLOR_WHITE,string);
    }
    }
    }
    }
    }


    Bitte helft mir...


    MfG


    Woltlab

  • Wo Speichert er denn das Ab das der Spieler Überhabt Spawnchange gemacht hat? Der wert wird zwar Gesetzt aber nicht Gespeichert ;) Dann kann es ja nicht Gehen da ja neu einen Relog/Server Neustart der Wert wieder auf 0 ist


    zum Speichern z.b. SpielerSpeichern(playerid);

    Einmal editiert, zuletzt von JAGHAX ()

  • Wir es doch:
    new SpawnChange[MAX_PLAYERS];


    //M_Connect
    SpawnChange[playerid] = 1;


    SetPlayerSpawn(playerid);
    SetPlayerToTeamColor(playerid);
    PlayerFixRadio(playerid);
    SetPlayerSkin(playerid,PlayerInfo[playerid][ZiviSkin]);
    if(PlayerInfo[playerid][pEinmieten]==1 && SpawnChange[playerid]==1 && PlayerInfo[playerid][pJailed]==0)
    {
    SetPlayerPos(playerid,2262.83,-1137.71,1050.63);
    SetPlayerInterior(playerid,10);
    SetPlayerHealth(playerid,100);
    }


    format(var, 32, "Married=%d\n",PlayerInfo[playerid][pMarried]);fwrite(hFile, var);
    format(var, 32, "MarriedTo=%s\n",PlayerInfo[playerid][pMarriedTo]);fwrite(hFile, var);
    format(var, 32, "SpawnChange=%d\n",SpawnChange[playerid]);fwrite(hFile, var);
    format(var, 32, "WantedLevel=%d\n",WantedLevel[playerid]);fwrite(hFile, var);


    if( strcmp( key , "Married" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMarried] = strval( val ); }
    if( strcmp( key , "MarriedTo" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(PlayerInfo[playerid][pMarriedTo], val, 0, strlen(val)-1, 255); }
    if( strcmp( key , "SpawnChange" , true ) == 0 ) { val = ini_GetValue( Data ); SpawnChange[playerid] = strval( val ); }
    if( strcmp( key , "WantedLevel" , true ) == 0 ) { val = ini_GetValue( Data ); WantedLevel[playerid] = strval( val ); }

  • Du verwendest doch bereits das alte Dinisystem... verwende es doch auch zum saven deiner Vars.


    Func: ini_SetValue


    //EDIT
    Jetzt bringst du mich durcheinander..


    Was willst du jetzt verwenden.. Das Dinisystem oder das Filesystem??


    Gruss: Sonic

    I didn't hit you. I high fived your face.

  • Hab den Fehler gefunden Du hast bei Disconnect SpawnChange[playerid]=1; (Das heißt das wenn er Offline geht das SpawnChange sich auf 1 setzt.) Mach das einfach raus dann solltes es gehen.