House system
#1

Ok I want this to basically find the interior name i put and search through and set it even if i have shortened it like for example i want the house interior to be cj's house and instead of putting cj's house i put just cj and it will do it.

pawn Код:
enum Hinfo
{
    HID,
    Float:Xpos,
    Float:Ypos,
    Float:Zpos,
    Howner[24],
    bool:Howned,
    interior,
    Interiorname[100]
}
new HouseInfo[MAX_HOUSES][Hinfo];
   
new House[MAX_PLAYERS];

new bool:HCreated[MAX_HOUSES];

enum InteriorInfo
{
    InteriorName[100],
    InteriorID,
    Float:InteriorX,
    Float:InteriorY,
    Float:InteriorZ
}
new Interiors [][InteriorInfo] =
{
    {"Ammunation 1", 1, 286.148986,-40.644397,1001.515625},
    {"Ammunation 2", 4, 286.800994,-82.547599,1001.515625},
    {"Ammunation 3", 6, 296.919982,-108.071998,1001.515625},
    {"Ammunation 4", 7, 314.820983,-141.431991,999.601562},
    {"Ammunation 5", 6, 316.524993,-167.706985,999.593750},
    {"Ammunation booths", 7, 302.292877,-143.139099,1004.062500},
    {"Ammunation range", 7, 298.507934,-141.647048,1004.054748},
    {"Budget inn motel room", 12, 444.646911,508.239044,1001.419494},
    {"Jefferson motel", 15, 2215.454833,-1147.475585,1025.796875},
    {"Off track betting shop", 3, 833.269775,10.588416,1004.179687},
    {"Sex shop", 3, -103.559165,-24.225606,1000.718750},
    {"Meat factory", 1, 963.418762,2108.292480,1011.030273},
    {"Zero's RC shop", 6, -2240.468505,137.060440,1035.414062},
    {"Catigula's basement", 1, 2169.461181,1618.798339,999.976562},
    {"Club", 17, 493.390991,-22.722799,1000.679687},
    {"Bar", 11, 501.980987,-69.150199,998.757812},
    {"Lil' probe inn", 18, -227.027999,1401.229980,27.765625},
    {"Denise room", 1, 244.411987,305.032989,999.148437},
    {"Katie room", 2, 271.884979,306.631988,999.148437},
    {"Helena room", 3, 291.282989,310.031982,999.148437},
    {"Michelle room", 4, 302.180999,300.722991,999.148437},
    {"Barbara room", 5, 322.197998,302.497985,999.148437},
    {"Millie room", 6, 346.870025,309.259033,999.155700},
    {"Sherman dam", 17, -959.564392,1848.576782,9.000000},
    {"B Dup's house", 3, 1527.229980,-11.574499,1002.097106},
    {"B Dup's crack pad", 2, 1523.509887,-47.821197,1002.130981},
    {"Cj's house", 3, 2496.049804,-1695.238159,1014.742187},
    {"Madd Doggs mansion", 5, 1267.663208,-781.323242,1091.906250},
    {"Ryders house", 2, 2454.717041,-1700.871582,1013.515197},
    {"Sweet's house", 1, 2527.654052,-1679.388305,1015.498596},
    {"Crack factory", 2, 2543.462646,-1308.379882,1026.728393},
    {"Big spread ranch", 3, 1212.019897,-28.663099,1000.953125},
    {"Strip club", 2, 1204.809936,-11.586799,1000.921875},
    {"Strip club private room", 2, 1204.809936,13.897239,1000.921875},
    {"Unnamed brothel", 3, 942.171997,-16.542755,1000.929687},
    {"Tiger skin brothel", 3, 964.106994,-53.205497,1001.124572},
    {"Pleasure domes", 3, -2640.762939,1406.682006,906.460937},
    {"Liberty city inside", 1, -794.806396,497.738037,1376.195312},
    {"Gang house", 5, 2350.339843,-1181.649902,1027.976562},
    {"Colonel Furhberger's", 8, 2807.619873,-1171.899902,1025.570312},
    {"Crack den", 5, 318.564971,1118.209960,1083.882812},
    {"Warehouse 1", 1, 1412.639892,-1.787510,1000.924377},
    {"Warehouse 2", 18, 1302.519897,-1.787510,1001.028259},
    {"Unused safe house", 12, 2324.419921,-1145.568359,1050.710083},
    {"RC Battlefield", 10, -975.975708,1060.983032,1345.671875}

};
stock HouseGetFreeSlot()
{
    for(new i = 0; i < MAX_HOUSES; i++)
    {
        if(!HCreated[i]) return i;
    }

    return -1;
}

stock GetInteriorIDFromName(intname[])
{
    for(new i = 0; i < 500; i++)
    {
        if (strfind(Interiors[i][InteriorName], intname, true) != -1)
            return Interiors[i][InteriorID];
    }
    return -1;
}

GetInteriorName(intname[])
{
    for(new i = 0;i < 47;i++)
    {
        if(strfind(Interiors[i][InteriorName], intname, true) != -1)
            return Interiors[i][InteriorName];
    }
    return -1;
}

stock HouseCreate(owner[], interiorname[], HouseInt, Float:X, Float:Y, Float:Z)
{
    new HouseID = HouseGetFreeSlot();
   
    HouseInfo[HouseID][Xpos] = X;
    HouseInfo[HouseID][Ypos] = Y;
    HouseInfo[HouseID][Zpos] = Z;
    format(HouseInfo[HouseID][Howner], 24, "%s", owner);
    HouseInfo[HouseID][Howned] = true;
    HCreated[HouseID] = true;
    HouseInfo[HouseID][HID] = CreateDynamicPickup(1273, 1, X, Y, Z, -1, -1, -1, 100.0);
    format(HouseInfo[HouseID][Interiorname], 100, "%s", GetInteriorName(interiorname));
    HouseInfo[HouseID][interior] = HouseInt;
   
    return 1;
}

CMD:chouse(playerid, params[])
{
    new owner[24], interiorName[100], intid, Float:pos[3];
    if(sscanf(params,"s[24]s[100]i",owner, interiorName, intid)) return SendClientMessage(playerid, -1, "Usage: /chouse <owner> <interior name> <interior id>");
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    HouseCreate(owner, interiorName, intid, pos[0], pos[1], pos[2]);
    return 1;
}

CMD:exithouse(playerid, params[])
{
    new HouseI = House[playerid];
    SetPlayerPos(playerid, HouseInfo[HouseI][Xpos], HouseInfo[HouseI][Ypos], HouseInfo[HouseI][Zpos]);
    return 1;
}

public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
    for(new i = 0; i < MAX_HOUSES; i++)
    {
        if(HouseInfo[i][HID] == pickupid)
        {
            SetPlayerInterior(playerid, HouseInfo[i][interior]);
            new Float:X, Float:Y, Float:Z;
            if (strfind(Interiors[i][InteriorName], HouseInfo[i][Interiorname], true) != -1)
            X = Interiors[i][InteriorX];
            Y = Interiors[i][InteriorY];
            Z = Interiors[i][InteriorZ];
            SetPlayerPos(playerid, X, Y, Z);
            new string[128];
            format(string, 128, "You have entered %s house", HouseInfo[i][Howner]);
            SendClientMessage(playerid, -1, string);
            House[playerid] = i;
            printf("Interior name: %s Interiorx %f Interiory %f Interiorz %f", HouseInfo[i][Interiorname], Interiors[i][InteriorX], Interiors[i][InteriorX]);
        }
    }
    return 1;
}
Reply
#2

Yo, u should use garhouse, you can create houses ingame its easy, search on ****** for the download. Its no longer on samp forums
Reply
#3

Quote:
Originally Posted by California_
Посмотреть сообщение
Yo, u should use garhouse, you can create houses ingame its easy, search on ****** for the download. Its no longer on samp forums
Are you serious? I didn't ask for a bluddy house system I asked for some help with mine.
Reply
#4

So , go and advertise that you are looking for a scripter
Reply
#5

Omg does anyone actually read the post? I'm perfectly capable of scripting, I may not be the best but I'm capable. I'm asking for some help with scripting not asking someone to script for me or someone to link me to a already scripted system
Reply
#6

so wait whats your problem>?
Reply
#7

Basically this function isnt working:
pawn Код:
GetInteriorName(intname[])
{
    for(new i = 0;i < 47;i++)
    {
        if(strfind(Interiors[i][InteriorName], intname, true) != -1)
            return Interiors[i][InteriorName];
    }
    return -1;
}
It's basically meant to see if any part of any interior is the same to the given interior name then return the interior name. It's not doing that and if i just put cj instead of the full name (cj's house) it wont convert this to the full name it will just say cj. Because this is not working when i enter the pickup i fall from the air
Reply
#8

Try this..


pawn Код:
enum Hinfo
{
    HID,
    Float:Xpos,
    Float:Ypos,
    Float:Zpos,
    Howner[24],
    bool:Howned,
    interior,
    Interiorname[100]
}
new HouseInfo[MAX_HOUSES][Hinfo];
   
new House[MAX_PLAYERS];

new bool:HCreated[MAX_HOUSES];

enum InteriorInfo
{
    InteriorName[100],
    InteriorID,
    Float:InteriorX,
    Float:InteriorY,
    Float:InteriorZ
}
new Interiors [][InteriorInfo] =
{
    {"Ammunation 1", 1, 286.148986,-40.644397,1001.515625},
    {"Ammunation 2", 4, 286.800994,-82.547599,1001.515625},
    {"Ammunation 3", 6, 296.919982,-108.071998,1001.515625},
    {"Ammunation 4", 7, 314.820983,-141.431991,999.601562},
    {"Ammunation 5", 6, 316.524993,-167.706985,999.593750},
    {"Ammunation booths", 7, 302.292877,-143.139099,1004.062500},
    {"Ammunation range", 7, 298.507934,-141.647048,1004.054748},
    {"Budget inn motel room", 12, 444.646911,508.239044,1001.419494},
    {"Jefferson motel", 15, 2215.454833,-1147.475585,1025.796875},
    {"Off track betting shop", 3, 833.269775,10.588416,1004.179687},
    {"Sex shop", 3, -103.559165,-24.225606,1000.718750},
    {"Meat factory", 1, 963.418762,2108.292480,1011.030273},
    {"Zero's RC shop", 6, -2240.468505,137.060440,1035.414062},
    {"Catigula's basement", 1, 2169.461181,1618.798339,999.976562},
    {"Club", 17, 493.390991,-22.722799,1000.679687},
    {"Bar", 11, 501.980987,-69.150199,998.757812},
    {"Lil' probe inn", 18, -227.027999,1401.229980,27.765625},
    {"Denise room", 1, 244.411987,305.032989,999.148437},
    {"Katie room", 2, 271.884979,306.631988,999.148437},
    {"Helena room", 3, 291.282989,310.031982,999.148437},
    {"Michelle room", 4, 302.180999,300.722991,999.148437},
    {"Barbara room", 5, 322.197998,302.497985,999.148437},
    {"Millie room", 6, 346.870025,309.259033,999.155700},
    {"Sherman dam", 17, -959.564392,1848.576782,9.000000},
    {"B Dup's house", 3, 1527.229980,-11.574499,1002.097106},
    {"B Dup's crack pad", 2, 1523.509887,-47.821197,1002.130981},
    {"Cj's house", 3, 2496.049804,-1695.238159,1014.742187},
    {"Madd Doggs mansion", 5, 1267.663208,-781.323242,1091.906250},
    {"Ryders house", 2, 2454.717041,-1700.871582,1013.515197},
    {"Sweet's house", 1, 2527.654052,-1679.388305,1015.498596},
    {"Crack factory", 2, 2543.462646,-1308.379882,1026.728393},
    {"Big spread ranch", 3, 1212.019897,-28.663099,1000.953125},
    {"Strip club", 2, 1204.809936,-11.586799,1000.921875},
    {"Strip club private room", 2, 1204.809936,13.897239,1000.921875},
    {"Unnamed brothel", 3, 942.171997,-16.542755,1000.929687},
    {"Tiger skin brothel", 3, 964.106994,-53.205497,1001.124572},
    {"Pleasure domes", 3, -2640.762939,1406.682006,906.460937},
    {"Liberty city inside", 1, -794.806396,497.738037,1376.195312},
    {"Gang house", 5, 2350.339843,-1181.649902,1027.976562},
    {"Colonel Furhberger's", 8, 2807.619873,-1171.899902,1025.570312},
    {"Crack den", 5, 318.564971,1118.209960,1083.882812},
    {"Warehouse 1", 1, 1412.639892,-1.787510,1000.924377},
    {"Warehouse 2", 18, 1302.519897,-1.787510,1001.028259},
    {"Unused safe house", 12, 2324.419921,-1145.568359,1050.710083},
    {"RC Battlefield", 10, -975.975708,1060.983032,1345.671875}

};
stock HouseGetFreeSlot()
{
    for(new i = 0; i < MAX_HOUSES; i++)
    {
        if(!HCreated[i]) return i;
    }

    return -1;
}

stock GetInteriorIDFromName(intname[])
{
    for(new i = 0; i < 500; i++)
    {
        if (strfind(Interiors[i][InteriorName], intname, true) != -1)
            return Interiors[i][InteriorID];
    }
    return -1;
}

GetInteriorName(intname[])
{
    for(new i = 0;i < 47;i++)
    {
        if(strfind(Interiors[i][InteriorName], intname, true) != -1)
            return Interiors[i][InteriorName];
    }
    return -1;
}

stock HouseCreate(owner[], interiorname[], HouseInt, Float:X, Float:Y, Float:Z)
{
    new HouseID = HouseGetFreeSlot();
   
    HouseInfo[HouseID][Xpos] = X;
    HouseInfo[HouseID][Ypos] = Y;
    HouseInfo[HouseID][Zpos] = Z;
    format(HouseInfo[HouseID][Howner], 24, "%s", owner);
    HouseInfo[HouseID][Howned] = true;
    HCreated[HouseID] = true;
    HouseInfo[HouseID][HID] = CreateDynamicPickup(1273, 1, X, Y, Z, -1, -1, -1, 100.0);
    format(HouseInfo[HouseID][Interiorname], 100, "%s", GetInteriorName(interiorname));
    HouseInfo[HouseID][interior] = HouseInt;
   
    return 1;
}

CMD:chouse(playerid, params[])
{
    new owner[24], interiorName[100], intid, Float:pos[3];
    if(sscanf(params,"s[24]s[100]i",owner, interiorName, intid)) return SendClientMessage(playerid, -1, "Usage: /chouse <owner> <interior name> <interior id>");
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    HouseCreate(owner, interiorName, intid, pos[0], pos[1], pos[2]);
    return 1;
}

CMD:exithouse(playerid, params[])
{
    new HouseI = House[playerid];
    SetPlayerPos(playerid, HouseInfo[HouseI][Xpos], HouseInfo[HouseI][Ypos], HouseInfo[HouseI][Zpos]);
    return 1;
}

public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
    for(new i = 0; i < MAX_HOUSES; i++)
    {
        if(HouseInfo[i][HID] == pickupid)
        {
            SetPlayerInterior(playerid, HouseInfo[i][interior]);
            new Float:X, Float:Y, Float:Z;
            if (strfind(Interiors[i][InteriorName], HouseInfo[i][Interiorname], true) != -1)
            X = Interiors[i][InteriorX];
            Y = Interiors[i][InteriorY];
            Z = Interiors[i][InteriorZ];
            SetPlayerPos(playerid, X, Y, Z);
            new string[128];
            format(string, 128, "You have entered %s house", HouseInfo[i][Howner]);
            SendClientMessage(playerid, -1, string);
            House[playerid] = i;
            printf("Interior name: %s Interiorx %f Interiory %f Interiorz %f", HouseInfo[i][Interiorname], Interiors[i][InteriorX], Interiors[i][InteriorX]);
        }
    }
    return 1;
}
Reply
#9

You have changed nothing.
Reply
#10

SA-MP interiors IDs HERE

And for more help about interiors, HERE
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)