How to make a interior with PlayerToPoint
#1

.:How to make a easy interior:.
The first thing you do is put this in top of your filterscript in your pawno.
Right down under
Code:
#Include <a_Samp>
Code:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
So it will look like this:
Code:
#Include <a_Samp> 

forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
Scroll down to the last line in the script and put this as a new line:

Code:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
  if(IsPlayerConnected(playerid))
	{
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		tempposx = (oldposx -x);
		tempposy = (oldposy -y);
		tempposz = (oldposz -z);
		//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}
Then you scroll up to:

Code:
public OnPlayerCommandText(playerid, cmdtext[])
And put this in:

Code:
 if(!strcmp("/Enter", cmdtext, true) && PlayerToPoint(1.5 ,playerid, Float: X,Float: Y,Float: Z))
 {
	SetPlayerInterior(playerid, interiorid);
	SetPlayerPos(playerid,Float: X,Float: Y,Float: Z);
	CreatePickup(model,type, Float: X,Float: Y,Float: Z);
	return 1;
 }
 if(!strcmp("/Exit", cmdtext, true) && PlayerToPoint(1.5 ,playerid,Float: X,Float: Y,Float: Z))
 {
	SetPlayerInterior(playerid, 0);
	SetPlayerPos(playerid,Float: X,Float: Y,Float: Z);
	return 1;
	}
Then forfill in the: Float: X, Float: Y, Float: Z cordinates.

I maked an example for you.

Example:

At the door you see a red marker.
There you can press enter at my script:

Code:
if(!strcmp("/Enter", cmdtext, true) && PlayerToPoint(1.5 ,playerid,252.8745,-92.3390,3.5354))
 {
	SetPlayerInterior(playerid, 0);
	SetPlayerPos(playerid,262.1704,-84.3840,65.1329);
	CreatePickup(1239,2,252.8745,-92.3390,3.5354);
	return 1;
 }
 if(!strcmp("/Exit", cmdtext, true) && PlayerToPoint(1.5 ,playerid,262.1704,-84.3840,65.1329))
 {
	SetPlayerInterior(playerid, 0);
	SetPlayerPos(playerid,252.8745,-92.3390,3.5354);
	return 1;
 	}
 return 0;
 }
you can go and find your interior at https://sampwiki.blast.hk/wiki/Category_...Documentation.


-If you see any things you don't understand post them...
-Kristian Benne

Reply


Messages In This Thread
How to make a interior with PlayerToPoint - by Benne - 27.09.2008, 19:29
Re: Easy interior make - by Karlip - 27.09.2008, 19:33
Re: Easy interior make - by kalle - 04.10.2008, 23:52
Re: Easy interior make - by Kanji_Suzuki - 20.01.2009, 18:52
Re: Easy interior make - by klavins21 - 21.01.2009, 14:52
Re: Easy interior make - by BioFreeze - 21.01.2009, 14:55
Re: How to make a interior with PlayerToPoint - by Criss_Angel - 27.06.2009, 19:09
Re: Easy interior make - by Serediucr - 27.06.2009, 19:20
Re: How to make a interior with PlayerToPoint - by Ignas1337 - 28.06.2009, 08:22
Re: How to make a interior with PlayerToPoint - by shady91 - 28.06.2009, 08:46

Forum Jump:


Users browsing this thread: 1 Guest(s)