House system problems (need help again +REP)
#1

So I work on a multi house system but there is a problem
I got system witch allow me one line 1 house> AddHouse
and I decided to script Multi house system
The AddHouse is like this
pawn Код:
AddHouse(houseid, Float:iconX, Float:iconY, Float:iconZ, Float:interiorX, Float:interiorY, Float:interiorZ, Cost, Sell, Interior, virtualworld)
its working fine .
I added
this as a safe house anyone can enter it without rent or pay
pawn Код:
AddSafeHouse(shouseid, Float:siconX, Float:siconY, Float:siconZ, Float:sinteriorX, Float:sinteriorY, Float:sinteriorZ, sInteriora, svirtualworld)
here is whole code
pawn Код:
AddSafeHouse(shouseid, Float:siconX, Float:siconY, Float:siconZ, Float:sinteriorX, Float:sinteriorY, Float:sinteriorZ, sInteriora, svirtualworld)
{
    new shouse[256];
    format(shouse, sizeof(shouse), "Houses/houseid%d",shouseid);
    if(!dini_Exists(shouse))
    {
        dini_Create(shouse);
        shInfo[shouseid][sInterior] = sInteriora;
        dini_IntSet(shouse, "sInterior", sInteriora);
        dini_IntSet(shouse, "sVirtualworld", svirtualworld);
        shInfo[shouseid][sVirtualworld] = svirtualworld;
        shInfo[shouseid][sInteriorX] = sinteriorX;
        shInfo[shouseid][sInteriorY] = sinteriorY;
        shInfo[shouseid][sInteriorZ] = sinteriorZ;
        dini_FloatSet(shouse, "X", sinteriorX);
        dini_FloatSet(shouse, "Y", sinteriorY);
        dini_FloatSet(shouse, "Z", sinteriorZ);
        print("-");
        print("--------------House Created--------------");
        printf("- Safe Houseid: %d", shouseid);
        printf("- Safe Interior: %d", sInteriora);
        printf("- Safe VirtualWorld: %d", svirtualworld);
        print("-----------------------------------------");
        print("-");
    }
    else
    {
        shInfo[shouseid][sInterior] = dini_Int(shouse, "sInterior");
        shInfo[shouseid][sInteriorX] = dini_Float(shouse, "sX");
        shInfo[shouseid][sInteriorY] = dini_Float(shouse, "sY");
        shInfo[shouseid][sInteriorZ] = dini_Float(shouse, "sZ");
        shInfo[shouseid][sVirtualworld] = dini_Int(shouse, "sVirtualworld");
    }
    shInfo[shouseid][siconx]=siconX;
    shInfo[shouseid][sicony]=siconY;
    shInfo[shouseid][siconz]=siconZ;
    format(shouse, sizeof(shouse), "Houses/houseid%d",shouseid);
    SafeHousePickup[shouseid] = CreatePickup(1272,23, siconX, siconY, siconZ);//bought
}
Enums & other stuff
pawn Код:
////////////////////////////
//Safe House
#define MAX_DISTANCE_TO_SAFE 1.5
#define MAX_SAFEHOUSES 250
new SafeHousePickup[MAX_SAFEHOUSES];
new splayerinterior[MAX_PLAYERS]=-1;
new Float:shousex, Float:shousey, Float:shousez;
new splayerworld[MAX_PLAYERS];
///////////////////////////
/*Safe enums*/
enum SafeHouseInfo
{
    sInterior,
    sVirtualworld,
    Float:sInteriorX,
    Float:sInteriorY,
    Float:sInteriorZ,
    Float:siconx,
    Float:sicony,
    Float:siconz
}
new shInfo[MAX_SAFEHOUSES][SafeHouseInfo]; //shInfo
here is enter/exit command
pawn Код:
dcmd_entersafe(playerid,params[])
{
    #pragma unused params
    new str1[255],pname[24],shousenumber;
    shousenumber = GetHouseID(playerid);
    GetPlayerPos(playerid, shousex, shousey, shousez);
    format(str1, sizeof(str1), "Houses/houseid%d", shousenumber);
    GetPlayerName(playerid, pname, 24);
    splayerworld[playerid] = GetPlayerVirtualWorld(playerid);
    SendClientMessage(playerid, c_y, "You entered the Safe house!");
    SetPlayerVirtualWorld(playerid, shInfo[shousenumber][sVirtualworld]);
    SetPlayerInterior(playerid, shInfo[shousenumber][sInterior]);
    SetPlayerPos(playerid, shInfo[shousenumber][sInteriorX], shInfo[shousenumber][sInteriorY], shInfo[shousenumber][sInteriorZ]);
    splayerinterior[playerid] = shInfo[shousenumber][sInterior];
    return 1;
}

dcmd_exitsafe(playerid,params[])
{
    #pragma unused params

    if(GetPlayerInterior(playerid)==splayerinterior[playerid])
    {
        SetPlayerPos(playerid, shousex, shousey, shousez);
        SetPlayerInterior(playerid, splayerworld[playerid]);
    }
    else
    {
        SendClientMessage(playerid, c_r, "You have not entered a house!");
    }
    return 1;
}
how can I fix the enter cmd ?
the script complie good but when I come in point it wont work .. the cmd /entersafe
here is normal Enter/exit cmd
pawn Код:
dcmd_enter(playerid,params[])
{
    #pragma unused params
    new str1[255],pname[24],housenumber;
    housenumber = GetHouseID(playerid);
    GetPlayerPos(playerid, housex, housey, housez);
    format(str1, sizeof(str1), "Houses/houseid%d", housenumber);
    GetPlayerName(playerid, pname, 24);
    playerworld[playerid] = GetPlayerVirtualWorld(playerid);
    SendClientMessage(playerid, c_y, "You entered the house!");
    SetPlayerVirtualWorld(playerid, hInfo[housenumber][Virtualworld]);
    SetPlayerInterior(playerid, hInfo[housenumber][Interior]);
    SetPlayerPos(playerid, hInfo[housenumber][InteriorX], hInfo[housenumber][InteriorY], hInfo[housenumber][InteriorZ]);
    playerinterior[playerid] = hInfo[housenumber][Interior];
    return 1;
}

dcmd_exit(playerid,params[])
{
    #pragma unused params

    if(GetPlayerInterior(playerid)==playerinterior[playerid])
    {
        SetPlayerPos(playerid, housex, housey, housez);
        SetPlayerInterior(playerid, playerworld[playerid]);
    }
    else
    {
        SendClientMessage(playerid, c_r, "You have not entered a house!");
    }
    return 1;
}
Sorry for bad English
if you need anything more about the system tell me I really need fix it fsat cuz server open is tomorrow
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)