[Ajuda] Comando /comprar para casas -
Cheleber_Pausini - 01.07.2014
Bem estou a ter um problema com esse comando, porque quando o player da /comprar estando longe do pickup da casa, nao aparece a mensagem de que tem que estar perto da casa para a poder comprar, apenas da Unknow Command...
CODE:
Код:
CMD:comprar(playerid, params[])
{
new house = GetProxHouse(playerid);
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ]))
{
new
Float: X, Float: Y, Float: Z,
string[260],
filePath[200],
alreadyOwner,
ownerFile[200],
tenantFile[200],
logString[128];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(ownerFile, sizeof ownerFile, "LHouse/Donos/%s.txt", playerName);
format(tenantFile, sizeof tenantFile, "LHouse/Locadores/%s.txt", playerName);
format(filePath, sizeof filePath, "LHouse/Casas/Casa %d.txt", house);
if(DOF2_FileExists(ownerFile))
{
alreadyOwner = DOF2_GetInt(ownerFile, "houseID");
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
format(string, sizeof string, "{F90700}Erro: {FFFFFF}Vocк jб й dono da casa %d! Vocк sу pode ter 1 casa!", alreadyOwner);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
if(DOF2_FileExists(tenantFile))
{
alreadyOwner = DOF2_GetInt(tenantFile, "houseID");
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
format(string, sizeof string, "{F90700}Erro: {FFFFFF}Vocк jб й locador de uma casa %d! Vocк sу pode ter 1 casa!", alreadyOwner);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
else if(GetPlayerMoney(playerid) < houseData[house][housePrice])
{
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
SendClientMessage(playerid, COLOR_ERROR, "{F90700}Erro: {FFFFFF}Vocк nгo tem dinheiro o suficiente.");
return 1;
}
format(string, sizeof string, "%s comprou a casa de id %d", playerName, house);
print(string);
WriteLog(LOG_HOUSES, string);
DOF2_CreateFile(ownerFile);
DOF2_SetInt(ownerFile, "houseID", house);
DOF2_SetString(filePath, "Dono", playerName, "Informaзхes");
DOF2_SaveFile();
format(houseData[house][houseOwner], 24, playerName);
houseData[house][houseStatus] = DOF2_SetInt(filePath, "Status", 0, "Informaзхes");
GivePlayerMoney(playerid, -houseData[house][housePrice]);
SetPlayerPos(playerid, houseData[house][houseIntX], houseData[house][houseIntY], houseData[house][houseIntZ]);
SetPlayerVirtualWorld(playerid, houseData[house][houseVirtualWorld]);
SetPlayerInterior(playerid, houseData[house][houseInterior]);
DestroyDynamicPickup(housePickupIn[house]);
DestroyDynamicMapIcon(houseMapIcon[house]);
housePickupIn[house] = CreateDynamicPickup(1272, 23, houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ]);
houseMapIcon[house] = CreateDynamicMapIcon(houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ], 32, -1, -1, 0, -1, 100.0);
Update3DText(house);
PlayerTextDrawShow(playerid, welcome[playerid]);
SetTimerEx("HideTextdraws", 2000, false, "i", playerid);
format(logString, sizeof logString, "O jogador %s[%d], comprou a casa %d.", playerName, playerid, house);
WriteLog(LOG_HOUSES, logString);
return true;
}
else
{
SendClientMessage(playerid, -1, "Para comprar uma casa va para uma!");
return true;
}
}
}
Re: [Ajuda] Comando /comprar para casas -
Cheleber_Pausini - 02.07.2014
Ninguem me pode ajudar? UP!
Re: [Ajuda] Comando /comprar para casas -
focaximubh - 02.07.2014
pawn Код:
CMD:comprar(playerid, params[])
{
new house = GetProxHouse(playerid);
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ]))
{
new
Float: X, Float: Y, Float: Z,
string[260],
filePath[200],
alreadyOwner,
ownerFile[200],
tenantFile[200],
logString[128];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(ownerFile, sizeof ownerFile, "LHouse/Donos/%s.txt", playerName);
format(tenantFile, sizeof tenantFile, "LHouse/Locadores/%s.txt", playerName);
format(filePath, sizeof filePath, "LHouse/Casas/Casa %d.txt", house);
if(DOF2_FileExists(ownerFile))
{
alreadyOwner = DOF2_GetInt(ownerFile, "houseID");
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
format(string, sizeof string, "{F90700}Erro: {FFFFFF}Vocк jб й dono da casa %d! Vocк sу pode ter 1 casa!", alreadyOwner);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
if(DOF2_FileExists(tenantFile))
{
alreadyOwner = DOF2_GetInt(tenantFile, "houseID");
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
format(string, sizeof string, "{F90700}Erro: {FFFFFF}Vocк jб й locador de uma casa %d! Vocк sу pode ter 1 casa!", alreadyOwner);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
else if(GetPlayerMoney(playerid) < houseData[house][housePrice])
{
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
SendClientMessage(playerid, COLOR_ERROR, "{F90700}Erro: {FFFFFF}Vocк nгo tem dinheiro o suficiente.");
return 1;
}
format(string, sizeof string, "%s comprou a casa de id %d", playerName, house);
print(string);
WriteLog(LOG_HOUSES, string);
DOF2_CreateFile(ownerFile);
DOF2_SetInt(ownerFile, "houseID", house);
DOF2_SetString(filePath, "Dono", playerName, "Informaзхes");
DOF2_SaveFile();
format(houseData[house][houseOwner], 24, playerName);
houseData[house][houseStatus] = DOF2_SetInt(filePath, "Status", 0, "Informaзхes");
GivePlayerMoney(playerid, -houseData[house][housePrice]);
SetPlayerPos(playerid, houseData[house][houseIntX], houseData[house][houseIntY], houseData[house][houseIntZ]);
SetPlayerVirtualWorld(playerid, houseData[house][houseVirtualWorld]);
SetPlayerInterior(playerid, houseData[house][houseInterior]);
DestroyDynamicPickup(housePickupIn[house]);
DestroyDynamicMapIcon(houseMapIcon[house]);
housePickupIn[house] = CreateDynamicPickup(1272, 23, houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ]);
houseMapIcon[house] = CreateDynamicMapIcon(houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ], 32, -1, -1, 0, -1, 100.0);
Update3DText(house);
PlayerTextDrawShow(playerid, welcome[playerid]);
SetTimerEx("HideTextdraws", 2000, false, "i", playerid);
format(logString, sizeof logString, "O jogador %s[%d], comprou a casa %d.", playerName, playerid, house);
WriteLog(LOG_HOUSES, logString);
return true;
}
else
{
SendClientMessage(playerid, -1, "Para comprar uma casa va para uma!");
}
}
return 1;
}
}
Tente assim....
@EDIT ERREI O LUGAR DO RETURN
Re: [Ajuda] Comando /comprar para casas -
Cheleber_Pausini - 02.07.2014
focaximubh ta igual
Re: [Ajuda] Comando /comprar para casas -
Cheleber_Pausini - 02.07.2014
HELP!!
Re: [Ajuda] Comando /comprar para casas -
Coreia - 02.07.2014
Tenta agora ae.
pawn Код:
CMD:comprar(playerid, params[])
{
#pragma unused params
new house = GetProxHouse(playerid);
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ]))
{
new
Float: X, Float: Y, Float: Z,
string[260],
filePath[200],
alreadyOwner,
ownerFile[200],
tenantFile[200],
logString[128];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(ownerFile, sizeof ownerFile, "LHouse/Donos/%s.txt", playerName);
format(tenantFile, sizeof tenantFile, "LHouse/Locadores/%s.txt", playerName);
format(filePath, sizeof filePath, "LHouse/Casas/Casa %d.txt", house);
if(DOF2_FileExists(ownerFile))
{
alreadyOwner = DOF2_GetInt(ownerFile, "houseID");
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
format(string, sizeof string, "{F90700}Erro: {FFFFFF}Vocк jб й dono da casa %d! Vocк sу pode ter 1 casa!", alreadyOwner);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
if(DOF2_FileExists(tenantFile))
{
alreadyOwner = DOF2_GetInt(tenantFile, "houseID");
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
format(string, sizeof string, "{F90700}Erro: {FFFFFF}Vocк jб й locador de uma casa %d! Vocк sу pode ter 1 casa!", alreadyOwner);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
else if(GetPlayerMoney(playerid) < houseData[house][housePrice])
{
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
SendClientMessage(playerid, COLOR_ERROR, "{F90700}Erro: {FFFFFF}Vocк nгo tem dinheiro o suficiente.");
return 1;
}
format(string, sizeof string, "%s comprou a casa de id %d", playerName, house);
print(string);
WriteLog(LOG_HOUSES, string);
DOF2_CreateFile(ownerFile);
DOF2_SetInt(ownerFile, "houseID", house);
DOF2_SetString(filePath, "Dono", playerName, "Informaзхes");
DOF2_SaveFile();
format(houseData[house][houseOwner], 24, playerName);
houseData[house][houseStatus] = DOF2_SetInt(filePath, "Status", 0, "Informaзхes");
GivePlayerMoney(playerid, -houseData[house][housePrice]);
SetPlayerPos(playerid, houseData[house][houseIntX], houseData[house][houseIntY], houseData[house][houseIntZ]);
SetPlayerVirtualWorld(playerid, houseData[house][houseVirtualWorld]);
SetPlayerInterior(playerid, houseData[house][houseInterior]);
DestroyDynamicPickup(housePickupIn[house]);
DestroyDynamicMapIcon(houseMapIcon[house]);
housePickupIn[house] = CreateDynamicPickup(1272, 23, houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ]);
houseMapIcon[house] = CreateDynamicMapIcon(houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ], 32, -1, -1, 0, -1, 100.0);
Update3DText(house);
PlayerTextDrawShow(playerid, welcome[playerid]);
SetTimerEx("HideTextdraws", 2000, false, "i", playerid);
format(logString, sizeof logString, "O jogador %s[%d], comprou a casa %d.", playerName, playerid, house);
WriteLog(LOG_HOUSES, logString);
return true;
}
else
{
SendClientMessage(playerid, -1, "Para comprar uma casa va para uma!");
return true;
}
}
return 1;
}
Re: [Ajuda] Comando /comprar para casas -
Cheleber_Pausini - 02.07.2014
igual...