PARTNERI:
-UPOZORENJE-

Samo registrovani članovi mogu da vide/koriste forum u celini.
Prijavite se ili registrujte nalog na Balkan SA-MP forumu.


Autor Tema: [Pomoć] Enter/Exit house  (Pročitano 48 puta)

0 članova i 1 gost pregledaju ovu temu.

Van mreže ElkaIsBack

Enter/Exit house
« poslato: Jul 28, 2019, 12:26:09 posle podne »
SKripta koju koristim : moj mod od 0
Opis problema : dakle pravim house system i dosao sam do dijela gdje igrac na ENTER ili F ulaz/izlazi iz kuce, i sve normalno radi kad kucu tek kreiram,a li kad restartujem server i udjem u tu istu kucu, kad pokusam da izadjem teleporta me u selo.
Dio skripte : posto nisam siguran da li je problem do OnPlayerKeyStateChange ( jer sve normalno radi kad tek kreiram kucu ) ili do ucitavanja, evo vam oba dijela skripte
hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new string[256];
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
new vw = GetPlayerVirtualWorld(playerid);
new houseid = GetNearbyHouse(playerid);
    if(newkeys == KEY_SECONDARY_ATTACK)
    {
        if(GetPlayerInterior(playerid) == 0)
        {
SetPlayerPos(playerid, HouseInfo[houseid][hIposX], HouseInfo[houseid][hIposY], HouseInfo[houseid][hIposZ]);
SetPlayerInterior(playerid, HouseInfo[houseid][hInt]);
SetPlayerVirtualWorld(playerid, HouseInfo[houseid][hVW]);
if(PlayerInfo[playerid][pKuca1] == houseid || PlayerInfo[playerid][pKuca2] == houseid || PlayerInfo[playerid][pKuca3] == houseid )
{
format(string, sizeof(string), "{FFAA80}[RG] {FFFFFF}%s{FFDDCC}, usli ste u svoju kucu.", PlayerName);
SendClientMessage(playerid, 0xFFFFFFFF, string);
}
else
{
format(string, sizeof(string), "{FFAA80}[RG] {FFFFFF}%s{FFDDCC}, usli ste u kucu. Vlasnik ove kuce je {FFFFFF}%s{FFDDCC}.", PlayerName, HouseInfo[houseid][hVlasnik]);
SendClientMessage(playerid, 0xFFFFFFFF, string);
}
}
else
  {
    SetPlayerPos(playerid, HouseInfo[vw][hUposX], HouseInfo[vw][hUposY], HouseInfo[vw][hUposZ]);
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid, 0);
    if(PlayerInfo[playerid][pKuca1] == vw || PlayerInfo[playerid][pKuca2] == vw || PlayerInfo[playerid][pKuca3] == vw )
    {
      format(string, sizeof(string), "{FFAA80}[RG] {FFFFFF}%s{FFDDCC}, izasli ste iz svoje kuce.", PlayerName);
        SendClientMessage(playerid, 0xFFFFFFFF, string);
    }
    else
{
format(string, sizeof(string), "{FFAA80}[RG] {FFFFFF}%s{FFDDCC}, izasli ste iz kuce. Vlasnik ove kuce je {FFFFFF}%s{FFDDCC}.", PlayerName, HouseInfo[vw][hVlasnik]);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
}
    }
    }
    return 1;
}

hook OnGameModeInit()
{
new count = 0;
for( new i = 1; i < MAX_HOUSES; i++ )
    {
    new File[128], string[512];
    format( File, sizeof(File), "Houses/%d.ini", i);
    if(fexist(File))
    {
        count++;
    INI_ParseFile(File, "LoadHouse", .bExtra = true, .extra = i);
//     printf("House %d Loaded | %f %f %f", i, HouseInfo[i][hUposX], HouseInfo[i][hUposY], HouseInfo[i][hUposZ]);
    if(HouseInfo[i][hProdata] == 1)
    {
        if(HouseInfo[i][hZakljucana] == 1)
        {
        format(string, sizeof(string), "Royalgaming House\n{FFAA80}--------------------------------\nVlasnik : {FFFFFF}%s\n{FFAA80}ID : {FFFFFF}%d\n{FFAA80}Cijena : {FFFFFF}%d{99FF99}$\n{FFAA80}Tip : {FFFFFF}%s\n{FF3333}ZAKLJUCANA\n{FFAA80}--------------------------------\n{FFFFFF}Pritisni 'Enter' da udjes", HouseInfo[i][hVlasnik], HouseInfo[i][hID], HouseInfo[i][hCijena], houseTypeName[HouseInfo[i][hTip]-1][0]);
}
else
{
format(string, sizeof(string), "Royalgaming House\n{FFAA80}--------------------------------\nVlasnik : {FFFFFF}%s\n{FFAA80}ID : {FFFFFF}%d\n{FFAA80}Cijena : {FFFFFF}%d{99FF99}$\n{FFAA80}Tip : {FFFFFF}%s\n{66FF66}OTKLJUCANA\n{FFAA80}--------------------------------\n{FFFFFF}Pritisni 'Enter' da udjes", HouseInfo[i][hVlasnik], HouseInfo[i][hID], HouseInfo[i][hCijena], houseTypeName[HouseInfo[i][hTip]-1][0]);
}
}
else
{
    format(string, sizeof(string), "Royalgaming House\n{FFAA80}--------------------------------\nVlasnik : {FFFFFF}%s\n{FFAA80}ID : {FFFFFF}%d\n{FFAA80}Cijena : {FFFFFF}%d{99FF99}$\n{FFAA80}Tip : {FFFFFF}%s\n{FF3333}ZAKLJUCANA\n{FFAA80}--------------------------------\n{FFFFFF}/buyhouse da kupis kucu", HouseInfo[i][hVlasnik], HouseInfo[i][hID], HouseInfo[i][hCijena], houseTypeName[HouseInfo[i][hTip]-1][0]);
}
HouseInfo[i][hLabel] = Create3DTextLabel(string, -1, HouseInfo[i][hUposX], HouseInfo[i][hUposY], HouseInfo[i][hUposZ], 50.0, 0, 0);
            HouseInfo[i][hPickup] = CreatePickup(HouseInfo[i][hPickupID], 1, HouseInfo[i][hUposX], HouseInfo[i][hUposY], HouseInfo[i][hUposZ], 0);
}
}
printf("\n[House-System] Radi!");
printf("[House] Broj ucitanih kuca %d.\n", count);
DisableInteriorEnterExits();
return 0;
}

Slika/Video : ako treba mogu postavit.
Hvala unaprijed  :)
Alen Hadzimustafic
 

Van mreže ElkaIsBack

Odg: Enter/Exit house
« Odgovor #1 poslato: Jul 28, 2019, 12:40:32 posle podne »
Rijesio, moze lock!  :D
Alen Hadzimustafic