House System Problem...
#1

ive started to make a new house system and i have a problem with my exit command.....

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;
}
Advise Thanks
Reply
#2

try changing

Код:
floatstr(arrCoords[0]);
floatstr(arrCoords[1]);
floatstr(arrCoords[2]);
floatstr(arrCoords[3]);
floatstr(arrCoords[4]);
floatstr(arrCoords[5]);
to
Код:
Float:strval(arrCoords[0]);
Float:strval(arrCoords[1]);
Float:strval(arrCoords[2]);
Float:strval(arrCoords[3]);
Float:strval(arrCoords[4]);
Float:strval(arrCoords[5]);
Reply
#3

....Not Work Is Not Recognize My Coordonates
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)