Ich habe 9 Geschäfte, so muss ich auch 9 Interiors hinzufügen
enum bizinteriors{
Name[35],
Interior,
Welt,
Biztype,
Float:IX,Float:IY,Float:IZ// Exit Position
}
stock const BizInts[][bizinteriors]={
{"24/7",18,1,1,/*InteriorPos*/-31.0002,-91.6301,1003.5469},
{"dummy",0,0,0,/*InteriorPos*/0.0,0.0,0.0},
{"dummy",0,0,0,/*InteriorPos*/0.0,0.0,0.0},
{"dummy",0,0,0,/*InteriorPos*/0.0,0.0,0.0},
{"dummy",0,0,0,/*InteriorPos*/0.0,0.0,0.0},
{"dummy",0,0,0,/*InteriorPos*/0.0,0.0,0.0},
{"dummy",0,0,0,/*InteriorPos*/0.0,0.0,0.0},
{"dummy",0,0,0,/*InteriorPos*/0.0,0.0,0.0},
{"dummy",0,0,0,/*InteriorPos*/0.0,0.0,0.0}
};
Alles anzeigen
enum buildungs{
Name[35],
Interior,
Welt,
Float:EX,Float:EY,Float:EZ,// Enter Position
EInterior,
EWelt,
Float:IX,Float:IY,Float:IZ,// Exit Position
EBuilding,
IsInteriorClosed
}
stock const Building[][buildungs]={
{"Stadthalle",3,0,/*Eingang*/0,0,0,/*Ausgang*/0,0,0,0,0,-1},
{"Stadthalle",3,0,/*Eingang*/0,0,0,/*Ausgang*/0,0,0,0,0,-1},
{"Stadthalle",3,0,/*Eingang*/0,0,0,/*Ausgang*/0,0,0,0,0,-1},
{"Stadthalle",3,0,/*Eingang*/0,0,0,/*Ausgang*/0,0,0,0,0,-1},
{"Stadthalle",3,0,/*Eingang*/0,0,0,/*Ausgang*/0,0,0,0,0,-1},
{"Stadthalle",3,0,/*Eingang*/0,0,0,/*Ausgang*/0,0,0,0,0,-1}
};
Alles anzeigen
if(!IsPlayerInAnyVehicle(playerid) && (newkeys & KEY_SECONDARY_ATTACK))// Enter
{
// Öffentliche Gebäude
new Float:e_dist = 3.0, Float:i_dist = 3.0, Float:tmp, e_id = -1, i_id = -1;
print("1");
for(new i; i<sizeof(Building); i++)
{
print("2");
tmp = GetPlayerDistanceFromPoint(playerid, Building[i][EX],Building[i][EY],Building[i][EZ]);
if(tmp < e_dist)
{
e_dist = tmp;
e_id = i;
}
tmp = GetPlayerDistanceFromPoint(playerid, Building[i][IX],Building[i][IY],Building[i][IZ]);
if(tmp < i_dist)
{
i_dist = tmp;
i_id = i;
}
}
if(e_dist < i_dist)
{
print("3");
if(Building[e_id][IsInteriorClosed] == 1) return SendClientMessage(playerid, -1, "{bc4343}Die Tür ist verschlossen und kann nicht geöffnet werden.");
SetPlayerPos(playerid,Building[e_id][IX],Building[e_id][IY],Building[e_id][IZ]);
SetPlayerInterior(playerid,Building[e_id][Interior]);
SetPlayerVirtualWorld(playerid,Building[e_id][Welt]);
SetPVarInt(playerid,"InBuilding", e_id);
}
else
{
print("4");
SetPlayerPos(playerid,Building[i_id][EX],Building[i_id][EY],Building[i_id][EZ]);
SetPlayerInterior(playerid,Building[i_id][EInterior]);
SetPlayerVirtualWorld(playerid,Building[i_id][EWelt]);
SetPVarInt(playerid,"InBuilding", Building[i_id][EBuilding]);
}
//Biz
print("5");
printf("PVAR %d"), GetPVarInt(playerid,"InBiz");
if(GetPVarInt(playerid,"InBiz")!=-1)
{
print("6");
new b=GetPVarInt(playerid,"InBiz");
new bi=bInfo[b][bInterior];
if(IsPlayerInRangeOfPoint(playerid,3.0,BizInts[bi][IX],BizInts[bi][IY],BizInts[bi][IZ]))
{
SetPlayerPos(playerid,bInfo[b][bX],bInfo[b][bY],bInfo[b][bZ]);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetPVarInt(playerid,"InBiz",-1);
return 1;
}
}
else
{
print("7");
for(new b;b<sizeof(bInfo);b++)
{
if(IsPlayerInRangeOfPoint(playerid,5.0,bInfo[b][bX],bInfo[b][bY],bInfo[b][bZ]))
{
if(bInfo[b][biztype] == 7)return 1;
if(bInfo[b][biztype] == 3)return 1;
SetPlayerPos(playerid,BizInts[b][IX],BizInts[b][IY],BizInts[b][IZ]);
SetPlayerInterior(playerid,BizInts[b][Interior]);
SetPlayerVirtualWorld(playerid,BizInts[b][Welt]);
SetPVarInt(playerid,"InBiz",b);
}
}
}
}
return 1;
}
Alles anzeigen