07.02.2009, 22:24
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.