IsPlayerInRangeOfPoint Not Getting Coords
#1

I'm trying to set up plane hangars and have them be buyable, but for some reason in game it's saying I'm not near a hangar when I'm on the marker and the markers use the same coords.

Here is a part of my code that has it try to grab the coords.
Код:
if(strcmp(cmd, "/buyhangar", true) == 0)
	{
	    GetPlayerName(playerid, playername, sizeof(playername));
	    for(new ha = 0; ha < sizeof(HangarInfo); ha++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 5, HangarInfo[ha][haLocationX], HangarInfo[ha][haLocationY], HangarInfo[ha][haLocationZ]) && HangarInfo[ha][haOwned] == 0)
			{
			    if(PlayerInfo[playerid][pLevel] < HangarInfo[ha][haLevelNeeded])
			    {
			        format(string, sizeof(string), "   You must be Level %d to purchase this !", HangarInfo[ha][haLevelNeeded]);
					SendClientMessage(playerid, COLOR_GRAD5, string);
					return 1;
				}
				if(PlayerInfo[playerid][pHangarKey] != 9999)
Код:
enum haInfo
{
	haOwned,
	haOwner[64],
	Float:haLocationX,
	Float:haLocationY,
	Float:haLocationZ,
	haLevelNeeded,
	haBuyPrice,
	haID
};
new HangarInfo[255][haInfo];
Код:
public LoadHangars()
{
	new file[64];
	for(new idx = 0; idx < sizeof(HangarInfo) ; idx++)
	{
    	format(file, sizeof(file),"LARP/Hangars/%d.ini", idx)
    	if(dini_Exists(file))
		{
	    	HangarInfo[idx][haOwned] = dini_Int(file,"Owned");
	    	strmid(HangarInfo[idx][haOwner], dini_Get(file,"Owner"), 0, strlen(dini_Get(file,"Owner")), 255);
	    	HangarInfo[idx][haLevelNeeded] = dini_Int(file,"LevelNeeded");
	    	HangarInfo[idx][haBuyPrice] = dini_Int(file,"Price");
	    	HangarInfo[idx][haID] = dini_Int(file,"ID");
	    	HangarInfo[idx][haLocationX] = dini_Float(file,"X");
	    	HangarInfo[idx][haLocationY] = dini_Float(file,"Y");
	    	HangarInfo[idx][haLocationZ] = dini_Float(file,"Z");
		}
	}
	print("[SCRIPT]: Loaded Hangars");
	return 1;
}
Can't figure out why this doesnt work, yet houses do when they are basically set up the same way.

Quick side-note I had the dini_Float set to just dini_Int before and that didnt work.

Here is an example of what the hangar .ini looks like Also, do they have to start at 0.ini because i have it start at 1.ini.
Код:
Owned=0
Owner=The State
LevelNeeded=8
ID=1
X=1986.4172
Y=-2316.0139
Z=13.5469
Price=100000
Reply
#2

Код:
if(IsPlayerInRangeOfPoint(playerid, 5, HangarInfo[ha][haLocationX], HangarInfo[ha][haLocationY], HangarInfo[ha][haLocationZ]) && HangarInfo[ha][haOwned] == 0)
Have you tried it without the && HangarInfo[ha][haOwned] == 0) ?
Reply
#3

Didn't do anything, though thanks for cleaning my script lol. No idea why I had that there.

Okay so I went to the first hangar (before your suggestion) and it works on there, but all the others still say I'm not near a hangar.
Reply
#4

Bump. Still can't figure out what is going. :/
Reply
#5

Can't believe I never noticed the early return and missing else statement for not near point. Anyways, fixed that but now my chat floods with "you are not near your hangar!" after buying the house.
Reply
#6

Well, I just removed the else. Who needs it. lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)