House Info
#1

I want to make just like this, but I make something wrong. Please help me.



Код:
			for(new h = 0; h < sizeof(HouseInfo); h++)
			{
				if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]))
    			{
    			    if(strcmp(playername, HouseInfo[h][hOwner], true) == 0)
			        {
						new Level = HouseInfo[h][hLevel];
		    			if(HouseInfo[h][hLock] == 1 && strcmp(HouseInfo[h][hOwner],PlayerName(playerid), true ) != 0) return SendClientMessage(playerid, COLOR_WHITE,  "[HOUSE]: This house has been locked by the owner.");
		    			Pause(playerid);
	    				SetPlayerPos(playerid, HousesCoords[Level][0], HousesCoords[Level][1], HousesCoords[Level][2]);
	   					SetPlayerInterior(playerid, HousesLevels[Level][0]); SetPlayerVirtualWorld(playerid, HouseInfo[h][hWorld]);
	   					HouseEntered[playerid] = h;
					}
					else
					{
						GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
					}
				}
			}
Reply
#2

You can't use IsPlayerInRangeOfPoint here, though I couldn't. Here's a nice stock which you can use. I don't know who made it originally, but I got it from Jakku.

pawn Код:
stock Float:GetDistanceToHouseOutside(playerid,houseid)
{
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    GetPlayerPos(playerid,x1,y1,z1);
    x2 =  HouseInfo[houseid][PickupOutsidePosX];
    y2 =  HouseInfo[houseid][PickupOutsidePosY];
    z2 = HouseInfo[houseid][PickupOutsidePosZ];
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2) + floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}

stock Float:GetDistanceToHouseInside(playerid,houseid)
{
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    GetPlayerPos(playerid,x1,y1,z1);
    x2 = HouseInfo[houseid][PickupInsidePosX];
    y2 = HouseInfo[houseid][PickupInsidePosY];
    z2 = HouseInfo[houseid][PickupInsidePosZ];
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2) + floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}

stock IsNearHouseOutside(playerid)
{
    new Float:Distance;
    for(new house; house < MAX_HOUSES; house++)
    {
        Distance = GetDistanceToHouseOutside(playerid,house);
        if(Distance < 5.0)
        {
            return house;
        }
    }
    return -1;
}

stock IsNearHouseInside(playerid)
{
    new Float:Distance;
    for(new house; house < MAX_HOUSES; house++)
    {
        Distance = GetDistanceToHouseInside(playerid,house);
        if(Distance < 5.0 && GetPlayerVirtualWorld(playerid) == HouseInfo[house][VirtualWorld])
        {
            return house;
        }
    }
    return -1;
}
I modified them for my use, I don't have original. Edit this to your version.
Reply
#3

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
You can't use IsPlayerInRangeOfPoint here, though I couldn't. Here's a nice stock which you can use. I don't know who made it originally, but I got it from Jakku.

pawn Код:
stock Float:GetDistanceToHouseOutside(playerid,houseid)
{
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    GetPlayerPos(playerid,x1,y1,z1);
    x2 =  HouseInfo[houseid][PickupOutsidePosX];
    y2 =  HouseInfo[houseid][PickupOutsidePosY];
    z2 = HouseInfo[houseid][PickupOutsidePosZ];
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2) + floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}

stock Float:GetDistanceToHouseInside(playerid,houseid)
{
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    GetPlayerPos(playerid,x1,y1,z1);
    x2 = HouseInfo[houseid][PickupInsidePosX];
    y2 = HouseInfo[houseid][PickupInsidePosY];
    z2 = HouseInfo[houseid][PickupInsidePosZ];
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2) + floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}

stock IsNearHouseOutside(playerid)
{
    new Float:Distance;
    for(new house; house < MAX_HOUSES; house++)
    {
        Distance = GetDistanceToHouseOutside(playerid,house);
        if(Distance < 5.0)
        {
            return house;
        }
    }
    return -1;
}

stock IsNearHouseInside(playerid)
{
    new Float:Distance;
    for(new house; house < MAX_HOUSES; house++)
    {
        Distance = GetDistanceToHouseInside(playerid,house);
        if(Distance < 5.0 && GetPlayerVirtualWorld(playerid) == HouseInfo[house][VirtualWorld])
        {
            return house;
        }
    }
    return -1;
}
I modified them for my use, I don't have original. Edit this to your version.
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33011) : error 029: invalid expression, assumed zero
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33011) : warning 221: label name "Float" shadows tag name
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33011) : error 017: undefined symbol "GetDistanceToHouseOutside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33016) : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33017) : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(3301 : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33019) : warning 213: tag mismatch
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33022) : warning 225: unreachable code
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33022) : error 029: invalid expression, assumed zero
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33022) : warning 221: label name "Float" shadows tag name
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33022) : error 017: undefined symbol "GetDistanceToHouseInside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33027) : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(3302 : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33029) : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33030) : warning 213: tag mismatch
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33033) : warning 225: unreachable code
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33033) : error 029: invalid expression, assumed zero
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33033) : error 017: undefined symbol "IsNearHouseOutside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33036) : error 017: undefined symbol "MAX_HOUSES"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(3303 : error 017: undefined symbol "GetDistanceToHouseOutside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33047) : warning 225: unreachable code
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33047) : error 029: invalid expression, assumed zero
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33047) : error 017: undefined symbol "IsNearHouseInside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33050) : error 017: undefined symbol "MAX_HOUSES"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33052) : error 017: undefined symbol "GetDistanceToHouseInside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33053) : error 017: undefined symbol "VirtualWorld"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33011) : warning 203: symbol is never used: "Float"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


19 Errors.
Reply
#4

Please, somebody help me.
Reply
#5

bump
Reply
#6

Help me!
Reply
#7

Breaking rules, won't get you much help will it?

Read the errors, they give you a nice little description of what to do next.
Reply
#8

Quote:
Originally Posted by Kayneftw
Посмотреть сообщение
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33011) : error 029: invalid expression, assumed zero
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33011) : warning 221: label name "Float" shadows tag name
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33011) : error 017: undefined symbol "GetDistanceToHouseOutside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33016) : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33017) : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(3301 : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33019) : warning 213: tag mismatch
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33022) : warning 225: unreachable code
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33022) : error 029: invalid expression, assumed zero
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33022) : warning 221: label name "Float" shadows tag name
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33022) : error 017: undefined symbol "GetDistanceToHouseInside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33027) : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(3302 : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33029) : error 017: undefined symbol "houseid"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33030) : warning 213: tag mismatch
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33033) : warning 225: unreachable code
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33033) : error 029: invalid expression, assumed zero
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33033) : error 017: undefined symbol "IsNearHouseOutside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33036) : error 017: undefined symbol "MAX_HOUSES"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(3303 : error 017: undefined symbol "GetDistanceToHouseOutside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33047) : warning 225: unreachable code
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33047) : error 029: invalid expression, assumed zero
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33047) : error 017: undefined symbol "IsNearHouseInside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33050) : error 017: undefined symbol "MAX_HOUSES"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33052) : error 017: undefined symbol "GetDistanceToHouseInside"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33053) : error 017: undefined symbol "VirtualWorld"
C:\Users\hidden\Desktop\Files\sumthin\DGRP\gamemod es\dgrp.pwn(33011) : warning 203: symbol is never used: "Float"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


19 Errors.
As Jochemed already told you: "Modify it to your own use!"
Reply
#9

Quote:
Originally Posted by sim_sima
Посмотреть сообщение
As Jochemed already told you: "Modify it to your own use!"
I don't know how to modify it! That's why I need help!
Reply
#10

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
You can't use IsPlayerInRangeOfPoint here, though I couldn't. Here's a nice stock which you can use. I don't know who made it originally, but I got it from Jakku.

pawn Код:
long code
I modified them for my use, I don't have original. Edit this to your version.
I do not see why you can't use IsPlayerInRangeOfPoint there. Plus that code you posted is extremely inefficient (go read one of ******' topics about it).
pawn Код:
floatsub(y2, y1)
// is exactly the same as
y2 - y1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)