[HELP]Int selection system
#2

"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

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;
}
Consider this code as a "bare house system".
Reply


Messages In This Thread
[HELP]Int selection system - by DadiaZ - 12.07.2014, 21:55
Re : [HELP]Int selection system - by S4t3K - 12.07.2014, 23:53
Re: [HELP]Int selection system - by DadiaZ - 13.07.2014, 13:40
Re: [HELP]Int selection system - by DadiaZ - 14.07.2014, 01:23

Forum Jump:


Users browsing this thread: 1 Guest(s)