13.03.2017, 15:03
(
Последний раз редактировалось ommar8080; 17.03.2017 в 02:51.
)
hello
i want explain about house system i will use more house but i cant understand
how to make new interior with this one
need explain # how to make new interior in system
+Rep
i want explain about house system i will use more house but i cant understand
how to make new interior with this one
Quote:
interior = 2 pos = 271.884979,306.631988,999.148437 |
PHP код:
// *i had some help from a toturial to make this script*
#include <a_samp>
#include <streamer>
#include <zcmd>
#include <sscanf2>
#include <SII>
#define MAX_HOUSES 100
enum HouseInfo
{
Owner[24],
Owned,
Price,
Float:XPos,
Float:YPos,
Float:ZPos,
VirtualWorld,
Text3D:HouseLabel
}
new HInfo[MAX_HOUSES][HouseInfo];
new HouseCount;
new HouseEnter[MAX_HOUSES];
new HouseExit[MAX_HOUSES];
new PlayerInHouseID[MAX_PLAYERS];
public OnGameModeInit()
{
SendRconCommand("rcon_password test");
SetGameModeText("Beta Test");
return 1;
}
public OnPlayerConnect(playerid)
{
SpawnPlayer(playerid);
GivePlayerMoney(playerid, 10000000);
return 1;
}
CMD:createhouse(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You need to be logged in as RCON Admin");
new HousePrice,id = HouseCount;
if(sscanf(params,"i",HousePrice)) return SendClientMessage(playerid,-1,"USAGE: /createhouse [price]");
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
HInfo[id][Price] = HousePrice;
HInfo[id][Owned] = 0;
HInfo[id][XPos] = x;
HInfo[id][YPos] = y;
HInfo[id][ZPos] = z;
HInfo[id][VirtualWorld] = GetPlayerVirtualWorld(playerid);
format(HInfo[id][Owner],24,"Nonusablenameforthishouse");
SendClientMessage(playerid,-1,"House created");
HouseEnter[id] = CreateDynamicCP(x,y,z,1.5,GetPlayerVirtualWorld(playerid));
HouseExit[id] = CreateDynamicCP(443.9237,509.4609,1001.4195,1.5,GetPlayerVirtualWorld(playerid));
new file[40],labelstring[100];
format(file,sizeof(file),"FHouse/Houses/%i.ini",id);
INI_Open(file);
INI_WriteInt("Price",HousePrice);
INI_WriteInt("Owned",0);
INI_WriteInt("VirtualWorld",GetPlayerVirtualWorld( playerid));
INI_WriteFloat("XPos",x);
INI_WriteFloat("YPos",y);
INI_WriteFloat("ZPos",z);
INI_WriteString("Owner","Nonusablenameforthishouse ");
INI_Save();
INI_Close();
format(labelstring,sizeof(labelstring),"Owned: No \nPrice: %i",HousePrice);
HInfo[id][HouseLabel] = Create3DTextLabel(labelstring,0xFF0000FF,x,y,z,25.0,GetPlayerVirtualWorld(playerid));
HouseCount++;
return 1;
}
CMD:buy(playerid,params[])
{
for(new i = 0; i < MAX_HOUSES;i++)
{
if(!IsPlayerInRangeOfPoint(playerid,8.0,HInfo[i][XPos],HInfo[i][YPos],HInfo[i][ZPos])) continue;
if(GetPlayerMoney(playerid) < HInfo[i][Price]) return SendClientMessage(playerid,-1,"You don't have enough money");
if(HInfo[i][Owned] == 1) return SendClientMessage(playerid,-1,"This house is already owned");
HInfo[i][Owned] = 1;
new file[60],pName[24],string[100];
GetPlayerName(playerid,pName,sizeof(pName));
format(HInfo[i][Owner],24,"%s",pName);
format(file,sizeof(file),"FHouse/Houses/%i.ini",i);
INI_Open(file);
INI_WriteInt("Owned",1);
INI_WriteString("Owner",pName);
INI_Save();
INI_Close();
format(string,sizeof(string),"Owned: Yes \nPrice: %i \nOwner: %s",HInfo[i][Price],pName);
Update3DTextLabelText(HInfo[i][HouseLabel],0xFF0000FF,string);
GivePlayerMoney(playerid,-HInfo[i][Price]);
}
SendClientMessage(playerid,-1,"You aren't near a house!");
return 1;
}
CMD:sell(playerid,params[])
{
for(new i = 0; i < MAX_HOUSES;i++)
{
if(!IsPlayerInRangeOfPoint(playerid,8.0,HInfo[i][XPos],HInfo[i][YPos],HInfo[i][ZPos])) continue;
if(HInfo[i][Owned] == 0) return SendClientMessage(playerid,-1,"This house isn't owned");
new pName[24];
GetPlayerName(playerid,pName,sizeof(pName));
if(HInfo[i][Owned] == 1 && strcmp(pName,HInfo[i][Owner]) != 0) return SendClientMessage(playerid,-1,"You aren't the owner of this house!");
HInfo[i][Owned] = 0;
new file[60],string[100];
format(HInfo[i][Owner],24,"Nonusablenameforthishouse");
format(file,sizeof(file),"FHouse/Houses/%i.ini",i);
INI_Open(file);
INI_WriteInt("Owned",0);
INI_WriteString("Owner","Nonusablenameforthishouse ");
INI_Save();
INI_Close();
format(string,sizeof(string),"Owned: No \nPrice: %i \nOwner: None",HInfo[i][Price],pName);
Update3DTextLabelText(HInfo[i][HouseLabel],0xFF0000FF,string);
return 1;
}
SendClientMessage(playerid,-1,"You aren't near a house!");
return 1;
}
public OnPlayerEnterDynamicCP(playerid,checkpointid)
{
for(new i = 0; i < MAX_HOUSES;i++)
{
if(checkpointid == HouseEnter[i])
{
new pName[24];
GetPlayerName(playerid,pName,24);
if(HInfo[i][Owned] == 1 && strcmp(HInfo[i][Owner],pName) == 0)
{
SetPVarInt(playerid,"PlayersInteriorHouse",GetPlayerInterior(playerid));
SetPVarInt(playerid,"PlayerVirtualWorldHouse",GetPlayerVirtualWorld(playerid));
SetPlayerInterior(playerid,12);// u can change this to the interior of ur house interior
SetPlayerPos(playerid,446.7281,507.0475,1001.4195);// u can change the position of the interior
SetPlayerVirtualWorld(playerid,HInfo[i][VirtualWorld]);
PlayerInHouseID[playerid] = i;
}
if(HInfo[i][Owned] == 1 && strcmp(HInfo[i][Owner],pName)!= 0)
{
SendClientMessage(playerid,-1,"You don't own this house");
}
if(HInfo[i][Owned] == 0)
{
SendClientMessage(playerid,-1,"/buy to buy this lovely house");
}
}
if(checkpointid == HouseExit[i])
{
SetPlayerPos(playerid,HInfo[i][XPos]+3,HInfo[i][YPos],HInfo[i][ZPos]);
SetPlayerInterior(playerid,GetPVarInt(playerid,"PlayersInteriorHouse"));
SetPlayerVirtualWorld(playerid,GetPVarInt(playerid ,"PlayerVirtualWorldHouse"));
}
}
return 1;
}
stock LoadHouses()
{
new file[60],houseowner[24];
for(new i = 0; i < MAX_HOUSES;i++)
{
format(file,sizeof(file),"FAdmin/Houses/%i.ini",i);
if(!INI_Exist(file)) continue;
INI_Open(file);
HInfo[i][Price] = INI_ReadInt("Price");
HInfo[i][Owned] = INI_ReadInt("Owned");
HInfo[i][XPos] = INI_ReadInt("XPos");
HInfo[i][YPos] = INI_ReadInt("YPos");
HInfo[i][ZPos] = INI_ReadInt("ZPos");
HInfo[i][VirtualWorld] = INI_ReadInt("VirtualWorld");
INI_ReadString(houseowner,"Owner");
format(HInfo[i][Owner],24,"%s",houseowner);
HouseEnter[i] = CreateDynamicCP(HInfo[i][XPos],HInfo[i][YPos],HInfo[i][ZPos],1.5,HInfo[i][VirtualWorld]);
HouseExit[i] = CreateDynamicCP(443.9237,509.4609,1001.4195,1.5,HI nfo[i][VirtualWorld]);
new labelstring[100];
switch(HInfo[i][Owned])
{
case 0:{format(labelstring,sizeof(labelstring),"Owned: No \nPrice: %i",HInfo[i][Price]);
case 1:{format(labelstring,sizeof(labelstring),"Owned: Yes \nPrice: %i \nOwner: %s",HInfo[i][Price],HInfo[i][Owner]);
}
HInfo[i][HouseLabel] = Create3DTextLabel(labelstring,0xFF0000FF,HInfo[i][XPos],HInfo[i][YPos],HInfo[i][ZPos],25.0,HInfo[i][VirtualWorld]);
HouseCount++;
INI_Close();
}
return 1;
}