Immobilien Fehler

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 Commuity,


    immer wenn ich mich einlogge kommt ein Dialog ob ich dieses Immobilie kaufen oder nicht kaufen will...


    aber ich fordere das Immobilie eigentlich nur dann an, wenn er an einem Haus ist, wo es keinen besitzer gibt...
    aberr trotzdem kommt es...


    public Update()
    {
    for(new o = 0; o < sizeof(Bankfach); o++)
    {
    if(Bankfach[o][1] > 0) Bankfach[o][1]--;
    }
    for(new m = 0; m < sizeof(Mueltonnen); m++)
    {
    if(Mueltonnen[m][1] > 0) Mueltonnen[m][1]--;
    }
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if(IstAmHaus(i) && anwasdran[i] == 0 )
    {
    if(strcmp("Keiner",HausInfo[AnHaus[i]][HausName],true) == 0)
    {
    if(GetPVarInt(i,"Eingeloggt") == 1){
    if(hatload[i] == 0){Immobilie(i);hatload[i] = 1;}
    anwasdran[i] = 1;
    TextDrawShowForPlayer(i,IBox1[i]);
    TextDrawShowForPlayer(i,IBox2[i]);
    TextDrawShowForPlayer(i,Uberimo[i]);
    TextDrawShowForPlayer(i,Text1[i]);
    TextDrawShowForPlayer(i,Text2[i]);
    TextDrawShowForPlayer(i,imkaufen[i]);
    TextDrawShowForPlayer(i,imabbrechen[i]);
    SelectTextDraw(i, 0xBEBEBEFF);
    }
    }else{}
    }
    else if(IstAmBiz(i)&&anwasdran[i] == 0)
    {
    if(strcmp("Keiner",BizInfo[AnBiz[i]][BizName],true) == 0)
    {
    if(GetPVarInt(i,"Eingeloggt") == 1){
    if(hatload[i] == 0){Immobilie(i);hatload[i] = 1;}
    anwasdran[i] = 2;
    TextDrawShowForPlayer(i,IBox1[i]);
    TextDrawShowForPlayer(i,IBox2[i]);
    TextDrawShowForPlayer(i,Uberimo[i]);
    TextDrawShowForPlayer(i,Text1[i]);
    TextDrawShowForPlayer(i,Text2[i]);
    TextDrawShowForPlayer(i,imkaufen[i]);
    TextDrawShowForPlayer(i,imabbrechen[i]);
    SelectTextDraw(i, 0xBEBEBEFF);
    }
    }else{}
    }
    else{}
    }
    return 1;
    }

  • Mogly1: Das ist das gleiche. ! ist äquivalent zu == 0.


    Debugge die Funktion so, dann weißt du an welchem Haus du bist:
    public IstAmHaus(playerid){


    for(new i=0; i<MAX_HAUS; i++)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,HausInfo[i][hausx],HausInfo[i][hausy],HausInfo[i][hausz]))
    {
    printf("AnHaus (playerid %d) = %d (%f/%f/%f)", playerid, i, HausInfo[i][hausx],HausInfo[i][hausy],HausInfo[i][hausz]);
    AnHaus[playerid] = i;
    return 1;
    }
    }
    return 0;
    }

  • [18:51:38] [join] McGarrett has joined the server (0:92.74.167.88)
    [18:51:39] AnHaus (playerid 0) = 0 (0.000000/0.000000/0.000000)
    [18:51:40] AnHaus (playerid 0) = 0 (0.000000/0.000000/0.000000)
    [18:51:41] AnHaus (playerid 0) = 0 (0.000000/0.000000/0.000000)
    [18:51:42] AnHaus (playerid 0) = 0 (0.000000/0.000000/0.000000)
    [18:51:43] AnHaus (playerid 0) = 0 (0.000000/0.000000/0.000000)
    [18:51:45] AnHaus (playerid 0) = 0 (0.000000/0.000000/0.000000)
    [18:51:46] AnHaus (playerid 0) = 0 (0.000000/0.000000/0.000000)
    [18:51:47] AnHaus (playerid 0) = 0 (0.000000/0.000000/0.000000)
    [21:20:13] [connection] 88.153.211.209:61284 requests connection cookie.
    [21:20:14] Incoming connection: 88.153.211.209:61284 id: 1
    [21:20:14] [join] Chuco has joined the server (1:88.153.211.209)
    [21:20:15] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:20:16] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:20:17] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:20:18] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:20:19] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:20:20] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:21:10] [part] Chuco has left the server (1:1)
    [21:21:40] [connection] 88.153.211.209:63754 requests connection cookie.
    [21:21:41] Incoming connection: 88.153.211.209:63754 id: 1
    [21:21:41] [join] Chuco has joined the server (1:88.153.211.209)
    [21:21:42] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:21:43] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:21:44] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:21:45] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:21:46] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:21:47] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:21:48] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:21:49] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:22:07] [part] Chuco has left the server (1:1)
    [21:22:55] [connection] 88.153.211.209:58612 requests connection cookie.
    [21:22:56] Incoming connection: 88.153.211.209:58612 id: 1
    [21:22:56] [join] Chuco has joined the server (1:88.153.211.209)
    [21:22:57] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:22:58] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:22:59] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:00] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:01] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:02] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:03] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:04] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:05] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:06] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:07] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:08] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:09] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:10] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:12] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:23:13] AnHaus (playerid 1) = 0 (0.000000/0.000000/0.000000)
    [21:33:34] [part] Chuco has left the server (1:1)


    Das witzige ist ja, ich hab meine Häuser tabelle nicht mal erstellt.... aber auch wenn sie da ist kommt der dialog, und ich hab nicht mal ein haus erstellt..

  • Ahh, na dann:
    public IstAmHaus(playerid)
    {
    if(GetPlayerState(playerid) < 1 || GetPlayerState(playerid) > 3) return 0;
    for(new i=0; i<MAX_HAUS; i++)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,HausInfo[i][hausx],HausInfo[i][hausy],HausInfo[i][hausz]))
    {
    printf("AnHaus (playerid %d) = %d (%f/%f/%f)", playerid, i, HausInfo[i][hausx],HausInfo[i][hausy],HausInfo[i][hausz]);
    AnHaus[playerid] = i;
    return 1;
    }
    }
    return 0;
    }

  • Dann versuche es so:
    public IstAmHaus(playerid)
    {
    if(GetPlayerState(playerid) < 1 || GetPlayerState(playerid) > 3) return 0;
    for(new i=0; i<MAX_HAUS; i++)
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,HausInfo[i][hausx],HausInfo[i][hausy],HausInfo[i][hausz]) && HausInfo[i][hausx]!=0.0 && HausInfo[i][hausy]!=0.0)
    {
    printf("AnHaus (playerid %d) = %d (%f/%f/%f)", playerid, i, HausInfo[i][hausx],HausInfo[i][hausy],HausInfo[i][hausz]);
    AnHaus[playerid] = i;
    return 1;
    }
    }
    return 0;
    }


    Wenn das nicht geht, poste bitte nochmal was im Server Log steht.