27.09.2008, 19:29
.: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);
Code:
#Include <a_Samp> forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
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;
}
Code:
public OnPlayerCommandText(playerid, cmdtext[])
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;
}
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;
}
-If you see any things you don't understand post them...
-Kristian Benne


so i give yopu a double point
ill show you what i mean.