Dynamisches Haus System von Funy888

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
  • Den link hab ich net aber die pawno datei


    /* Haussystem von funy888
    Du darfst es nicht als deins ausgeben
    Du darfst kein weiteren Downloadlink machen



    */



    #include <a_samp>
    #include <dini>
    #include <bfx_imStream>
    #include <ocmd>


    #define FILTERSCRIPT


    #define MAX_HOUSE 500


    #define green 0x00AF00FF
    #define blue 0xBC1100FF
    #define error 0xC30000FF
    #define info 0x00C000FF




    #pragma tabsize 0


    new hausdatei[255];
    new hausInfos[MAX_PLAYERS] = 0;
    new lastVirtualWorld = 0;


    forward loadHouse(id);
    forward saveHouse(id);
    forward unloadHouse(id);
    forward reloadHouse(id);
    forward resetInfos(playerid);


    enum houseIdConf {
    hInterior, Float:x,Float:y,Float:z
    }
    new hEnter[][houseIdConf] = {
    {3, 235.2818,1187.2037,1080.2578},
    {2, 225.756989, 1240.000000, 1082.149902},
    {1, 223.1909 ,1287.2478, 1082.1406},
    {7, 225.630997, 1022.479980, 1084.069946},
    {15, 294.6726,1473.5618,1080.2578},
    {15, 328.0414,1478.0096,1084.4375},
    {15, 385.803986, 1471.769897, 1080.209961},
    {1,2233.8032, 1712.2303, 1011.7632}
    };
    enum House {
    hPickupid,
    Text3D:hText,
    hMapID,
    hOwner[255],
    hPreis[255],
    Float:hX,
    Float:hY,
    Float:hZ,
    hLocked,
    hPickupExit,
    hEnterID,
    hVirtualWorld
    }


    new hInfo[MAX_HOUSE][House];


    public OnFilterScriptInit() {
    for (new i=1;i<=MAX_HOUSE;i++) {
    format(hausdatei,sizeof hausdatei, "House/House%d.cfg", i);
    if ( dini_Exists(hausdatei) ) { loadHouse(i); }
    }
    return 1;
    }


    public OnFilterScriptExit()
    {
    for (new i=1;i<=MAX_HOUSE;i++) {
    format(hausdatei,sizeof hausdatei, "House/House%d.cfg", i);
    if ( dini_Exists(hausdatei) ) { saveHouse(i); unloadHouse(i); }
    }
    return 1;
    }


    public resetInfos(playerid) {
    hausInfos[playerid] = 0;
    return 1;
    }


    public saveHouse(id) {
    format(hausdatei,sizeof hausdatei, "House/House%d.cfg", id);
    if ( dini_Exists(hausdatei) ) {
    dini_Set(hausdatei, "Owner", hInfo[id][hOwner]);
    }
    return 1;
    }


    public reloadHouse(id) {
    unloadHouse(id);
    loadHouse(id);
    return 1;
    }


    public unloadHouse(id) {
    if ( dini_Exists("House/") ) {
    format(hausdatei,sizeof hausdatei, "House/House%d.cfg", id);
    if ( dini_Exists(hausdatei) ) {
    bRemoveMapIcon(hInfo[id][hMapID]);
    DestroyPickup(hInfo[id][hPickupid]);
    DestroyPickup(hInfo[id][hPickupExit]);
    Delete3DTextLabel(hInfo[id][hText]);
    }
    }
    return 1;
    }


    public loadHouse(id) {
    new pID, mID, color;
    if ( dini_Exists("House/") ) {
    format(hausdatei,sizeof hausdatei, "House/House%d.cfg", id);
    if ( dini_Exists(hausdatei) ) {
    hInfo[id][hOwner] = dini_Get(hausdatei, "Owner");
    hInfo[id][hPreis] = dini_Int(hausdatei, "Preis");
    hInfo[id][hEnterID] = dini_Int(hausdatei, "Int");
    hInfo[id][hLocked] = dini_Int(hausdatei, "Locked");
    hInfo[id][hX] = dini_Float(hausdatei, "hX");
    hInfo[id][hY] = dini_Float(hausdatei, "hY");
    hInfo[id][hZ] = dini_Float(hausdatei, "hZ");
    if(!strcmp(hInfo[id][hOwner], "Staat", false)) {
    pID = 1273;
    mID = 31;
    color = green;
    }
    else { pID = 1272; mID = 32; color = blue; }
    lastVirtualWorld = dini_Int(hausdatei, "VW");
    hInfo[id][hVirtualWorld] = lastVirtualWorld;
    hInfo[id][hMapID] = bCreateMapIcon(hInfo[id][hX],hInfo[id][hY],hInfo[id][hZ], mID, 0);
    hInfo[id][hPickupid] = CreatePickup(pID, 1, hInfo[id][hX],hInfo[id][hY],hInfo[id][hZ], 0);
    hInfo[id][hPickupExit] = CreatePickup(1318, 1, hEnter[hInfo[id][hEnterID]][x],hEnter[hInfo[id][hEnterID]][y],hEnter[hInfo[id][hEnterID]][z], hInfo[id][hVirtualWorld]);
    new string[255];
    if ( mID == 31 ) { format(string,sizeof string, "Besitzer: %s\nPreis: %d$", hInfo[id][hOwner], hInfo[id][hPreis]); }
    else { format(string,sizeof string, "Besitzer: %s\nPreis: Nicht zum Verkauf", hInfo[id][hOwner]); }
    hInfo[id][hText] = Create3DTextLabel(string, color, hInfo[id][hX],hInfo[id][hY],hInfo[id][hZ] + 0.5,10.0,0);
    }
    }
    return 1;
    }




    public OnPlayerDeath(playerid, killerid, reason) {
    SetPlayerVirtualWorld(playerid, 0);
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    new houseID = hausInfos[playerid], string[255], name[255];
    switch(dialogid) {
    case 1800: {
    if ( response == 1 ) {
    if(!strcmp(hInfo[houseID][hOwner], "Staat", false)) {
    if ( GetPlayerMoney(playerid) >=hInfo[houseID][hPreis] ) {
    GetPlayerName(playerid, name, 255);
    hInfo[houseID][hOwner] = name;
    GivePlayerMoney(playerid, -hInfo[houseID][hPreis]);
    saveHouse(houseID);
    reloadHouse(houseID);
    GameTextForPlayer(playerid, "Immobilien gekauft", 2000, 1);
    }
    else { SendClientMessage(playerid, error, "Du hast nicht genug Geld."); }
    }
    else { SendClientMessage(playerid, error, "Das Haus steht nicht zum Verkauf."); }
    }
    SetTimerEx("resetInfos", 2000, 0, "i", playerid);
    }
    case 1801: {
    if ( response == 1 ) {
    GetPlayerName(playerid, name, 255);
    if(!strcmp(hInfo[houseID][hOwner], name, false)) {
    SendClientMessage(playerid, info, "Du bist jetzt in deinem Haus.");
    SetPlayerInterior(playerid, hEnter[hInfo[houseID][hEnterID]][hInterior]);
    SetPlayerPos(playerid, hEnter[hInfo[houseID][hEnterID]][x],hEnter[hInfo[houseID][hEnterID]][y],hEnter[hInfo[houseID][hEnterID]][z]);
    SetPlayerVirtualWorld(playerid, hInfo[houseID][hVirtualWorld]);
    }
    else {
    if ( hInfo[houseID][hLocked] == 1 ) { SendClientMessage(playerid, error, "Das Haus ist abgeschlossen."); }
    else {
    SendClientMessage(playerid, info, "Du hast das Haus betreten.");
    SetPlayerInterior(playerid, hEnter[hInfo[houseID][hEnterID]][hInterior]);
    SetPlayerPos(playerid, hEnter[hInfo[houseID][hEnterID]][x],hEnter[hInfo[houseID][hEnterID]][y],hEnter[hInfo[houseID][hEnterID]][z]);
    SetPlayerVirtualWorld(playerid, hInfo[houseID][hVirtualWorld]);
    }
    }
    }
    SetTimerEx("resetInfos", 2000, 0, "i", playerid);
    }
    case 1802: {
    if ( response == 1 ) {
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, hInfo[houseID][hX],hInfo[houseID][hY],hInfo[houseID][hZ]);
    format(string,sizeof string, "Du hast das Haus von %s verlassen", hInfo[houseID][hOwner]);
    SendClientMessage(playerid, info, string);


    SetTimerEx("resetInfos", 3500, 0, "i", playerid);
    }
    else { SetTimerEx("resetInfos", 2000, 0, "i", playerid); }
    }
    case 1803: {
    if ( response == 1 ) {
    new house = strval(inputtext);
    GetPlayerName(playerid, name, 255);
    format(string,sizeof string, "House/House%d.cfg", house);
    if ( dini_Exists(string) ) {
    new owner[255];
    owner = dini_Get(string, "Owner");
    if( !strcmp(owner, name, false)) {
    if ( hInfo[house][hLocked] == 1 ) { hInfo[house][hLocked] = 0; SendClientMessage(playerid, info, "Dein Haus wurde aufgeschlossen."); }
    else { hInfo[house][hLocked] = 1; SendClientMessage(playerid, info, "Dein Haus wurde abgeschlossen."); }
    }
    else { SendClientMessage(playerid, error, "Das Haus gehört nicht dir."); }
    }
    else { SendClientMessage(playerid, error, "Es existiert kein Haus mit dieser Hausnummer."); }
    }
    }
    }
    return 1;
    }


    public OnPlayerPickUpPickup(playerid, pickupid) {
    new string[255], houseEnter = -1, houseExit = -1, button[255], verkaufstatus[255];
    for (new i=1;i<MAX_HOUSE;i++) {
    format(hausdatei,sizeof hausdatei, "House/House%d.cfg", i);
    if ( dini_Exists(hausdatei) ) {
    if ( hInfo[i][hPickupid] == pickupid ) { houseEnter = i; format(string,sizeof string, "%d - %d",hInfo[i][hPickupid], pickupid); }
    if ( hInfo[i][hPickupExit] == pickupid ) { houseExit = i; format(string,sizeof string, "%d - %d",hInfo[i][hPickupExit], pickupid); }
    }
    }
    if ( houseEnter != -1 && hausInfos[playerid] <= 0 ) {
    new houseNR = houseEnter;
    hausInfos[playerid] = houseNR;
    format(button, 255, ""); format(verkaufstatus,255, "Nicht zum Verkauf");
    if(!strcmp(hInfo[houseNR][hOwner], "Staat", false)) {
    format(verkaufstatus,255, "%d$", hInfo[houseNR][hPreis]);
    format(string,sizeof string, "Hausnummer:\t\t %d\nBesitzer:\t\t %s\nPreis:\t\t\t %s", houseNR, hInfo[houseNR][hOwner], verkaufstatus);
    ShowPlayerDialog(playerid, 1800, DIALOG_STYLE_MSGBOX, "Haus Informationen", string, "Kaufen", "Schließen");
    }
    else {
    format(button, 255, ""); format(verkaufstatus,255, "Nicht zum Verkauf");
    format(string,sizeof string, "Hausnummer:\t\t %d\nBesitzer:\t\t %s\nPreis:\t\t\t %s", houseNR, hInfo[houseNR][hOwner], verkaufstatus);
    ShowPlayerDialog(playerid, 1801, DIALOG_STYLE_MSGBOX, "Haus Informationen", string, "Betreten", "Schließen");
    }
    }
    else if ( houseExit != -1 && hausInfos[playerid] <= 0 ) {
    new houseNR = houseExit;
    hausInfos[playerid] = houseNR;
    format(string,sizeof string, "Willst du das Haus von %s verlassen?", hInfo[houseNR][hOwner]);
    ShowPlayerDialog(playerid, 1802, DIALOG_STYLE_MSGBOX, "Haus Informationen", string, "Ja", "Nein");
    }
    return 1;
    }


    ocmd:lock(playerid, params[]) {
    #pragma unused params
    PlayerWillLockHouse(playerid);
    return 1;
    }


    ocmd:chouse(playerid, params[]) {
    new preis, string[255], interior;
    if ( IsPlayerAdmin(playerid) ) {
    format(string, sizeof(string), "Bitte benutze /chouse [Geld] [HausID].");
    if ( sscanf(params, "ii", preis, interior) ) { SendClientMessage(playerid, error, string); }
    else {
    if ( interior <= sizeof hEnter - 1 ) {
    new Float:pX, Float:pY, Float:pZ;
    GetPlayerPos(playerid, pX, pY, pZ);
    new first = -1;
    for (new i=1;i<=MAX_HOUSE;i++) {
    format(hausdatei,sizeof hausdatei, "House/House%d.cfg", i);
    if ( !dini_Exists(hausdatei) && first == -1 ) { first = i; }
    }
    format(hausdatei,sizeof hausdatei, "House/House%d.cfg", first);
    format(string,255,"Staat");
    dini_Create(hausdatei);
    dini_Set(hausdatei, "Owner", string);
    dini_IntSet(hausdatei, "Preis", preis);
    dini_IntSet(hausdatei, "Int", interior);
    dini_IntSet(hausdatei, "Locked", 1);
    dini_IntSet(hausdatei, "VW", lastVirtualWorld + 1);
    dini_FloatSet(hausdatei, "hX", pX);
    dini_FloatSet(hausdatei, "hY", pY);
    dini_FloatSet(hausdatei, "hZ", pZ);


    hInfo[first][hOwner] = string;
    hInfo[first][hPreis] = preis;
    hInfo[first][hEnterID] = interior;
    hInfo[first][hVirtualWorld] = lastVirtualWorld + 1;
    hInfo[first][hX] = pX,hInfo[first][hY] = pY,hInfo[first][hZ] = pZ;
    loadHouse(first);
    lastVirtualWorld ++;
    }
    else { SendClientMessage(playerid, error, "Falsche Interior Zahl."); }
    }
    } else { SendClientMessage(playerid, error, "Du bist kein Admin."); }
    return 1;
    }


    forward PlayerWillLockHouse(playerid);


    public PlayerWillLockHouse(playerid) {
    new Float:pX, Float:pY, Float:pZ, name[255], hasHouse;
    GetPlayerPos(playerid, pX, pY, pZ);
    GetPlayerName(playerid, name, 255);
    for (new i=1;i<MAX_HOUSE;i++) {
    format(hausdatei,sizeof hausdatei, "House/House%d.cfg", i);
    if ( dini_Exists(hausdatei) ) {
    if( !strcmp(hInfo[i][hOwner], name, false)) { hasHouse ++; }
    }
    }
    if ( hasHouse >= 1 ) { ShowPlayerDialog(playerid, 1803, DIALOG_STYLE_INPUT, "Haus", "Bitte gib eine Haus Nummer ein.", "Bestätigen", "Abbrechen"); }
    else { SendClientMessage(playerid, error, "Du hast kein Haus"); }
    return 1;
    }


    stock sscanf(string[], format[], {Float,_}:...)
    {
    #if defined isnull
    if (isnull(string))
    #else
    if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
    #endif
    {
    return format[0];
    }
    #pragma tabsize 4
    new
    formatPos = 0,
    stringPos = 0,
    paramPos = 2,
    paramCount = numargs(),
    delim = ' ';
    while (string[stringPos] && string[stringPos] <= ' ')
    {
    stringPos++;
    }
    while (paramPos < paramCount && string[stringPos])
    {
    switch (format[formatPos++])
    {
    case '\0':
    {
    return 0;
    }
    case 'i', 'd':
    {
    new
    neg = 1,
    num = 0,
    ch = string[stringPos];
    if (ch == '-')
    {
    neg = -1;
    ch = string[++stringPos];
    }
    do
    {
    stringPos++;
    if ('0' <= ch <= '9')
    {
    num = (num * 10) + (ch - '0');
    }
    else
    {
    return -1;
    }
    }
    while ((ch = string[stringPos]) > ' ' && ch != delim);
    setarg(paramPos, 0, num * neg);
    }
    case 'h', 'x':
    {
    new
    num = 0,
    ch = string[stringPos];
    do
    {
    stringPos++;
    switch (ch)
    {
    case 'x', 'X':
    {
    num = 0;
    continue;
    }
    case '0' .. '9':
    {
    num = (num << 4) | (ch - '0');
    }
    case 'a' .. 'f':
    {
    num = (num << 4) | (ch - ('a' - 10));
    }
    case 'A' .. 'F':
    {
    num = (num << 4) | (ch - ('A' - 10));
    }
    default:
    {
    return -1;
    }
    }
    }
    while ((ch = string[stringPos]) > ' ' && ch != delim);
    setarg(paramPos, 0, num);
    }
    case 'c':
    {
    setarg(paramPos, 0, string[stringPos++]);
    }
    case 'f':
    {


    new changestr[16], changepos = 0, strpos = stringPos;
    while(changepos < 16 && string[strpos] && string[strpos] != delim)
    {
    changestr[changepos++] = string[strpos++];
    }
    changestr[changepos] = '\0';
    setarg(paramPos,0,_:floatstr(changestr));
    }
    case 'p':
    {
    delim = format[formatPos++];
    continue;
    }
    case '\'':
    {
    new
    end = formatPos - 1,
    ch;
    while ((ch = format[++end]) && ch != '\'') {}
    if (!ch)
    {
    return -1;
    }
    format[end] = '\0';
    if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
    {
    if (format[end + 1])
    {
    return -1;
    }
    return 0;
    }
    format[end] = '\'';
    stringPos = ch + (end - formatPos);
    formatPos = end + 1;
    }
    case 'u':
    {
    new
    end = stringPos - 1,
    id = 0,
    bool:num = true,
    ch;
    while ((ch = string[++end]) && ch != delim)
    {
    if (num)
    {
    if ('0' <= ch <= '40')
    {
    id = (id * 50) + (ch - '0');
    }
    else
    {
    num = false;
    }
    }
    }
    if (num && IsPlayerConnected(id))
    {
    setarg(paramPos, 0, id);
    }
    else
    {
    #if !defined foreach
    #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
    #define __SSCANF_FOREACH__
    #endif
    string[end] = '\0';
    num = false;
    new
    name[MAX_PLAYER_NAME];
    id = end - stringPos;
    foreach (Player, playerid)
    {
    GetPlayerName(playerid, name, sizeof (name));
    if (!strcmp(name, string[stringPos], true, id))
    {
    setarg(paramPos, 0, playerid);
    num = true;
    break;
    }
    }
    if (!num)
    {
    setarg(paramPos, 0, INVALID_PLAYER_ID);
    }
    string[end] = ch;
    #if defined __SSCANF_FOREACH__
    #undef foreach
    #undef __SSCANF_FOREACH__
    #endif
    }
    stringPos = end;
    }
    case 's', 'z':
    {
    new
    i = 0,
    ch;
    if (format[formatPos])
    {
    while ((ch = string[stringPos++]) && ch != delim)
    {
    setarg(paramPos, i++, ch);
    }
    if (!i)
    {
    return -1;
    }
    }
    else
    {
    while ((ch = string[stringPos++]))
    {
    setarg(paramPos, i++, ch);
    }
    }
    stringPos--;
    setarg(paramPos, i, '\0');
    }
    default:
    {
    continue;
    }
    }
    while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
    {
    stringPos++;
    }
    while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
    {
    stringPos++;
    }
    paramPos++;
    }
    do
    {
    if ((delim = format[formatPos++]) > ' ')
    {
    if (delim == '\'')
    {
    while ((delim = format[formatPos++]) && delim != '\'') {}
    }
    else if (delim != 'z')
    {
    return delim;
    }
    }
    }
    while (delim > ' ');
    return 0;
    }

    • Offizieller Beitrag

    In diesem Abschnitt einfach einfügen:
    new hEnter[][houseIdConf] = {{3, 235.2818,1187.2037,1080.2578},
    {2, 225.756989, 1240.000000, 1082.149902},
    {1, 223.1909 ,1287.2478, 1082.1406},
    {7, 225.630997, 1022.479980, 1084.069946},
    {15, 294.6726,1473.5618,1080.2578},
    {15, 328.0414,1478.0096,1084.4375},
    {15, 385.803986, 1471.769897, 1080.209961},
    {1,2233.8032, 1712.2303, 1011.7632} };

  • new hEnter[][houseIdConf] = {
    {3, 235.2818,1187.2037,1080.2578},
    {2, 225.756989, 1240.000000, 1082.149902},
    {1, 223.1909 ,1287.2478, 1082.1406},
    {7, 225.630997, 1022.479980, 1084.069946},
    {15, 294.6726,1473.5618,1080.2578},
    {15, 328.0414,1478.0096,1084.4375},
    {15, 385.803986, 1471.769897, 1080.209961},
    {1,2233.8032, 1712.2303, 1011.7632}
    };


    {INTERIORID,Xenter,Yenter,Zenter}


    ich hoffe du verstehst was ich damit meine.


    mfg
    GeForce


    /edit shoxinat0r war schneller


  • new hEnter[][houseIdConf] = {
    {3, 235.2818,1187.2037,1080.2578},
    {2, 225.756989, 1240.000000, 1082.149902},
    {1, 223.1909 ,1287.2478, 1082.1406},
    {7, 225.630997, 1022.479980, 1084.069946},
    {15, 294.6726,1473.5618,1080.2578},
    {15, 328.0414,1478.0096,1084.4375},
    {15, 385.803986, 1471.769897, 1080.209961},
    {1,2233.8032, 1712.2303, 1011.7632},
    {INTERIORID,X,Y,Z} //So musste das machen!
    };

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen