SA-MP Forums Archive
If player is in any interior. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: If player is in any interior. (/showthread.php?tid=154357)



If player is in any interior. - Ihsan_Cingisiz - 13.06.2010

Hello, i have a problem..
When the player types /enter to go inside he fells to the sea..
I use this script to get in the hospital but ..
Код:
	if(strcmp("/enter", cmdtext, true, 6) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 1172.6001,-1323.2318,15.4027)
		|| IsPlayerInRangeOfPoint(playerid, 3.0, 2033.9796,-1402.4280,17.2930)){
		SetPlayerPos(playerid, -3436.1538,475.9111,57.6132);
		}
		return 1;
	}
How can i make that he don't fall to the sea but completely enters this pos : -3436.1538,475.9111,57.6132?


Re: If player is in any interior. - KnooL - 13.06.2010

pawn Код:
if(strcmp("/enter", cmdtext, true, 6) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, 1172.6001,-1323.2318,15.4027)
        || IsPlayerInRangeOfPoint(playerid, 3.0, 2033.9796,-1402.4280,17.2930)){
        TogglePlayerControllable(playerid,0);
        SetPlayerPos(playerid, -3436.1538,475.9111,57.6132);
        SetTimerEx("LoadObjects",1000,false,"i",playerid);
        }
        return 1;
    }

forward LoadObjects(playerid);
public LoadObjects(playerid)
{
    TogglePlayerControllable(playerid,1);
}
If the player still falls into the sea make the timer bigger than 1000ms (1sec). And make sure you got the player in the right interior.


Re: If player is in any interior. - Ihsan_Cingisiz - 13.06.2010

Quote:
Originally Posted by KnooL
pawn Код:
if(strcmp("/enter", cmdtext, true, 6) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, 1172.6001,-1323.2318,15.4027)
        || IsPlayerInRangeOfPoint(playerid, 3.0, 2033.9796,-1402.4280,17.2930)){
        TogglePlayerControllable(playerid,0);
        SetPlayerPos(playerid, -3436.1538,475.9111,57.6132);
        SetTimerEx("LoadObjects",1000,false,"i",playerid);
        }
        return 1;
    }

forward LoadObjects(playerid);
public LoadObjects(playerid)
{
    TogglePlayerControllable(playerid,1);
}
If the player still falls into the sea make the timer bigger than 1000ms (1sec). And make sure you got the player in the right interior.
Doesn't work, is this the only way?

Error
Quote:

error 004: function "LoadObjects" is not implemented




Re: If player is in any interior. - Niixie - 13.06.2010

You have to forward the timer


Re: If player is in any interior. - Ihsan_Cingisiz - 13.06.2010

Quote:
Originally Posted by [MWR
Niixie ]
You have to forward the timer
forward LoadObjects(playerid);
I get these errors : error 029: invalid expression, assumed zero
error 004: function "LoadObjects" is not implemented


Re: If player is in any interior. - Ihsan_Cingisiz - 13.06.2010

Quote:
Originally Posted by Ihsan_Cingisiz
Quote:
Originally Posted by [MWR
Niixie ]
You have to forward the timer
forward LoadObjects(playerid);
I get these errors : error 029: invalid expression, assumed zero
error 004: function "LoadObjects" is not implemented
And how do i forward the timer?



Re: If player is in any interior. - Agent Smith - 13.06.2010

Add this to the top of the script (where you other forwards are)
pawn Код:
forward LoadObjects(playerid);
Then add this somewhere else (where your other publics are)
pawn Код:
public LoadObjects(playerid)
{
    TogglePlayerControllable(playerid,1);
}



Re: If player is in any interior. - Ihsan_Cingisiz - 13.06.2010

It works but i still see the sea, and i don't see the interior?
Do i need to use SetPlayerInterior(playerid, ?); ?

Edit: If i press /enter i freeze in the air (above the sea)
then i unfreeze for a second, then i freeze again, then unfreeze for a second
till i fall in the sea


Re: If player is in any interior. - Agent Smith - 13.06.2010

https://sampwiki.blast.hk/wiki/SetPlayerInterior - Information about SetPlayerInterior. You can't use that as you are using your own interrior I think?

Also if the objects are not showing then make sure you have the position right and make sure they are under OnGameModeInit.


Re: If player is in any interior. - Ihsan_Cingisiz - 13.06.2010

Quote:
Originally Posted by Samdudes
https://sampwiki.blast.hk/wiki/SetPlayerInterior - Information about SetPlayerInterior. You can't use that as you are using your own interrior I think?

Also if the objects are not showing then make sure you have the position right and make sure they are under OnGameModeInit.
Not Object, i went to a other server and went to the Hospital and inside the hospital
i did /save and that's the position what i usee