IsPlayerInRangeOfPoint
#1

i want to add IsPlayerInRangeOfPoint for this command

Код:
	if(strcmp(cmd, "/sellhouse", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			GetPlayerName(playerid, playername, sizeof(playername));
			if(PlayerInfo[playerid][pPhousekey] == 9999)
			{
				SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
				return 1;
			}
			if(PlayerInfo[playerid][pMarried] > 0)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "** You are Married, can't sell the House !");
		        return 1;
		    }
		    if(CanSellHouse[playerid] == 0)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "You can't sell the house without first authorizing it at /account panel!");
		        return 1;
		    }
			if(PlayerInfo[playerid][pPhousekey] != 9999 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
			{
				new house = PlayerInfo[playerid][pPhousekey];
				HouseInfo[house][hHel] = 0;
				HouseInfo[house][hArm] = 0;
				HouseInfo[house][hHealthx] = 0;
				HouseInfo[house][hHealthy] = 0;
				HouseInfo[house][hHealthz] = 0;
				HouseInfo[house][hArmourx] = 0;
				HouseInfo[house][hArmoury] = 0;
				HouseInfo[house][hArmourz] = 0;
				HouseInfo[house][hLock] = 1;
				HouseInfo[house][hOwned] = 0;
				HouseInfo[house][hVec] = 418;
				HouseInfo[house][hVcol1] = -1;
				HouseInfo[house][hVcol2] = -1;

				strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
                strmid(HouseInfo[house][hMessage],"For Sale",0,strlen("For Sale"),255);
				//ConsumingMoney[playerid] = 1;
				SafeGivePlayerMoney(playerid,HouseInfo[house][hValue]);
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d", HouseInfo[house][hValue]);
				GameTextForPlayer(playerid, string, 10000, 3);
				PlayerInfo[playerid][pPhousekey] = 9999;
				if(PlayerInfo[playerid][pLocal] == house)
				{
					SafeSetPlayerInterior(playerid,0);
					SetPlayerVirtualWorld(playerid,0);
					SafeSetPlayerPos(playerid,HouseInfo[house][hEntrancex],HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez]);
				}
				OnPropUpdate(1,house);
				OnPropTextdrawUpdate(1, house);
				OnHousePickupUpdate(house);
				OnPlayerUpdateEx(playerid);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
			}
		}
		return 1;
	}
i'll Remove SafeSetPlayerPos And SetPlayerVirtualWorld ....
you won't need this but , here's the location ...
Код:
364.65121, 173.86839, 1007.37799
i know you already notice that i want to make it somehow that you can only sell your house in City Hall , sounds more Real
So help me out here
just need to know where to add IsPlayerInRangeOfPoint And Where to add Return of it with a SendClientMessage
--------------------
Reply
#2

guys ... give a hand here
Reply
#3

just add it there not?

Код:
if(strcmp(cmd, "/sellhouse", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
                    if(IsPlayerInRangeOfPoint(playerid,range,x,y,z))
                    {
                               SendClientMessage(playerid, COLOR_GREY, "You are not in house");
		        return 1;
		    }
			GetPlayerName(playerid, playername, sizeof(playername));
			if(PlayerInfo[playerid][pPhousekey] == 9999)
			{
				SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
				return 1;
			}
			if(PlayerInfo[playerid][pMarried] > 0)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "** You are Married, can't sell the House !");
		        return 1;
		    }
		    if(CanSellHouse[playerid] == 0)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "You can't sell the house without first authorizing it at /account panel!");
		        return 1;
		    }
			if(PlayerInfo[playerid][pPhousekey] != 9999 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
			{
	                       new house = PlayerInfo[playerid][pPhousekey];
				HouseInfo[house][hHel] = 0;
				HouseInfo[house][hArm] = 0;
				HouseInfo[house][hHealthx] = 0;
				HouseInfo[house][hHealthy] = 0;
				HouseInfo[house][hHealthz] = 0;
				HouseInfo[house][hArmourx] = 0;
				HouseInfo[house][hArmoury] = 0;
				HouseInfo[house][hArmourz] = 0;
				HouseInfo[house][hLock] = 1;
				HouseInfo[house][hOwned] = 0;
				HouseInfo[house][hVec] = 418;
				HouseInfo[house][hVcol1] = -1;
				HouseInfo[house][hVcol2] = -1;

				strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
                strmid(HouseInfo[house][hMessage],"For Sale",0,strlen("For Sale"),255);
				//ConsumingMoney[playerid] = 1;
				SafeGivePlayerMoney(playerid,HouseInfo[house][hValue]);
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d", HouseInfo[house][hValue]);
				GameTextForPlayer(playerid, string, 10000, 3);
				PlayerInfo[playerid][pPhousekey] = 9999;
				if(PlayerInfo[playerid][pLocal] == house)
				{
					SafeSetPlayerInterior(playerid,0);
					SetPlayerVirtualWorld(playerid,0);
					SafeSetPlayerPos(playerid,HouseInfo[house][hEntrancex],HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez]);
				}
				OnPropUpdate(1,house);
				OnPropTextdrawUpdate(1, house);
				OnHousePickupUpdate(house);
				OnPlayerUpdateEx(playerid);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
			}
		}
		return 1;
	}
Reply
#4

Quote:
Originally Posted by dEcooR
Посмотреть сообщение
just add it there not?

Код:
if(strcmp(cmd, "/sellhouse", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
                    if(IsPlayerInRangeOfPoint(playerid,range,x,y,z))
                    {
                               SendClientMessage(playerid, COLOR_GREY, "You are not in house");
		        return 1;
		    }
			GetPlayerName(playerid, playername, sizeof(playername));
			if(PlayerInfo[playerid][pPhousekey] == 9999)
			{
				SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
				return 1;
			}
			if(PlayerInfo[playerid][pMarried] > 0)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "** You are Married, can't sell the House !");
		        return 1;
		    }
		    if(CanSellHouse[playerid] == 0)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "You can't sell the house without first authorizing it at /account panel!");
		        return 1;
		    }
			if(PlayerInfo[playerid][pPhousekey] != 9999 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
			{
	                       new house = PlayerInfo[playerid][pPhousekey];
				HouseInfo[house][hHel] = 0;
				HouseInfo[house][hArm] = 0;
				HouseInfo[house][hHealthx] = 0;
				HouseInfo[house][hHealthy] = 0;
				HouseInfo[house][hHealthz] = 0;
				HouseInfo[house][hArmourx] = 0;
				HouseInfo[house][hArmoury] = 0;
				HouseInfo[house][hArmourz] = 0;
				HouseInfo[house][hLock] = 1;
				HouseInfo[house][hOwned] = 0;
				HouseInfo[house][hVec] = 418;
				HouseInfo[house][hVcol1] = -1;
				HouseInfo[house][hVcol2] = -1;

				strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
                strmid(HouseInfo[house][hMessage],"For Sale",0,strlen("For Sale"),255);
				//ConsumingMoney[playerid] = 1;
				SafeGivePlayerMoney(playerid,HouseInfo[house][hValue]);
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d", HouseInfo[house][hValue]);
				GameTextForPlayer(playerid, string, 10000, 3);
				PlayerInfo[playerid][pPhousekey] = 9999;
				if(PlayerInfo[playerid][pLocal] == house)
				{
					SafeSetPlayerInterior(playerid,0);
					SetPlayerVirtualWorld(playerid,0);
					SafeSetPlayerPos(playerid,HouseInfo[house][hEntrancex],HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez]);
				}
				OnPropUpdate(1,house);
				OnPropTextdrawUpdate(1, house);
				OnHousePickupUpdate(house);
				OnPlayerUpdateEx(playerid);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
			}
		}
		return 1;
	}
Where's the Else Return ?
not tested but i think what you did is , if i AM in range it Sends a Client message that says you are not in your house
Reply
#5

make this omg
Код:
if(!IsPlayerInRangeOfPoint(playerid,range,x,y,z))
{
       SendClientMessage(playerid, COLOR_GREY, "You are not in house");
       return 1;
}
or
Код:
if(!IsPlayerInRangeOfPoint(playerid,range,x,y,z)) return SendClientMessage(playerid, COLOR_GREY, "You are not in house");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)