Hola eh buscado un FS de un sistema de casa pero me sale estos errores y no que se se son ayъdenme por favor....
Код:
//Version 1.0
//Owner can now choose a house to spawn in.
//User files now save in Houses/Users folder.
//Fixed some minor bugs.
#include <a_samp>
#include <dini>
#include <zcmd>
#include <streamer>
//|0 = Disable | 1 = Enable
#define HMESSAGES 1 //Enable House purchase/sell messages.
#define DABOX 9164
#define MAX_HOUSES 100
#define COLOR_BLUE 0x1C10EFFF
#define COLOR_RED 0xC93639FF
#define ADMINLINE IsPlayerAdmin(playerid)
new hfile[256];
new idfile[150];
new ufile[256];
new HEnterCP[MAX_HOUSES];
new HExitCP[MAX_HOUSES];
new Text3D:HLabel[MAX_HOUSES];
new HMarker[MAX_HOUSES];
public OnFilterScriptInit()
{
SetTimer("UpdateHouses", 15000, 1);
for(new i=0; i<TotalHouses(); i++)
{
DisableInteriorEnterExits();
format(hfile, sizeof(hfile), "/Houses/%d.ini", i);
new Float:ECPX; ECPX = dini_Float(hfile, "ECPX");
new Float:ECPY; ECPY = dini_Float(hfile, "ECPY");
new Float:ECPZ; ECPZ = dini_Float(hfile, "ECPZ");
new Float:ICPX; ICPX = dini_Float(hfile, "ICPX");
new Float:ICPY; ICPY = dini_Float(hfile, "ICPY");
new Float:ICPZ; ICPZ = dini_Float(hfile, "ICPZ");
new hname[256]; hname = dini_Get(hfile, "Name");
new hprice; hprice = dini_Int(hfile, "Price");
new howner[256]; howner = dini_Get(hfile, "Owner");
new hworld; hworld = dini_Int(hfile, "World");
new str[250]; format(str, sizeof(str), "Name: %s\nPrice: %d\nOwner: %s", hname, hprice, howner);
if(dini_Int(hfile, "CPSet") == 1) {
HEnterCP[i] = CreateDynamicCP(ECPX, ECPY, ECPZ, 1, -1, -1, -1, 25);
HExitCP[i] = CreateDynamicCP(ICPX, ICPY, ICPZ, 1, hworld, -1, -1, 25);
HLabel[i] = CreateDynamic3DTextLabel(str, COLOR_BLUE, ECPX, ECPY, ECPZ+1, 40, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 40.0);
HMarker[i] = CreateDynamicMapIcon(ECPX, ECPY, ECPZ, 31, 0, -1, -1, -1, 45);
}
}
return 1;
}
public OnFilterScriptExit()
{
DestroyAllDynamicCPs();
DestroyAllDynamic3DTextLabels();
DestroyAllDynamicMapIcons();
}
CMD:hcreate(playerid, params[]) {
format(idfile, sizeof(idfile), "/Houses/ids.ini");
if(IsEditing(playerid) == 1) return SendClientMessage(playerid, COLOR_RED, "You are already editing a house!");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
if(!dini_Exists(idfile)) dini_Create(idfile), dini_IntSet(idfile, "ID", 0);
else dini_IntSet(idfile, "ID", dini_Int(idfile, "ID")+1);
new str[128];
format(hfile, sizeof(hfile), "/Houses/%d.ini", dini_Int(idfile, "ID"));
dini_Create(hfile);
SetPVarInt(playerid, "EditID", dini_Int(idfile, "ID"));
SetPVarInt(playerid, "Editing", 1);
format(str, sizeof(str), "You are now editing House [ID:%d]", dini_Int(idfile, "ID"));
SendClientMessage(playerid, COLOR_BLUE, str);
ShowPlayerDialog(playerid, DABOX, DIALOG_STYLE_LIST, "House Edit - Menu", "Entrance Checkpoint\nExit Checkpoint\nSet Enter Coords\nSet Exit Coords\nSet House Name\nSet House Price\nTeleport\nSet Virtual World\nSet Spawn Position", "Ok", "Cancel");
return 1;
}
CMD:hedit(playerid, params[]) {
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You have not yet created a house!");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
ShowPlayerDialog(playerid, DABOX, DIALOG_STYLE_LIST, "House Edit - Menu", "Entrance Checkpoint\nExit Checkpoint\nSet Enter Coords\nSet Exit Coords\nSet House Name\nSet House Price\nTeleport\nSet Virtual World\nSet Spawn Position", "Ok", "Cancel");
return 1;
}
CMD:hsetcp(playerid, params[]) {
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(hfile, "ECPX", X);
dini_FloatSet(hfile, "ECPY", Y);
dini_FloatSet(hfile, "ECPZ", Z);
dini_IntSet(hfile, "CPSet", 1);
DestroyDynamicMapIcon(HMarker[GetPlayerHouseID(playerid)]);
DestroyDynamicCP(HEnterCP[GetPlayerHouseID(playerid)]);
HEnterCP[GetPlayerHouseID(playerid)] = CreateDynamicCP(X, Y, Z, 1, -1, -1, -1, 25);
HMarker[GetPlayerHouseID(playerid)] = CreateDynamicMapIcon(X, Y, Z, 31, 0, -1, -1, -1, 45);
new str[128];
format(str, sizeof(str), "House [ID:%d]'s enter checkpoint has been set to - X: %f, Y: %f, Z: %f.", GetPlayerHouseID(playerid), X, Y, Z);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Enter CP", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
return 1;
}
CMD:hsetenterpos(playerid, params[]) {
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(hfile, "ENTX", X);
dini_FloatSet(hfile, "ENTY", Y);
dini_FloatSet(hfile, "ENTZ", Z);
dini_IntSet(hfile, "Interior", GetPlayerInterior(playerid));
new str[128];
format(str, sizeof(str), "House [ID:%d]'s enter position has been set to - X: %f, Y: %f, Z: %f [Interior:%d]", GetPlayerHouseID(playerid), X, Y, Z, GetPlayerInterior(playerid));
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Enter Coords", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
return 1;
}
CMD:hsetexitpos(playerid, params[]) {
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(hfile, "EXITX", X);
dini_FloatSet(hfile, "EXITY", Y);
dini_FloatSet(hfile, "EXITZ", Z);
dini_IntSet(hfile, "Interior2", GetPlayerInterior(playerid));
new str[128];
format(str, sizeof(str), "House [ID:%d] exit position has been set to - X: %f, Y: %f, Z: %f.", GetPlayerHouseID(playerid), X, Y, Z);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Exit Coords", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
return 1;
}
CMD:hsetspawnpos(playerid, params[]) {
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(hfile, "SPAWNX", X);
dini_FloatSet(hfile, "SPAWNY", Y);
dini_FloatSet(hfile, "SPAWNZ", Z);
dini_IntSet(hfile, "Interior", GetPlayerInterior(playerid));
new str[128];
format(str, sizeof(str), "House [ID:%d]'s spawn position has been set to - X: %f, Y: %f, Z: %f [Interior:%d]", GetPlayerHouseID(playerid), X, Y, Z, GetPlayerInterior(playerid));
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Spawn Position", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
return 1;
}
CMD:hsetintcp(playerid, params[]) {
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(hfile, "ICPX", X);
dini_FloatSet(hfile, "ICPY", Y);
dini_FloatSet(hfile, "ICPZ", Z);
new hworld; hworld = dini_Int(hfile, "World");
DestroyDynamicCP(HExitCP[GetPlayerHouseID(playerid)]);
HExitCP[GetPlayerHouseID(playerid)] = CreateDynamicCP(X, Y, Z, 1, hworld, -1, -1, 25);
new str[128];
format(str, sizeof(str), "House [ID:%d] exit checkpoint has been set to - X: %f, Y: %f, Z: %f.", GetPlayerHouseID(playerid), X, Y, Z);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Exit CP", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
return 1;
}
CMD:hsetname(playerid, params[]) {
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: '/hsetname <name>'");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
new hname[128];
sscanf(params, "s", hname);
dini_Set(hfile, "Name", hname);
new Float:ECPX; ECPX = dini_Float(hfile, "ECPX");
new Float:ECPY; ECPY = dini_Float(hfile, "ECPY");
new Float:ECPZ; ECPZ = dini_Float(hfile, "ECPZ");
new hprice; hprice = dini_Int(hfile, "Price");
new howner[256]; howner = dini_Get(hfile, "Owner");
new str[250]; format(str, sizeof(str), "Name: %s\nPrice: %d\nOwner: %s", hname, hprice, howner);
DestroyDynamic3DTextLabel(HLabel[GetPlayerHouseID(playerid)]);
HLabel[GetPlayerHouseID(playerid)] = CreateDynamic3DTextLabel(str, COLOR_BLUE, ECPX, ECPY, ECPZ+1, 40, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 40.0);
format(str, sizeof(str), "House [ID:%d] name is now '%s'!", GetPlayerHouseID(playerid), hname);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Set Name", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
return 1;
}
CMD:hsetworld(playerid, params[]) {
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: '/hsetworld <worldid>'");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
new hworld;
sscanf(params, "i", hworld);
dini_IntSet(hfile, "World", hworld);
new str[128];
format(str, sizeof(str), "House [ID:%d]'s virtual world is now '%d'!", GetPlayerHouseID(playerid), hworld);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Set World", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
return 1;
}
CMD:hsetprice(playerid, params[]) {
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: '/hsetprice <price>'");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
new hprice;
sscanf(params, "i", hprice);
dini_IntSet(hfile, "Price", hprice);
new Float:ECPX; ECPX = dini_Float(hfile, "ECPX");
new Float:ECPY; ECPY = dini_Float(hfile, "ECPY");
new Float:ECPZ; ECPZ = dini_Float(hfile, "ECPZ");
new howner[256]; howner = dini_Get(hfile, "Owner");
new hname[256]; hname = dini_Get(hfile, "Name");
new str[250]; format(str, sizeof(str), "Name: %s\nPrice: %d\nOwner: %s", hname, hprice, howner);
DestroyDynamic3DTextLabel(HLabel[GetPlayerHouseID(playerid)]);
HLabel[GetPlayerHouseID(playerid)] = CreateDynamic3DTextLabel(str, COLOR_BLUE, ECPX, ECPY, ECPZ+1, 40, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 40.0);
format(str, sizeof(str), "House [ID:%d]'s price is now '%d'!", GetPlayerHouseID(playerid), hprice);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Set Price", str, "Ok", "Exit");
SendClientMessage(playerid, COLOR_BLUE, str);
return 1;
}
CMD:hcancel(playerid, params[]) {
format(idfile, sizeof(idfile), "/Houses/ids.ini");
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not currently editing a house!");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
DestroyDynamicCP(HExitCP[GetPlayerHouseID(playerid)]);
DestroyDynamicCP(HEnterCP[GetPlayerHouseID(playerid)]);
DestroyDynamic3DTextLabel(HLabel[GetPlayerHouseID(playerid)]);
DestroyDynamicMapIcon(HMarker[GetPlayerHouseID(playerid)]);
dini_Remove(hfile);
dini_IntSet(idfile, "ID", dini_Int(idfile, "ID")-1);
SetPVarInt(playerid, "EditID", -1);
SetPVarInt(playerid, "Editing", 0);
SendClientMessage(playerid, COLOR_BLUE, "You have canceled the current house editing!");
return 1;
}
CMD:hdone(playerid, params[]) {
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not currently editing a house!");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
new str[50];
format(str, sizeof(str), "You have finished editing House [ID:%d]!", GetPlayerHouseID(playerid));
SendClientMessage(playerid, COLOR_BLUE, str);
SetPVarInt(playerid, "EditID", -1);
SetPVarInt(playerid, "Editing", 0);
return 1;
}
CMD:hopen(playerid, params[]) {
if(IsEditing(playerid) == 1) return SendClientMessage(playerid, COLOR_RED, "You are already editing a house!");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
new hid;
sscanf(params, "i", hid);
format(hfile, sizeof(hfile), "/Houses/%d.ini", hid);
if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: '/hopen <houseid>'");
if(!dini_Exists(hfile)) return SendClientMessage(playerid, COLOR_RED, "ERROR: That house id does not exist!");
SetPVarInt(playerid, "EditID", hid);
SetPVarInt(playerid, "Editing", 1);
new str[50];
format(str, sizeof(str), "You are now editing House [ID:%d]", hid);
SendClientMessage(playerid, COLOR_BLUE, str);
ShowPlayerDialog(playerid, DABOX, DIALOG_STYLE_LIST, "House Edit - Menu", "Entrance Checkpoint\nExit Checkpoint\nSet Enter Coords\nSet Exit Coords\nSet House Name\nSet House Price\nTeleport\nSet Virtual World\nSet Spawn Position", "Ok", "Cancel");
return 1;
}
CMD:hgoto(playerid, params[]) {
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: '/hgoto [enter/exit]'");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
if(strcmp(params,"enter",true) == 0) {
new Float:X; X = dini_Float(hfile, "ENTX");
new Float:Y; Y = dini_Float(hfile, "ENTY");
new Float:Z; Z = dini_Float(hfile, "ENTZ");
new Interior; Interior = dini_Int(hfile, "Interior");
new hworld; hworld = dini_Int(hfile, "World");
SetPlayerAt(playerid, X, Y, Z, Interior, hworld);
SendClientMessage(playerid, COLOR_BLUE, "Teleported to entrance coords.");
}
else if(strcmp(params, "exit", true) == 0) {
new Float:X; X = dini_Float(hfile, "EXITX");
new Float:Y; Y = dini_Float(hfile, "EXITY");
new Float:Z; Z = dini_Float(hfile, "EXITZ");
new Interior2 = dini_Int(hfile, "Interior2");
SetPlayerAt(playerid, X, Y, Z, Interior2, 0);
SendClientMessage(playerid, COLOR_BLUE, "Teleported to exit coords.");
}
else {
SendClientMessage(playerid, COLOR_BLUE, "USAGE: '/hgoto [enter/exit]'");
}
return 1;
}
CMD:hdelete(playerid, params[]) {
new hid;
sscanf(params, "i", hid);
format(hfile, sizeof(hfile), "/Houses/%d.ini", hid);
if(!dini_Exists(hfile)) return SendClientMessage(playerid, COLOR_RED, "ERROR: That house id does not exist!");
if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: '/hdelete <houseid>'");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
if(hid == GetPlayerHouseID(playerid))
{
SetPVarInt(playerid, "EditID", hid);
SetPVarInt(playerid, "Editing", 1);
}
new str[50];
format(str, sizeof(str), "You have deleted House [ID:%d]", hid);
SendClientMessage(playerid, COLOR_BLUE, str);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Delete", str, "Ok", "Exit");
return 1;
}
CMD:hdebug(playerid, params[]) {
new hid;
sscanf(params, "i", hid);
if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "You must enter a house ID.");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
format(idfile, sizeof(idfile), "/Houses/ids.ini");
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
new id; id = dini_Int(idfile, "ID");
new thouses; thouses = TotalHouses();
new str[128];
format(str, sizeof(str), "ID File: %d\nTotal Houses: %d\n", id, thouses);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Debug", str, "", "Exit");
return 1;
}
CMD:hinfo(playerid, params[]) {
new hid;
sscanf(params, "i", hid);
format(hfile, sizeof(hfile), "/Houses/%d.ini", hid);
if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "You must enter a house ID.");
if(!dini_Exists(hfile)) return SendClientMessage(playerid, COLOR_RED, "This House ID does not exist!");
if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
new hname[256]; hname = dini_Get(hfile, "Name");
new hprice; hprice = dini_Int(hfile, "Price");
new Interior; Interior = dini_Int(hfile, "Interior");
new howner[256]; howner = dini_Get(hfile, "Owner");
new hworld; hworld = dini_Int(hfile, "World");
new str[128];
format(str, sizeof(str), "House Name: %s\nOwner: %s\nPrice: %d\nInterior: %d\nVirtual World: %d", hname, howner, hprice, Interior, hworld);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Info", str, "", "Exit");
return 1;
}
CMD:hcmds(playerid, params[]) {
if(ADMINLINE) ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Commands", "/hdelete <houseid>\n/hgoto <entercp/exitcp>\nhopen <houseid>\n/hdone\n/hcancel\n/hsetprice\n/hsetname\n/hsetintcp\n/hsetcp\n/hsetexitpos\n/hsetenterpos\n/hsetspawnpos\n/hedit\n/hcreate\n/hdebug\n/hinfo <houseid>\n", "", "Exit");
else if(!ADMINLINE) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
return 1;
}
public OnPlayerConnect(playerid)
{
format(ufile, sizeof(ufile), "/Houses/Users/%s.ini", pName(playerid));
if(!dini_Exists(ufile)) AddUser(playerid);
return 1;
}
public OnPlayerSpawn(playerid)
{
format(ufile, sizeof(ufile), "/Houses/Users/%s.ini", pName(playerid));
if(dini_Int(ufile, "SpawnOpt") == 1)
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", dini_Int(ufile, "SpawnID"));
new howner[256]; howner = dini_Get(hfile, "Owner");
new nigname[MAX_PLAYER_NAME]; nigname = pName(playerid);
if(strfind(howner, nigname, true) == -1)
{
dini_IntSet(ufile, "SpawnOpt", 0);
dini_IntSet(ufile, "SpawnID", -1);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Spawn", "You will no longer spawn in this house!", "Ok", "");
return 1;
}
SetPVarInt(playerid, "SpawnTimer", SetTimerEx("SetHouseSpawn", 1250, false, "i", playerid));
}
return 1;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
for(new x=0; x<TotalHouses(); x++)
{
if(checkpointid == HEnterCP[x])
{
if(IsEditing(playerid) == 1) return 1;
SetPVarInt(playerid, "EntID", x);
ShowPlayerDialog(playerid, DABOX+2, DIALOG_STYLE_LIST, "House Menu", "Enter House\nPurchase House\nSet Password\nSell House\nSet Spawn", "Ok", "Cancel");
}
else if(checkpointid == HExitCP[x])
{
if(IsEditing(playerid) == 1) return 1;
format(hfile, sizeof(hfile), "/Houses/%d.ini", x);
new Float:EXITX; EXITX = dini_Float(hfile, "EXITX");
new Float:EXITY; EXITY = dini_Float(hfile, "EXITY");
new Float:EXITZ; EXITZ = dini_Float(hfile, "EXITZ");
new Interior2; Interior2 = dini_Int(hfile, "Interior2");
SetPlayerAt(playerid, EXITX, EXITY, EXITZ, Interior2, 0);
SetPVarInt(playerid, "EntID", -1);
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DABOX)
{
if(response)
{
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
switch(listitem)
{
case 0:
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(hfile, "ECPX", X);
dini_FloatSet(hfile, "ECPY", Y);
dini_FloatSet(hfile, "ECPZ", Z);
dini_IntSet(hfile, "CPSet", 1);
DestroyDynamicMapIcon(HMarker[GetPlayerHouseID(playerid)]);
DestroyDynamicCP(HEnterCP[GetPlayerHouseID(playerid)]);
HEnterCP[GetPlayerHouseID(playerid)] = CreateDynamicCP(X, Y, Z, 1, -1, -1, -1, 25);
HMarker[GetPlayerHouseID(playerid)] = CreateDynamicMapIcon(X, Y, Z, 31, 0, -1, -1, -1, 45);
new str[128];
format(str, sizeof(str), "House [ID:%d] enter checkpoint has been set to\n X: %f, Y: %f, Z: %f.", GetPlayerHouseID(playerid), X, Y, Z);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Enter CP", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
}
case 1:
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(hfile, "ICPX", X);
dini_FloatSet(hfile, "ICPY", Y);
dini_FloatSet(hfile, "ICPZ", Z);
new hworld; hworld = dini_Int(hfile, "World");
DestroyDynamicCP(HExitCP[GetPlayerHouseID(playerid)]);
HExitCP[GetPlayerHouseID(playerid)] = CreateDynamicCP(X, Y, Z, 1, hworld, -1, -1, 25);
new str[128];
format(str, sizeof(str), "House [ID:%d] exit checkpoint has been set to -\n X: %f, Y: %f, Z: %f.", GetPlayerHouseID(playerid), X, Y, Z);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Exit CP", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
}
case 2:
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(hfile, "ENTX", X);
dini_FloatSet(hfile, "ENTY", Y);
dini_FloatSet(hfile, "ENTZ", Z);
dini_IntSet(hfile, "Interior", GetPlayerInterior(playerid));
new str[128];
format(str, sizeof(str), "House [ID:%d] enter position has been set to -\n X: %f, Y: %f, Z: %f [Interior:%d]", GetPlayerHouseID(playerid), X, Y, Z, GetPlayerInterior(playerid));
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Enter Position", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
}
case 3:
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(hfile, "EXITX", X);
dini_FloatSet(hfile, "EXITY", Y);
dini_FloatSet(hfile, "EXITZ", Z);
dini_IntSet(hfile, "Interior2", GetPlayerInterior(playerid));
new str[128];
format(str, sizeof(str), "House [ID:%d] exit position has been set to -\n X: %f, Y: %f, Z: %f.", GetPlayerHouseID(playerid), X, Y, Z);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Exit Position", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
}
case 4:
{
ShowPlayerDialog(playerid, DABOX+1, DIALOG_STYLE_INPUT, "House Edit - Set House Name", "Type in the name you would like for your house.", "Ok", "Cancel");
}
case 5:
{
ShowPlayerDialog(playerid, DABOX+3, DIALOG_STYLE_INPUT, "House Edit - Set House Price", "Type in the price you would like for your house.", "Ok", "Cancel");
}
case 6:
{
ShowPlayerDialog(playerid, DABOX+6, DIALOG_STYLE_LIST, "House - Teleport", "Tele to Enter CP\nTele to Exit CP", "Ok", "Cancel");
}
case 7:
{
ShowPlayerDialog(playerid, DABOX+7, DIALOG_STYLE_INPUT, "House Edit - Set World", "Type in the virtual world you would like.", "Ok", "Cancel");
}
case 8:
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(hfile, "SPAWNX", X);
dini_FloatSet(hfile, "SPAWNY", Y);
dini_FloatSet(hfile, "SPAWNZ", Z);
dini_IntSet(hfile, "Interior", GetPlayerInterior(playerid));
new str[128];
format(str, sizeof(str), "House [ID:%d]'s spawn position has been set to - X: %f, Y: %f, Z: %f [Interior:%d]", GetPlayerHouseID(playerid), X, Y, Z, GetPlayerInterior(playerid));
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Spawn Position", str, "Ok", "Cancel");
SendClientMessage(playerid, COLOR_BLUE, str);
}
}
}
return 1;
}
if(dialogid == DABOX+1)
{
if(response)
{
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!strlen(inputtext)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must enter a house name below!");
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
new aname[128];
format(aname, sizeof(aname), "%s", inputtext);
dini_Set(hfile, "Name", aname);
new Float:ECPX; ECPX = dini_Float(hfile, "ECPX");
new Float:ECPY; ECPY = dini_Float(hfile, "ECPY");
new Float:ECPZ; ECPZ = dini_Float(hfile, "ECPZ");
new hprice; hprice = dini_Int(hfile, "Price");
new howner[256]; howner = dini_Get(hfile, "Owner");
new str[250]; format(str, sizeof(str), "Name: %s\nPrice: %d\nOwner: %s", aname, hprice, howner);
DestroyDynamic3DTextLabel(HLabel[GetPlayerHouseID(playerid)]);
HLabel[GetPlayerHouseID(playerid)] = CreateDynamic3DTextLabel(str, COLOR_BLUE, ECPX, ECPY, ECPZ+1, 40, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 40.0);
format(str, sizeof(str), "House [ID:%d]'s name is now '%s'!", GetPlayerHouseID(playerid), aname);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Set Name", str, "Ok", "Cancel");
}
}
return 1;
}
if(dialogid == DABOX+2)
{
if(response)
{
switch(listitem)
{
case 0:
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetEntID(playerid));
new howner[256]; howner = dini_Get(hfile, "Owner");
new nigname[MAX_PLAYER_NAME]; nigname = pName(playerid);
if(dini_Int(hfile, "PassSet") == 1 && strfind(howner, nigname, true) == -1)
{
ShowPlayerDialog(playerid, DABOX+5, DIALOG_STYLE_INPUT, "House - Password", "Type in the password for this house to enter.", "Ok", "Cancel");
return 1;
}
new Float:ENTX; ENTX = dini_Float(hfile, "ENTX");
new Float:ENTY; ENTY = dini_Float(hfile, "ENTY");
new Float:ENTZ; ENTZ = dini_Float(hfile, "ENTZ");
new Interior = dini_Int(hfile, "Interior");
new hworld; hworld = dini_Int(hfile, "World");
SetPlayerAt(playerid, ENTX, ENTY, ENTZ, Interior, hworld);
}
case 1:
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetEntID(playerid));
new nigname[MAX_PLAYER_NAME]; nigname = pName(playerid);
new hprice; hprice = dini_Int(hfile, "Price");
new howner[256]; howner = dini_Get(hfile, "Owner");
new hname[256]; hname = dini_Get(hfile, "Name");
if(GetPlayerMoney(playerid) < hprice) return ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Purchase", "You do not have enough money to purchase\nthis house!", "Ok", "");
if(strfind(howner, nigname, true) != -1) return ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Purchase", "You already own this house!", "Ok", "");
dini_Set(hfile, "Owner", pName(playerid));
GivePlayerMoney(playerid, -hprice);
PlayerPlaySound(playerid, 1058, 0, 0, 0);
PlayerPlaySound(playerid, 1149, 0, 0, 0);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Purchase", "You have successfully purchased this house!", "", "Exit");
#if HMESSAGES == 1
new str[128];
format(str, sizeof(str), "%s purchased the House '%s' [ID:%d] for $%d!", pName(playerid), hname, GetEntID(playerid), hprice);
SendClientMessageToAll(COLOR_BLUE, str);
#endif
}
case 2:
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetEntID(playerid));
new howner[256]; howner = dini_Get(hfile, "Owner");
new nigname[MAX_PLAYER_NAME]; nigname = pName(playerid);
if(strfind(howner, nigname, true) == -1) return ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Options", "You are not the owner of this house!", "Ok", "");
ShowPlayerDialog(playerid, DABOX+4, DIALOG_STYLE_INPUT, "House - Set Password", "Type in a password you would like for your house.", "Ok", "Cancel");
}
case 3:
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetEntID(playerid));
new howner[256]; howner = dini_Get(hfile, "Owner");
new nigname[MAX_PLAYER_NAME]; nigname = pName(playerid);
if(strfind(howner, nigname, true) == -1) return ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Options", "You are not the owner of this house!", "Ok", "");
ShowPlayerDialog(playerid, DABOX+8, DIALOG_STYLE_INPUT, "House - Sell House", "Are you sure you want to sell this house?\nType Yes or No", "Ok", "Cancel");
}
case 4:
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetEntID(playerid));
new howner[256]; howner = dini_Get(hfile, "Owner");
new nigname[MAX_PLAYER_NAME]; nigname = pName(playerid);
if(strfind(howner, nigname, true) == -1) return ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Options", "You are not the owner of this house!", "Ok", "");
ShowPlayerDialog(playerid, DABOX+9, DIALOG_STYLE_INPUT, "House - Spawn", "Are you sure you want to spawn in this house?\nType Yes or No", "Ok", "Cancel");
}
}
}
return 1;
}
if(dialogid == DABOX+3)
{
if(response)
{
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!strlen(inputtext)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must enter a price below!");
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
new hprice;
sscanf(inputtext, "i", hprice);
dini_IntSet(hfile, "Price", hprice);
new Float:ECPX; ECPX = dini_Float(hfile, "ECPX");
new Float:ECPY; ECPY = dini_Float(hfile, "ECPY");
new Float:ECPZ; ECPZ = dini_Float(hfile, "ECPZ");
new howner[256]; howner = dini_Get(hfile, "Owner");
new hname[256]; hname = dini_Get(hfile, "Name");
new str[250]; format(str, sizeof(str), "Name: %s\nPrice: %d\nOwner: %s", hname, hprice, howner);
DestroyDynamic3DTextLabel(HLabel[GetPlayerHouseID(playerid)]);
HLabel[GetPlayerHouseID(playerid)] = CreateDynamic3DTextLabel(str, COLOR_BLUE, ECPX, ECPY, ECPZ+1, 40, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 40.0);
format(str, sizeof(str), "House [ID:%d]'s price is now '%d'!", GetPlayerHouseID(playerid), hprice);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Set Price", str, "Ok", "");
}
}
return 1;
}
if(dialogid == DABOX+4)
{
if(response)
{
if(!strlen(inputtext)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must enter a price below!");
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetEntID(playerid));
new hpass[128];
sscanf(inputtext, "s", hpass);
dini_Set(hfile, "Password", hpass);
dini_IntSet(hfile, "PassSet", 1);
new str[128];
format(str, sizeof(str), "The password for House [ID:%d] is now '%s'!", GetEntID(playerid), hpass);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Options - Set Password", str, "Ok", "");
}
}
return 1;
}
if(dialogid == DABOX+5)
{
if(response)
{
if(!strlen(inputtext)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must enter a password below!");
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetEntID(playerid));
new hpass[128];
sscanf(inputtext, "s", hpass);
new matchpass[256]; matchpass = dini_Get(hfile, "Password");
if(strfind(matchpass, hpass, true) == -1) return ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Password", "Incorrect password...", "Ok", "");
else {
new Float:ENTX; ENTX = dini_Float(hfile, "ENTX");
new Float:ENTY; ENTY = dini_Float(hfile, "ENTY");
new Float:ENTZ; ENTZ = dini_Float(hfile, "ENTZ");
new Interior = dini_Int(hfile, "Interior");
new hworld = dini_Int(hfile, "World");
SetPlayerAt(playerid, ENTX, ENTY, ENTZ, Interior, hworld);
}
}
}
return 1;
}
if(dialogid == DABOX+6)
{
if(response)
{
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
switch(listitem)
{
case 0:
{
new Float:X; X = dini_Float(hfile, "ENTX");
new Float:Y; Y = dini_Float(hfile, "ENTY");
new Float:Z; Z = dini_Float(hfile, "ENTZ");
new Interior; Interior = dini_Int(hfile, "Interior");
new hworld; hworld = dini_Int(hfile, "World");
SetPlayerAt(playerid, X, Y, Z, Interior, hworld);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Enter CP", "Successfully teleported to entrance coords.", "Ok", "");
}
case 1:
{
new Float:X; X = dini_Float(hfile, "EXITX");
new Float:Y; Y = dini_Float(hfile, "EXITY");
new Float:Z; Z = dini_Float(hfile, "EXITZ");
new Interior2; Interior2 = dini_Int(hfile, "Interior2");
SetPlayerAt(playerid, X, Y, Z, Interior2, 0);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Exit CP", "Successfully teleported to exit coords.", "Ok", "");
}
}
}
return 1;
}
if(dialogid == DABOX+7)
{
if(response)
{
if(IsEditing(playerid) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not editing a house!");
if(!strlen(inputtext)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must enter a price below!");
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetPlayerHouseID(playerid));
new hworld;
sscanf(inputtext, "i", hworld);
dini_IntSet(hfile, "World", hworld);
SetPlayerVirtualWorld(playerid, hworld);
new str[128];
format(str, sizeof(str), "House [ID:%d]'s virtual world is now '%d'!", GetPlayerHouseID(playerid), hworld);
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House Edit - Set World", str, "Ok", "");
}
}
return 1;
}
if(dialogid == DABOX+8)
{
if(response)
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetEntID(playerid));
new howner[256]; howner = dini_Get(hfile, "Owner");
new nigname[MAX_PLAYER_NAME]; nigname = pName(playerid);
if(strfind(howner, nigname, true) == -1) return ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Options", "You are not the owner of this house!", "Ok", "");
if(strfind(inputtext,"Yes",true) == 0)
{
new hprice; hprice = dini_Int(hfile, "Price");
new hname[256]; hname = dini_Get(hfile, "Name");
dini_Set(hfile, "Owner", "None");
GivePlayerMoney(playerid, hprice);
#if HMESSAGES == 1
new str[128];
format(str, sizeof(str), "%s sold the House '%s' [ID:%d] [Price: %d]!", pName(playerid), hname, GetEntID(playerid), hprice);
SendClientMessageToAll(COLOR_BLUE, str);
#endif
}
else if(strfind(inputtext,"No",true) == 0)
{
SendClientMessage(playerid, COLOR_RED, "You decided not to sell your house...");
}
}
return 1;
}
if(dialogid == DABOX+9)
{
if(response)
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetEntID(playerid));
format(ufile, sizeof(ufile), "/Houses/Users/%s.ini", pName(playerid));
if(!dini_Exists(ufile)) AddUser(playerid);
new howner[256]; howner = dini_Get(hfile, "Owner");
new nigname[MAX_PLAYER_NAME]; nigname = pName(playerid);
if(strfind(howner, nigname, true) == -1) return ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Options", "You are not the owner of this house!", "Ok", "");
if(strfind(inputtext,"Yes",true) == 0)
{
dini_IntSet(ufile, "SpawnOpt", 1);
dini_IntSet(ufile, "SpawnID", GetEntID(playerid));
SendClientMessage(playerid, COLOR_BLUE, "You will now spawn in this house when you die!");
}
else if(strfind(inputtext,"No",true) == 0)
{
SendClientMessage(playerid, COLOR_RED, "You decided not to spawn in this house...");
}
}
return 1;
}
return 0;
}
stock pName(playerid)
{
new gName[MAX_PLAYER_NAME];
GetPlayerName(playerid, gName, sizeof(gName));
return gName;
}
stock IsEditing(playerid)
{
return GetPVarInt(playerid, "Editing");
}
stock GetPlayerHouseID(playerid)
{
return GetPVarInt(playerid, "EditID");
}
stock GetEntID(playerid)
{
return GetPVarInt(playerid, "EntID");
}
stock TotalHouses()
{
new tehcount;
for(new i=0; i<MAX_HOUSES; i++)
{
format(hfile, sizeof(hfile), "/Houses/%d.ini", i);
if(dini_Exists(hfile)) tehcount++;
}
return tehcount;
}
forward UpdateHouses();
public UpdateHouses()
{
for(new i=0; i<TotalHouses(); i++)
{
DisableInteriorEnterExits();
format(hfile, sizeof(hfile), "/Houses/%d.ini", i);
new Float:ECPX; ECPX = dini_Float(hfile, "ECPX");
new Float:ECPY; ECPY = dini_Float(hfile, "ECPY");
new Float:ECPZ; ECPZ = dini_Float(hfile, "ECPZ");
new Float:ICPX; ICPX = dini_Float(hfile, "ICPX");
new Float:ICPY; ICPY = dini_Float(hfile, "ICPY");
new Float:ICPZ; ICPZ = dini_Float(hfile, "ICPZ");
new hname[256]; hname = dini_Get(hfile, "Name");
new hprice; hprice = dini_Int(hfile, "Price");
new howner[256]; howner = dini_Get(hfile, "Owner");
new hworld; hworld = dini_Int(hfile, "World");
new str[250]; format(str, sizeof(str), "Name: %s\nPrice: %d\nOwner: %s", hname, hprice, howner);
DestroyDynamicMapIcon(HMarker[i]);
DestroyDynamicCP(HEnterCP[i]);
DestroyDynamicCP(HExitCP[i]);
DestroyDynamic3DTextLabel(HLabel[i]);
if(dini_Int(hfile, "CPSet") == 1) {
HEnterCP[i] = CreateDynamicCP(ECPX, ECPY, ECPZ, 1, -1, -1, -1, 25);
HExitCP[i] = CreateDynamicCP(ICPX, ICPY, ICPZ, 1, hworld, -1, -1, 25);
HLabel[i] = CreateDynamic3DTextLabel(str, COLOR_BLUE, ECPX, ECPY, ECPZ+1, 40, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 40.0);
HMarker[i] = CreateDynamicMapIcon(ECPX, ECPY, ECPZ, 31, 0, -1, -1, -1, 45);
}
}
return 1;
}
stock SetPlayerAt(playerid, Float:X, Float:Y, Float:Z, interiorid, virtualworld)
{
SetPlayerPos(playerid, X, Y, Z);
SetPlayerInterior(playerid, interiorid);
SetPlayerVirtualWorld(playerid, virtualworld);
return 1;
}
stock AddUser(playerid)
{
format(ufile, sizeof(ufile), "/Houses/Users/%s.ini", pName(playerid));
dini_Create(ufile);
dini_IntSet(ufile, "SpawnOpt", 0);
dini_IntSet(ufile, "SpawnID", -1);
return 1;
}
forward SetHouseSpawn(playerid);
public SetHouseSpawn(playerid)
{
KillTimer(GetPVarInt(playerid, "SpawnTimer"));
format(ufile, sizeof(ufile), "/Houses/Users/%s.ini", pName(playerid));
format(hfile, sizeof(hfile), "/Houses/%d.ini", dini_Int(ufile, "SpawnID"));
new Float:SPAWNX; SPAWNX = dini_Float(hfile, "SPAWNX");
new Float:SPAWNY; SPAWNY = dini_Float(hfile, "SPAWNY");
new Float:SPAWNZ; SPAWNZ = dini_Float(hfile, "SPAWNZ");
new hint = dini_Int(hfile, "Interior");
new hworld = dini_Int(hfile, "World");
SetPlayerAt(playerid, SPAWNX, SPAWNY, SPAWNZ, hint, hworld);
return 1;
}
stock sscanf(string[], format[], {Float,_}:...)
{
#if defined isnull
if (isnull(string))
#else
if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
#endif
{
return format[0];
}
#pragma tabsize 4
new
formatPos = 0,
stringPos = 0,
paramPos = 2,
paramCount = numargs(),
delim = ' ';
while (string[stringPos] && string[stringPos] <= ' ')
{
stringPos++;
}
while (paramPos < paramCount && string[stringPos])
{
switch (format[formatPos++])
{
case '\0':
{
return 0;
}
case 'i', 'd':
{
new
neg = 1,
num = 0,
ch = string[stringPos];
if (ch == '-')
{
neg = -1;
ch = string[++stringPos];
}
do
{
stringPos++;
if ('0' <= ch <= '9')
{
num = (num * 10) + (ch - '0');
}
else
{
return -1;
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num * neg);
}
case 'h', 'x':
{
new
num = 0,
ch = string[stringPos];
do
{
stringPos++;
switch (ch)
{
case 'x', 'X':
{
num = 0;
continue;
}
case '0' .. '9':
{
num = (num << 4) | (ch - '0');
}
case 'a' .. 'f':
{
num = (num << 4) | (ch - ('a' - 10));
}
case 'A' .. 'F':
{
num = (num << 4) | (ch - ('A' - 10));
}
default:
{
return -1;
}
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num);
}
case 'c':
{
setarg(paramPos, 0, string[stringPos++]);
}
case 'f':
{
setarg(paramPos, 0, _:floatstr(string[stringPos]));
}
case 'p':
{
delim = format[formatPos++];
continue;
}
case '\'':
{
new
end = formatPos - 1,
ch;
while ((ch = format[++end]) && ch != '\'') {}
if (!ch)
{
return -1;
}
format[end] = '\0';
if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
{
if (format[end + 1])
{
return -1;
}
return 0;
}
format[end] = '\'';
stringPos = ch + (end - formatPos);
formatPos = end + 1;
}
case 'u':
{
new
end = stringPos - 1,
id = 0,
bool:num = true,
ch;
while ((ch = string[++end]) && ch != delim)
{
if (num)
{
if ('0' <= ch <= '9')
{
id = (id * 10) + (ch - '0');
}
else
{
num = false;
}
}
}
if (num && IsPlayerConnected(id))
{
setarg(paramPos, 0, id);
}
else
{
#if !defined foreach
#define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
#define __SSCANF_FOREACH__
#endif
string[end] = '\0';
num = false;
new
name[MAX_PLAYER_NAME];
id = end - stringPos;
foreach (Player, playerid)
{
GetPlayerName(playerid, name, sizeof (name));
if (!strcmp(name, string[stringPos], true, id))
{
setarg(paramPos, 0, playerid);
num = true;
break;
}
}
if (!num)
{
setarg(paramPos, 0, INVALID_PLAYER_ID);
}
string[end] = ch;
#if defined __SSCANF_FOREACH__
#undef foreach
#undef __SSCANF_FOREACH__
#endif
}
stringPos = end;
}
case 's', 'z':
{
new
i = 0,
ch;
if (format[formatPos])
{
while ((ch = string[stringPos++]) && ch != delim)
{
setarg(paramPos, i++, ch);
}
if (!i)
{
return -1;
}
}
else
{
while ((ch = string[stringPos++]))
{
setarg(paramPos, i++, ch);
}
}
stringPos--;
setarg(paramPos, i, '\0');
}
default:
{
continue;
}
}
while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
{
stringPos++;
}
while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
{
stringPos++;
}
paramPos++;
}
do
{
if ((delim = format[formatPos++]) > ' ')
{
if (delim == '\'')
{
while ((delim = format[formatPos++]) && delim != '\'') {}
}
else if (delim != 'z')
{
return delim;
}
}
}
while (delim > ' ');
return 0;
}
Actualiza tus includes por que yo lo compile y funciona bien, busca la versiуn mas reciente de streamer, zcmd y dini