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
#2

The original SA-MP wiki is up.
No need to direct link to copies.
Reply
#3

This is a great tutorial, actually ppl can use this for much stuff so i give yopu a double point
Reply
#4

hmm dont work for me
Reply
#5

ar that wiki link isn`t any text in it
Reply
#6


You don't tell people here how to create a interior. You only move them to a other position by using PlayerToPoint. Creating interiors is a whole other story. ( Can't be done , you can only create something like it with using objects )
Reply
#7

Hey in Setplayerpos is it x,y,z
Reply
#8

Quote:
Originally Posted by |Johny|
ar that wiki link isn`t any text in it
get interior id by being in it and press /interior
Reply
#9

also it could be done with an array which would be so much nicer and it could be done OnPlayerKeyStateChange, but that's all up to scripters to do themselves as i've :P
Reply
#10

lol i made my own int i used a box then made door etc so you cant enter then put gates up on second floor made it into a jail you would neva belive what it was before lol it looks sweet ill post it in a min i made it so its for int 1 and VW 5 ill show you what i mean.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)