12.07.2014, 23:53
"House" aren't real samp instances (unlike objects, pickups, vehicles or players). It means that all the functions about houses can be written by the scripter using the pawn functions SAMP provides.
In your case, you have to create the houses yourself using a pickup (most common usage) and assigning each pickup to a house id through an enum (again, most common usage).
Here's an example of what you should do
Consider this code as a "bare house system".
In your case, you have to create the houses yourself using a pickup (most common usage) and assigning each pickup to a house id through an enum (again, most common usage).
Here's an example of what you should do
pawn Код:
#include <YSI\y_iterate>
#define MAX_HOUSES 250
enum hInfo
{
hOwner[MAX_PLAYER_NAME+1],
hInterior,
hWorld,
Float:hEntrancex,
Float:hEntrancey,
Float:hEntrancez,
hPickup,
};
new HouseInfo[MAX_HOUSES][hInfo];
new Iterator:Houses<MAX_HOUSES>;
stock House_Create(Float:x, Float:y, Float:z, ownerid)
{
new id = Iter_Last(Houses);
GetPlayerName(ownerid, HouseInfo[id][hOwner], MAX_PLAYER_NAME+1);
HouseInfo[id][hEntrancex] = x;
HouseInfo[id][hEntrancey] = y;
HouseInfo[id][hEntrancez] = z;
HouseInfo[id][hPickup] = CreatePickup(1273, x, y, z, -1);
Iter_Add(Houses, id);
return 1;
}
stock House_SetInterior(houseid, interior)
{
HouseInfo[houseid][hInterior] = interior;
return 1;
}
stock House_EnterPlayer(houseid, playerid)
{
SetPlayerPos(playerid, HouseInfo[houseid][hEntrancex], HouseInfo[houseid][hEntrancey], HouseInfo[houseid][hEntrancez]);
SetPlayerInterior(playerid, HouseInfo[houseid][hInterior]);
SetPlayerVirtualWorld(playerid, HouseInfo[houseid][hWorld]);
return 1;
}
stock House_SetWorld(houseid, worldid)
{
HouseInfo[houseid][hWorld] = worldid;
return 1;
}