06.12.2010, 19:16
ive started to make a new house system and i have a problem with my exit command.....
whole script
Advise Thanks
whole script
pawn Код:
#define MAX_HOUSES 25
enum hInfo
{
Float:hExteriorX,
Float:hExteriorY,
Float:hExteriorZ,
Float:hInteriorX,
Float:hInteriorY,
Float:hInteriorZ,
hInteriorID,
hVirtualWorldID,
hPickup,
};
new HouseInfo[MAX_HOUSES][hInfo];
public OnGameModeInit()
{
LoadHouse();
return 1;
}
if (strcmp("/henter", cmdtext, true, 10) == 0)
{
for(new houseid; houseid < MAX_HOUSES; houseid++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]))
{
SetPlayerPos(playerid, HouseInfo[houseid][hInteriorX], HouseInfo[houseid][hInteriorY], HouseInfo[houseid][hInteriorZ]);
SetPlayerInterior(playerid, HouseInfo[houseid][hInteriorID]);
SetPlayerVirtualWorld(playerid, HouseInfo[houseid][hVirtualWorldID]);
}
}
return 1;
}
if (strcmp("/hexit", cmdtext, true, 10) == 0)
{
for(new houseid; houseid < MAX_HOUSES; houseid++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[houseid][hInteriorX], HouseInfo[houseid][hInteriorY], HouseInfo[houseid][hInteriorZ]))
{
SetPlayerPos(playerid, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
}
}
return 1;
}
stock LoadHouse()
{
new arrCoords[22][64];
new strFromFile2[128];
new File: file = fopen("Houses.ini", io_read);
if (file)
{
new houseid;
while (houseid < sizeof(HouseInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
HouseInfo[houseid][hExteriorX] = floatstr(arrCoords[0]);
HouseInfo[houseid][hExteriorY] = floatstr(arrCoords[1]);
HouseInfo[houseid][hExteriorZ] = floatstr(arrCoords[2]);
HouseInfo[houseid][hInteriorX] = floatstr(arrCoords[3]);
HouseInfo[houseid][hInteriorY] = floatstr(arrCoords[4]);
HouseInfo[houseid][hInteriorZ] = floatstr(arrCoords[5]);
HouseInfo[houseid][hInteriorID] = strval(arrCoords[6]);
HouseInfo[houseid][hVirtualWorldID] = strval(arrCoords[7]);
HouseInfo[houseid][hPickup] = strval(arrCoords[8]);
HouseInfo[houseid][hPickup] = CreatePickup(1273, 1, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ], 0);
houseid++;
}
fclose(file);
}
return 1;
}
stock split(const strsrc[], strdest[][], delimiter)
{
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc)){
if(strsrc[i]==delimiter || i==strlen(strsrc)){
len = strmid(strdest[aNum], strsrc, li, i, 128);
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}