So sieht mein createhaus aus derzeit
PHP
else if (strcmp("/hcreate", cmdtext, true, 8) == 0 || strcmp(cmd, "/hauserstellen", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] > 1340)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "Verwendung : /hcreate [Aktion]");
SendClientMessage(playerid, COLOR_GREY, "Verfügbare Aktionen:");
SendClientMessage(playerid, COLOR_GREY, "- newh, - spawna, - showint, - useint, - carspawn, - preis, - level - save");
return 1;
}
if(strcmp(tmp, "newh", true) == 0)
{
PlayerInfo[playerid][pCreateH] = Houses_Index;
format(string, sizeof(string), "Du bearbeitest nun Haus %d", Houses_Index);
SendClientMessage(playerid, COLOR_GRAD2, string);
HouseInfo[Houses_Index][hHel] = 0;
HouseInfo[Houses_Index][hArm] = 0;
HouseInfo[Houses_Index][hHealthx] = 0;
HouseInfo[Houses_Index][hHealthy] = 0;
HouseInfo[Houses_Index][hHealthz] = 0;
HouseInfo[Houses_Index][hArmourx] = 0;
HouseInfo[Houses_Index][hArmoury] = 0;
HouseInfo[Houses_Index][hArmourz] = 0;
HouseInfo[Houses_Index][hLock] = 1;
HouseInfo[Houses_Index][hOwned] = 0;
HouseInfo[Houses_Index][hVec] = 589;
HouseInfo[Houses_Index][hVcol1] = -1;
HouseInfo[Houses_Index][hVcol2] = -1;
HouseInfo[Houses_Index][hRentabil] = 0;
Houses_Index++;
return 1;
}
if(strcmp(tmp, "spawna", true) == 0)
{
new Float:x88,Float:y88,Float:z88;
GetPlayerPos(playerid, x88,y88,z88);
HouseInfo[PlayerInfo[playerid][pCreateH]][hEntrancex] = x88;
HouseInfo[PlayerInfo[playerid][pCreateH]][hEntrancey] = y88;
HouseInfo[PlayerInfo[playerid][pCreateH]][hEntrancez] = z88;
format(string, sizeof(string), "H%d:Spawn-Außen %f/%f/%f",PlayerInfo[playerid][pCreateH], x88,y88,z88);
SendClientMessage(playerid, COLOR_GRAD2, string);
CreatePickup(1273, 1, x88, y88, z88);
}
if(strcmp(tmp, "showint", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "Verwendung : /hcreate showint [ID]");
return 1;
}
new in = strval(tmp);
if(in < 0 || (in < 10 && in > 7) || in > 20)
{
SendClientMessage(playerid, COLOR_GREY, "Kleine Wohnung: 0-7, Große Häuser 10-20");
return 1;
}
SetPlayerInterior(playerid, HouseInt_Interior[in]);
SetPlayerPos(playerid, HouseInt_Spawn_X[in],HouseInt_Spawn_Y[in],HouseInt_Spawn_Z[in]);
format(string, sizeof(string), "Innenraum %d", in);
SendClientMessage(playerid, COLOR_GRAD2, string);
}
if(strcmp(tmp, "useint", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "Verwendung : /hcreate useint [ID]");
return 1;
}
new in = strval(tmp);
if(in < 0 || (in < 10 && in > 7) || in > 20)
{
SendClientMessage(playerid, COLOR_GREY, "Kleine Wohnung: 0-7, Große Häuser 10-20");
return 1;
}
format(string, sizeof(string), "H%d:Innenraum %d wird verwendet.",PlayerInfo[playerid][pCreateH], in);
SendClientMessage(playerid, COLOR_GRAD2, string);
HouseInfo[PlayerInfo[playerid][pCreateH]][hInteriorID] = in;
}
if(strcmp(tmp, "preis", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "Verwendung : /hcreate preis [Preis] >");
return 1;
}
new in = strval(tmp);
format(string, sizeof(string), "H%d kostet jetzt: %d",PlayerInfo[playerid][pCreateH], in);
SendClientMessage(playerid, COLOR_GRAD2, string);
HouseInfo[PlayerInfo[playerid][pCreateH]][hValue] = in;
}
if(strcmp(tmp, "level", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "Verwendung : /hcreate level [Level] >");
return 1;
}
new in = strval(tmp);
format(string, sizeof(string), "H%d benötigt jetzt: Level %d",PlayerInfo[playerid][pCreateH], in);
SendClientMessage(playerid, COLOR_GRAD2, string);
HouseInfo[PlayerInfo[playerid][pCreateH]][hLevel] = in;
}
if(strcmp(tmp, "carspawn", true) == 0)
{
new Float:x88,Float:y88,Float:z88,Float:Rot88;
GetPlayerPos(playerid, x88,y88,z88);
GetVehicleZAngle(GetPlayerVehicleID(playerid), Rot88);
HouseInfo[PlayerInfo[playerid][pCreateH]][hCarSpawnX] = x88;
HouseInfo[PlayerInfo[playerid][pCreateH]][hCarSpawnY] = y88;
HouseInfo[PlayerInfo[playerid][pCreateH]][hCarSpawnZ] = z88;
HouseInfo[PlayerInfo[playerid][pCreateH]][hCarSpawnRot] = Rot88;
format(string, sizeof(string), "H%d:Car-Spawn-Außen %f/%f/%f/%f",PlayerInfo[playerid][pCreateH], x88,y88,z88,Rot88);
SendClientMessage(playerid, COLOR_GRAD2, string);
}
if(strcmp(tmp, "save", true) == 0)
{
SaveStuff();
OnPropUpdate();
SendClientMessage(playerid, COLOR_GRAD2, "Alle Häuser wurden gespeichert");
}
}
}
return 1;
}
Alles anzeigen
so mein buyhouse
PHP
if(strcmp("/buyhouse", cmd, 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(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 0)
{
if(PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
{
format(string, sizeof(string), " Du musst Level %d sein um dieses Haus kaufen zu können!", HouseInfo[h][hLevel]);
SendClientMessage(playerid, COLOR_ERRORTEXT, string);
return 1;
}
if(PlayerInfo[playerid][pPhousekey] != -1 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Du besitzt bereits ein Haus, benutze /sellhouse um es zu verkaufen!");
return 1;
}
if(PlayerInfo[playerid][pPhotelkey] != -1)
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Du bist noch in einem Hotel angemeldet, benutze /abmelden.");
return 1;
}
if(PlayerInfo[playerid][pCash] > HouseInfo[h][hPreis])
{
PlayerInfo[playerid][pPhousekey] = h;
HouseInfo[h][hOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
if(PlayerInfo[playerid][pKreditkarte] == 1 && PlayerInfo[playerid][pKreditkartebenutzen] == 1)
{
PlayerInfo[playerid][pBank] -= HouseInfo[h][hPreis];
SendClientMessage(playerid,COLOR_YELLOW,"Du hast erfolgreich mit deiner Kreditkarte bezahlt, der Betrag wurde von deinem Konto abgebucht.");
}
else
{
GivePlayerMoneys(playerid, - HouseInfo[h][hPreis]);
}
StuffInfo[sSteuerkasse] += HouseInfo[h][hPreis];
PlayerPlayMusic(playerid);
SetPlayerInterior(playerid,HouseInfo[h][hInt]);
HouseInfo[h][hKasse] = 0;
SetPlayerPos(playerid,HouseInfo[h][hExitx],HouseInfo[h][hExity],HouseInfo[h][hExitz]);
new h2 = h + 300;
SetPlayerVirtualWorld(playerid,h2);
GameTextForPlayer(playerid, "~w~Willkommen Zuhause~n~Du kannst dein Haus jederzeit mit /exit verlassen", 5000, 3);
PlayerInfo[playerid][pLocal] = h+300;
SendClientMessage(playerid, COLOR_WHITE, "Gratulation, du bist nun in deinem Haus!");
SendClientMessage(playerid, COLOR_WHITE, "Benutze /help um die neuen Befehle zu sehen.");
DateProp(playerid);
Update3DTextHouse(h);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Du hast nicht genug Geld um dir das Haus kaufen zu können !");
return 1;
}
}
}
}
return 1;
}
Alles anzeigen
Aber der hauserstellen funktioniert nicht richtig bzw man kann nur eines erstellen ...^^