command(enter, problem
#1

Hello everybody !
I make`d a command, /enter but don`t work...
I can enter only in house.When i try to enter in a business tell me : This is not a house... and at faction hq give me this message..What it`s wrong ??


Код:
command(enter, playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 5.0, 2269.3821,-75.3405,26.7724))
	{
	    SetPlayerPos(playerid, 916.6719,2380.9543,246.4695);
	    SetPlayerInterior(playerid, 1);
	    GameTextForPlayer(playerid, "~g~Job Center~n~~r~Type /exit to go outside", 3000, 5);
		LoadInterior(playerid);
	}
	if(IsPlayerInRangeOfPoint(playerid, 5.0, 1252.5388,137.0014,20.8469))
	{
	    SetPlayerPos(playerid, -2029.7589,-118.3868,1035.1719);
	    SetPlayerInterior(playerid, 3);
	    GameTextForPlayer(playerid, "~w~DMV~n~~r~Type /exit to go outside", 3000, 5);
	    LoadInterior(playerid);
	}
	else if(IsPlayerInRangeOfPoint(playerid, 5.0, 627.9313,-571.6613,17.4696))
	{
	    SetPlayerPos(playerid, 246.2813,108.7695,1003.2188);
		SetPlayerInterior(playerid, 10);
		GameTextForPlayer(playerid, "~w~Red County Sheriffs Department~n~~r~Type /exit to go outside", 3000, 5);
		LoadInterior(playerid);
	}
	else if(IsPlayerInRangeOfPoint(playerid, 5.0, 624.0983,-600.0155,16.7198))
	{
	    if(Player[playerid][Faction] == 1)
		{
		    if(IsPlayerInAnyVehicle(playerid))
		    {
		        SetVehiclePos(GetPlayerVehicleID(playerid), 1589.5502,-1646.0876,11.3940);
		        SetVehicleZAngle(GetPlayerVehicleID(playerid), 201.7274);
		        LoadInterior(playerid);
			}
			else
			{
			    SetPlayerPos(playerid, 1589.5502,-1646.0876,11.3940);
			    LoadInterior(playerid);
			}
		}
		else return SendClientMessage(playerid, WHITE, "You don't have the right to be inside of here.");
	}
	else
	{
		for(new i = 1; i < MAX_HOUSES; i++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 3.0, Houses[i][HouseExteriorX], Houses[i][HouseExteriorY], Houses[i][HouseExteriorZ]))
			{
			    if(Houses[i][HouseLocked] == 0)
			    {
			    	new string[256];
        			SetPlayerPos(playerid, Houses[i][HouseInteriorX], Houses[i][HouseInteriorY], Houses[i][HouseInteriorZ]);
			    	SetPlayerInterior(playerid, Houses[i][HouseInteriorID]);
			    	format(string, sizeof(string), "~w~%s~n~~r~Type /exit to go outside", Houses[i][HouseName]);
					GameTextForPlayer(playerid, string, 3000, 5);
					SetPlayerVirtualWorld(playerid, Houses[i][HouseWorld]);
					LoadInterior(playerid);
				}
				else
				{
				    new string[256];
				    format(string, sizeof(string), "%s is currently locked.", Houses[i][HouseName]);
				    SendClientMessage(playerid, WHITE, string);
				}
			}
		}
		for(new i = 1; i < MAX_BUSINESS; i++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 3.0, Business[i][BusinessExteriorX], Business[i][BusinessExteriorY], Business[i][BusinessExteriorZ]))
			{
			    if(Business[i][BusinessEnterable] == 1)
			    {
			        if(Player[playerid][Money] >= Business[i][BusinessEnterFee])
			        {
				        new string[256];
				    	SetPlayerPos(playerid, Business[i][BusinessInteriorX], Business[i][BusinessInteriorY], Business[i][BusinessInteriorZ]);
				    	SetPlayerInterior(playerid, Business[i][BusinessInteriorID]);
				    	format(string, sizeof(string), "Welcome to %s. Owned by %s. Entrance fee: $%d.", Business[i][BusinessName], Business[i][BusinessOwner], Business[i][BusinessEnterFee]);
				    	SendClientMessage(playerid, WHITE, string);
				    	InBusiness[playerid] = i;
				    	Player[playerid][Money] -= Business[i][BusinessEnterFee];
				    	SetPlayerVirtualWorld(playerid, Business[i][BusinessWorld]);
						format(string, sizeof(string), "~w~%s~n~~r~Type /exit to go outside", Business[i][BusinessName]);
						GameTextForPlayer(playerid, string, 3000, 5);
						LoadInterior(playerid);
					}
					else return SendClientMessage(playerid, GREY, "You don't have enough money to enter this business.");
				}
				else return SendClientMessage(playerid, WHITE, "This business isn't enterable.");
			}
		}
	}
	return 1;
}
And 2...
How can i create a simple command for teleport ? SetPlayerPos and SetPlayerInt..i need for go to interiors at houses..i have a dynamic system for house and i need to go to a interior....
Reply
#2

You dont need to use else if it is different (Cant explain its hard lol )
pawn Код:
command(enter, playerid, params[])
{
    for(new i = 1; i < MAX_HOUSES; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, Houses[i][HouseExteriorX], Houses[i][HouseExteriorY], Houses[i][HouseExteriorZ]))
        {
            if(Houses[i][HouseLocked] == 0)
            {
                new string[256];
                SetPlayerPos(playerid, Houses[i][HouseInteriorX], Houses[i][HouseInteriorY], Houses[i][HouseInteriorZ]);
                SetPlayerInterior(playerid, Houses[i][HouseInteriorID]);
                format(string, sizeof(string), "~w~%s~n~~r~Type /exit to go outside", Houses[i][HouseName]);
                GameTextForPlayer(playerid, string, 3000, 5);
                SetPlayerVirtualWorld(playerid, Houses[i][HouseWorld]);
                LoadInterior(playerid);
            }
            else
            {
                new string[256];
                format(string, sizeof(string), "%s is currently locked.", Houses[i][HouseName]);
                SendClientMessage(playerid, WHITE, string);
            }
        }
    }
    for(new i = 1; i < MAX_BUSINESS; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, Business[i][BusinessExteriorX], Business[i][BusinessExteriorY], Business[i][BusinessExteriorZ]))
        {
            if(Business[i][BusinessEnterable] == 1)
            {
                if(Player[playerid][Money] >= Business[i][BusinessEnterFee])
                {
                    new string[256];
                    SetPlayerPos(playerid, Business[i][BusinessInteriorX], Business[i][BusinessInteriorY], Business[i][BusinessInteriorZ]);
                    SetPlayerInterior(playerid, Business[i][BusinessInteriorID]);
                    format(string, sizeof(string), "Welcome to %s. Owned by %s. Entrance fee: $%d.", Business[i][BusinessName], Business[i][BusinessOwner], Business[i][BusinessEnterFee]);
                    SendClientMessage(playerid, WHITE, string);
                    InBusiness[playerid] = i;
                    Player[playerid][Money] -= Business[i][BusinessEnterFee];
                    SetPlayerVirtualWorld(playerid, Business[i][BusinessWorld]);
                    format(string, sizeof(string), "~w~%s~n~~r~Type /exit to go outside", Business[i][BusinessName]);
                    GameTextForPlayer(playerid, string, 3000, 5);
                    LoadInterior(playerid);
                }
                else return SendClientMessage(playerid, GREY, "You don't have enough money to enter this business.");
            }
            else return SendClientMessage(playerid, WHITE, "This business isn't enterable.");
        }
    }
        if(IsPlayerInRangeOfPoint(playerid, 5.0, 2269.3821,-75.3405,26.7724))
    {
        SetPlayerPos(playerid, 916.6719,2380.9543,246.4695);
        SetPlayerInterior(playerid, 1);
        GameTextForPlayer(playerid, "~g~Job Center~n~~r~Type /exit to go outside", 3000, 5);
        LoadInterior(playerid);
    }
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 1252.5388,137.0014,20.8469))
    {
        SetPlayerPos(playerid, -2029.7589,-118.3868,1035.1719);
        SetPlayerInterior(playerid, 3);
        GameTextForPlayer(playerid, "~w~DMV~n~~r~Type /exit to go outside", 3000, 5);
        LoadInterior(playerid);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 5.0, 627.9313,-571.6613,17.4696))
    {
        SetPlayerPos(playerid, 246.2813,108.7695,1003.2188);
        SetPlayerInterior(playerid, 10);
        GameTextForPlayer(playerid, "~w~Red County Sheriffs Department~n~~r~Type /exit to go outside", 3000, 5);
        LoadInterior(playerid);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 5.0, 624.0983,-600.0155,16.7198))
    {
        if(Player[playerid][Faction] == 1)
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                SetVehiclePos(GetPlayerVehicleID(playerid), 1589.5502,-1646.0876,11.3940);
                SetVehicleZAngle(GetPlayerVehicleID(playerid), 201.7274);
                LoadInterior(playerid);
            }
            else
            {
                SetPlayerPos(playerid, 1589.5502,-1646.0876,11.3940);
                LoadInterior(playerid);
            }
        }
        else return SendClientMessage(playerid, WHITE, "You don't have the right to be inside of here.");
    }
    return 1;
}
Reply
#3

Now i have 2 warnings...


D:\Servere SAMP\Hard Life Roleplay\VCRP\gamemodes\subrp.pwn(4020) : warning 217: loose indentation
D:\Servere SAMP\Hard Life Roleplay\VCRP\gamemodes\subrp.pwn(4027) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Warnings.


4020 : if(IsPlayerInRangeOfPoint(playerid, 5.0, 2269.3821,-75.3405,26.7724))
4027 : if(IsPlayerInRangeOfPoint(playerid, 5.0, 1252.5388,137.0014,20.8469))
Reply
#4

make sure its indented properly (tab spaces)
Reply
#5

its just warnings the file will compile with even 1000 warnings and you will get the .amx
so dont worry
Reply
#6

Quote:
Originally Posted by mubashir
Посмотреть сообщение
its just warnings the file will compile with even 1000 warnings and you will get the .amx
so dont worry
Not really.. few warnings are so important that it will result in the SA-MP server not recognizing the .amx file properly, thus with the usual error, file not found(or error, w/e).

EDIT : Fixed the indentations of ToiletDuck's codes, here you go.. http://pastebin.com/n8zcfWhs
Reply
#7

Quote:
Originally Posted by Sublime
Посмотреть сообщение
Not really.. few warnings are so important that it will result in the SA-MP server not recognizing the .amx file properly, thus with the usual error, file not found(or error, w/e).

EDIT : Fixed the indentations of ToiletDuck's codes, here you go.. http://pastebin.com/n8zcfWhs
Thank you very much..
Now it work...

T/C please,Resolved !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)