Liebe Community,
Ich habe das Problem, wenn ich in ein Haus rein gehe, und wieder raus will spawne ich nicht vor dem Haus wo ich rein gegangen bin.
Hier sind ein paar Scriptings, vielleicht können diese weiterhelfen.
new HouseInfo[35][hInfo];
enum hInfo
{
Float:hEntrancex,
Float:hEntrancey,
Float:hEntrancez,
Float:hExitx,
Float:hExity,
Float:hExitz,
hHealthx,
hHealthy,
hHealthz,
hArmourx,
hArmoury,
hArmourz,
hOwner[MAX_PLAYER_NAME],
hDiscription[MAX_PLAYER_NAME],
hValue,
hHel,
hArm,
hInt,
hLock,
hOwned,
hRooms,
hRent,
hRentabil,
hTakings,
hVec,
hVcol1,
hVcol2,
hDate,
hLevel,
Text3D:Text,
};
Unter SetPlayerSpawn
if(house !=255)
{
if(SpawnChange[playerid]) //If 1, then you get to your house, else spawn somewhere else
{
SetPlayerColor(playerid, COLOR_ZIVI);
SetPlayerInterior(playerid,HouseInfo[house][hInt]);
SetPlayerPos(playerid, HouseInfo[house][hExitx], HouseInfo[house][hExity],HouseInfo[house][hExitz]); // Warp the player
PlayerInfo[playerid][pLocal] = house;
PlayerInfo[playerid][pInt] = HouseInfo[house][hInt];
return 1;
}
}
public LoadProperty()
{
new arrCoords[29][64];
new strFromFile2[256];
new File: file = fopen("property.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(HouseInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
HouseInfo[idx][hEntrancex] = floatstr(arrCoords[0]);
HouseInfo[idx][hEntrancey] = floatstr(arrCoords[1]);
HouseInfo[idx][hEntrancez] = floatstr(arrCoords[2]);
HouseInfo[idx][hExitx] = floatstr(arrCoords[3]);
HouseInfo[idx][hExity] = floatstr(arrCoords[4]);
HouseInfo[idx][hExitz] = floatstr(arrCoords[5]);
HouseInfo[idx][hHealthx] = strval(arrCoords[6]);
HouseInfo[idx][hHealthy] = strval(arrCoords[7]);
HouseInfo[idx][hHealthz] = strval(arrCoords[8]);
HouseInfo[idx][hArmourx] = strval(arrCoords[9]);
HouseInfo[idx][hArmoury] = strval(arrCoords[10]);
HouseInfo[idx][hArmourz] = strval(arrCoords[11]);
//printf("HouseInfo hEntrancez %f",HouseInfo[idx][hEntrancez]);
strmid(HouseInfo[idx][hOwner], arrCoords[12], 0, strlen(arrCoords[12]), 255);
strmid(HouseInfo[idx][hDiscription], arrCoords[13], 0, strlen(arrCoords[13]), 255);
HouseInfo[idx][hValue] = strval(arrCoords[14]);
HouseInfo[idx][hHel] = strval(arrCoords[15]);
HouseInfo[idx][hArm] = strval(arrCoords[16]);
HouseInfo[idx][hInt] = strval(arrCoords[17]);
HouseInfo[idx][hLock] = strval(arrCoords[18]);
HouseInfo[idx][hOwned] = strval(arrCoords[19]);
HouseInfo[idx][hRooms] = strval(arrCoords[20]);
HouseInfo[idx][hRent] = strval(arrCoords[21]);
HouseInfo[idx][hRentabil] = strval(arrCoords[22]);
HouseInfo[idx][hTakings] = strval(arrCoords[23]);
HouseInfo[idx][hVec] = strval(arrCoords[24]);
if(HouseInfo[idx][hVec] == 457)
{
HouseInfo[idx][hVec] = 411;
}
HouseInfo[idx][hVcol1] = strval(arrCoords[25]);
HouseInfo[idx][hVcol2] = strval(arrCoords[26]);
HouseInfo[idx][hDate] = strval(arrCoords[27]);
HouseInfo[idx][hLevel] = strval(arrCoords[28]);
printf("HouseInfo:%d Owner:%s hTakings %d hVec %d",idx,HouseInfo[idx][hOwner],HouseInfo[idx][hTakings],HouseInfo[idx][hVec]);
idx++;
}
fclose(file);
}
return 1;
}
Unter OnGameModeInit
for(new h = 0; h < sizeof(HouseInfo); h++)
{
new string2[128];
if(HouseInfo[h][hOwned] == 0)
{
format(string2, sizeof(string2), "[Haus zu verkaufen - %s]\nPreis: $%d\nLevel: %d\n/buyhouse zum kaufen",HouseInfo[h][hDiscription],HouseInfo[h][hValue],HouseInfo[h][hLevel]);
HouseInfo[h][Text] = Create3DTextLabel(string2,COLOR_GRAD1,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15.0,0);
AddStaticPickup(1273, 1, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 0);
pickups++;
}
if(HouseInfo[h][hOwned] == 1 && HouseInfo[h][hRentabil] == 0)
{
format(string2, sizeof(string2), "[Haus]\nBesitzer: %s\nLevel: %d",HouseInfo[h][hOwner],HouseInfo[h][hLevel]);
HouseInfo[h][Text] = Create3DTextLabel(string2,COLOR_GRAD1,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15.0,0);
AddStaticPickup(1239, 1, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 0);
pickups++;
}
if(HouseInfo[h][hOwned] == 1 && HouseInfo[h][hRentabil] >= 1)
{
format(string2, sizeof(string2), "[Haus]\nBesitzer: %s\nLevel: %d\nMiete: $%d\nEinmieten mit /rentroom",HouseInfo[h][hOwner],HouseInfo[h][hLevel],HouseInfo[h][hRent]);
HouseInfo[h][Text] = Create3DTextLabel(string2,COLOR_GRAD1,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15.0,0);
AddStaticPickup(1239, 1, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 0);
pickups++;
}
}
public DateProp(playerid)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new curdate = getdate();
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if (strcmp(playername, HouseInfo[h][hOwner], true) == 0)
{
HouseInfo[h][hDate] = curdate;
OnPropUpdate();
}
}
return 1;
}
public Checkprop()
{
new olddate;
new string[256];
new curdate = getdate();
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(HouseInfo[h][hOwned] == 1 && HouseInfo[h][hDate] > 9)
{
olddate = HouseInfo[h][hDate];
if(curdate-olddate >= 5)
{
HouseInfo[h][hHel] = 0;
HouseInfo[h][hArm] = 0;
HouseInfo[h][hHealthx] = 0;
HouseInfo[h][hHealthy] = 0;
HouseInfo[h][hHealthz] = 0;
HouseInfo[h][hArmourx] = 0;
HouseInfo[h][hArmoury] = 0;
HouseInfo[h][hArmourz] = 0;
HouseInfo[h][hLock] = 1;
HouseInfo[h][hOwned] = 0;
//HouseInfo[h][hVec] = 418;
HouseInfo[h][hVcol1] = -1;
HouseInfo[h][hVcol2] = -1;
strmid(HouseInfo[h][hOwner], "Der Staat", 0, strlen("Der Staat"), 255);
format(string, sizeof(string), "REAL ESTATE: Ein Haus ist verfügbar: $%d",HouseInfo[h][hValue]);
SendClientMessageToAll(TEAM_BALLAS_COLOR, string);
OnPropUpdate();
}
}
}
return 1;
}
public OnPropUpdate()
{
new idx;
new File: file2;
while (idx < sizeof(HouseInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%f,%f,%f,%f,%f,%f,%d,%d,%d,%d,%d,%d,%s,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
HouseInfo[idx][hEntrancex],
HouseInfo[idx][hEntrancey],
HouseInfo[idx][hEntrancez],
HouseInfo[idx][hExitx],
HouseInfo[idx][hExity],
HouseInfo[idx][hExitz],
HouseInfo[idx][hHealthx],
HouseInfo[idx][hHealthy],
HouseInfo[idx][hHealthz],
HouseInfo[idx][hArmourx],
HouseInfo[idx][hArmoury],
HouseInfo[idx][hArmourz],
HouseInfo[idx][hOwner],
HouseInfo[idx][hDiscription],
HouseInfo[idx][hValue],
HouseInfo[idx][hHel],
HouseInfo[idx][hArm],
HouseInfo[idx][hInt],
HouseInfo[idx][hLock],
HouseInfo[idx][hOwned],
HouseInfo[idx][hRooms],
HouseInfo[idx][hRent],
HouseInfo[idx][hRentabil],
HouseInfo[idx][hTakings],
HouseInfo[idx][hVec],
HouseInfo[idx][hVcol1],
HouseInfo[idx][hVcol2],
HouseInfo[idx][hDate],
HouseInfo[idx][hLevel]);
if(idx == 0)
{
file2 = fopen("property.cfg", io_write);
}
else
{
file2 = fopen("property.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
idx = 0;
while (idx < sizeof(BizzInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%s|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
BizzInfo[idx][bOwned],
BizzInfo[idx][bOwner],
BizzInfo[idx][bMessage],
BizzInfo[idx][bExtortion],
BizzInfo[idx][bEntranceX],
BizzInfo[idx][bEntranceY],
BizzInfo[idx][bEntranceZ],
BizzInfo[idx][bExitX],
BizzInfo[idx][bExitY],
BizzInfo[idx][bExitZ],
BizzInfo[idx][bLevelNeeded],
BizzInfo[idx][bBuyPrice],
BizzInfo[idx][bEntranceCost],
BizzInfo[idx][bTill],
BizzInfo[idx][bLocked],
BizzInfo[idx][bInterior],
BizzInfo[idx][bProducts],
BizzInfo[idx][bMaxProducts],
BizzInfo[idx][bPriceProd]);
if(idx == 0)
{
file2 = fopen("bizz.cfg", io_write);
}
else
{
file2 = fopen("bizz.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
idx = 0;
while (idx < sizeof(SBizzInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%s|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
SBizzInfo[idx][sbOwned],
SBizzInfo[idx][sbOwner],
SBizzInfo[idx][sbMessage],
SBizzInfo[idx][sbExtortion],
SBizzInfo[idx][sbEntranceX],
SBizzInfo[idx][sbEntranceY],
SBizzInfo[idx][sbEntranceZ],
SBizzInfo[idx][sbLevelNeeded],
SBizzInfo[idx][sbBuyPrice],
SBizzInfo[idx][sbEntranceCost],
SBizzInfo[idx][sbTill],
SBizzInfo[idx][sbLocked],
SBizzInfo[idx][sbInterior],
SBizzInfo[idx][sbProducts],
SBizzInfo[idx][sbMaxProducts],
SBizzInfo[idx][sbPriceProd]);
if(idx == 0)
{
file2 = fopen("sbizz.cfg", io_write);
}
else
{
file2 = fopen("sbizz.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
if(strcmp(cmd, "/buyhouse", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(IsPlayerInRangeOfPoint(playerid,2.0, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 0)
{
if(PlayerInfo[playerid][pOwnPerso] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Du benötigst einen Personalausweis !");
return 1;
}
if(PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
{
format(string, sizeof(string), " Du must mindestens Level %d um es zu kaufen !", HouseInfo[h][hLevel]);
SendClientMessage(playerid, COLOR_GRAD5, string);
return 1;
}
if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Dir gehört bereits ein Haus, gib /hc ein und verkaufe es!");
return 1;
}
if(GetPlayerMoney(playerid) > HouseInfo[h][hValue])
{
PlayerInfo[playerid][pPhousekey] = h;
HouseInfo[h][hOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
new string2[128];
format(string2, sizeof(string2), "[Haus]\nBesitzer: %s\nLevel: %d",HouseInfo[h][hOwner],HouseInfo[h][hLevel]);
Update3DTextLabelText(HouseInfo[h][Text],COLOR_GRAD1,string2);
HouseInfo[h][hRentabil] = 0;
GivePlayerMoney(playerid,-HouseInfo[h][hValue]);
PlayerPlayMusic(playerid);
SetPlayerInterior(playerid,HouseInfo[h][hInt]);
SetPlayerPos(playerid,HouseInfo[h][hExitx],HouseInfo[h][hExity],HouseInfo[h][hExitz]);
GameTextForPlayer(playerid, "~w~Willkommen zu Hause~n~Du kannst das Haus an deiner Haustür mit der Enter-Taste verlassen.", 5000, 3);
PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
PlayerInfo[playerid][pLocal] = h;
SendClientMessage(playerid, COLOR_WHITE, "Gratulation zu deinem neuen Haus !");
SendClientMessage(playerid, COLOR_WHITE, "Gib /help um Hilfe zu bekommen !");
DateProp(playerid);
OnPropUpdate();
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Du hast nicht genug Geld!");
return 1;
}
}
}
}
return 1;
}
if(strcmp(cmd, "/rentroom", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(IsPlayerInRangeOfPoint(playerid,2.0, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 1 && HouseInfo[h][hRentabil] == 1)
{
if(PlayerInfo[playerid][pOwnPerso] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Du benötigst einen Personalausweis");
return 1;
}
if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, " Die gehört bereits ein Haus, gib /hc ein und verkaufe es!");
return 1;
}
if(GetPlayerMoney(playerid) > HouseInfo[h][hRent])
{
PlayerInfo[playerid][pPhousekey] = h;
GivePlayerMoney(playerid,-HouseInfo[h][hRent]);
HouseInfo[h][hTakings] = HouseInfo[h][hTakings]+HouseInfo[h][hRent];
PlayerPlayMusic(playerid);
SetPlayerInterior(playerid,HouseInfo[h][hInt]);
SetPlayerPos(playerid,HouseInfo[h][hExitx],HouseInfo[h][hExity],HouseInfo[h][hExitz]);
GameTextForPlayer(playerid, "~w~Willkommen Zuhause~n~Du kannst dsa Haus mit /exit verlassen.", 5000, 3);
PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
PlayerInfo[playerid][pLocal] = h;
SendClientMessage(playerid, COLOR_WHITE, "Herzlichen Glückwunsch mit deinem Haus!");
SendClientMessage(playerid, COLOR_WHITE, "Tippe /help um die neuen Befehle zu sehen!");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, " Du hast nicht genug Geld !");
return 1;
}
}
}
}
Ich hoffe, ich habe das wichtigste eingefügt, was auch vlt. nützlich sein könnte.
Ich habe leider keine Ahnung wodran es liegt, ich hoffe ihr könnt helfen.
Mit freundlichen Grüßen,
James.