Attempting to script my own house
#10

pawn Код:
#include <a_samp>

//Leave this line below.

#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2])))))return 1

//Leave this here.

stock 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);
      if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
           return 1;
        }
    }
  return 0;
}

public OnFilterScriptInit()
{
  print("Admin Crib Loaded");
  DisableInteriorEnterExits();
  CreatePickup(1239, 1, 2049.48, 2763.07, 10.82); // Icon Where you placed your icon is the enter point.
  return 1;
}

public OnFilterScriptExit()
{
  print("Admin Crib Unloaded");
  return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(enter, 5, cmdtext);//DCMD is very easy to use. Just put your cmdtext here.
  dcmd(exit, 4, cmdtext);
  return 0;
}

//Then make sure your code is at bottom of script.

dcmd_enter(playerid, params[])
{
  #pragma unused params
 
  if(PlayerToPoint(3,playerid, 2049.48,2763.07,10.82)) // House Entramce. Where you set icon.
    {
      SetPlayerInterior(playerid, 12); // Sets Player to Interior 12
      SetPlayerPos(playerid, 2324.4199, -1145.5699, 1050.7101); // Spawn position inside
      return 1;
    }
   return 1;
}

dcmd_exit(playerid, params[])
{
  #pragma unused params

  if(PlayerToPoint(3 ,playerid, 2324.4199, -1145.5699, 1050.7101)) // House Exit
    {
      SetPlayerInterior(playerid, 0); // this is important..interior 0 is outside...
      SetPlayerPos(playerid, 2049.48, 2763.07, 10.82); // this is where player will stand...
      return 1;
    }
  return 1;
}

//If you want to change the commands back by all means do so. Take note of how the co-ordinates are setup as yours where wrong.
As I have stated before don't really do filterscripts but I tested this and it works. I really recommend you use dcmd mate but change back to old commands if you want. I would suggest you fix the errors in them first.
Reply


Messages In This Thread
Attempting to script my own house - by Mr. M - 07.02.2009, 12:23
Re: Attempting to script my own house - by Sandra18[NL] - 07.02.2009, 12:41
Re: Attempting to script my own house - by Mr. M - 07.02.2009, 12:48
Re: Attempting to script my own house - by pspleo - 07.02.2009, 12:55
Re: Attempting to script my own house - by Mr. M - 07.02.2009, 13:05
Re: Attempting to script my own house - by Auto-Sized - 07.02.2009, 14:28
Re: Attempting to script my own house - by Mr. M - 07.02.2009, 17:33
Re: Attempting to script my own house - by Auto-Sized - 07.02.2009, 20:32
Re: Attempting to script my own house - by Mr. M - 07.02.2009, 20:38
Re: Attempting to script my own house - by Auto-Sized - 07.02.2009, 22:24

Forum Jump:


Users browsing this thread: 6 Guest(s)