Buy/Sell property -
Stm - 05.01.2014
Im trying to make buy/sell faction/house system.For now i have made the /buy function but when i restart the server other players can buy the house or faction.
Код:
new cityhallpropertyoffice;
cityhallpropertyoffice = CreatePickup(1239, 2, 362.8641, 155.2817, 1024.7963, -1);
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == cityhallpropertyoffice)
{
ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "Property Office", "Faction\nHouses", "Select","Close");
}
if(pickupid == accjob)
if(dialogid == 6)
{
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid, 7, DIALOG_STYLE_LIST, "Bussines","Building faction","Buy","Close");
}
if(listitem == 1)
{
ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Houses", "House 1\nHouse 2\nHouse 3", "Buy","Close");
}
}
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 7)
{
if(response)
{
if(listitem == 0)
{
new INI:File = INI_Open(UserPath(playerid));
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
if(Chars[playerid][pBusiness] == 0)
{
INI_SetTag(File,"data");
INI_WriteInt(File,"Business",Chars[playerid][pBusiness] = 1);
INI_Close(File);
Bfaction[playerid][Owner] = 1;
pInfo[playerid] [pBuilding] = 1;
}
else
{
if(pInfo[playerid][pBuilding] == 1)
{
SendClientMessage(playerid,COLOR_RED,"This faction is allready bought from someone else");
}
}
}
}
}
if(dialogid == 8)
{
if(response)
{
if(listitem == 0)
{
SendClientMessage(playerid,COLOR_RED, "There is no house for sale");
}
if(listitem == 1)
{
SendClientMessage(playerid,COLOR_RED, "There is no house for sale");
}
if(listitem == 2)
{
SendClientMessage(playerid,COLOR_RED, "There is no house for sale");
}
}
}
return 1;
}
That is what i have done for now.
(P.S. I still suck at scripting so.. i will need your help guys

)
Re: Buy/Sell property -
Stm - 07.01.2014
Can anyone help ... :/
Re: Buy/Sell property -
[LCK]Chris - 07.01.2014
Haha why do you have a dialog code in your pickups callback?
Re: Buy/Sell property -
[LCK]Chris - 07.01.2014
this will get you on the right track
PHP код:
//Top of script
new cityhallpropertyoffice;
cityhallpropertyoffice = CreatePickup(1239, 2, 362.8641, 155.2817, 1024.7963, -1);
#define DialogCityHallOffice 6
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == cityhallpropertyoffice)
{
ShowPlayerDialog(playerid, DialogCityHallOffice, DIALOG_STYLE_LIST, "Property Office", "Faction\nHouses", "Select","Close");
}
//if(pickupid == accjob){}
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DialogCityHallOffice)
{
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid, 7, DIALOG_STYLE_LIST, "Bussines","Building faction","Buy","Close");
}
if(listitem == 1)
{
ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Houses", "House 1\nHouse 2\nHouse 3", "Buy","Close");
}
}
}
if(dialogid == 7)
{
if(response)
{
if(listitem == 0)
{
new INI:File = INI_Open(UserPath(playerid));
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
if(Chars[playerid][pBusiness] == 0)
{
INI_SetTag(File,"data");
INI_WriteInt(File,"Business",Chars[playerid][pBusiness] = 1);
INI_Close(File);
Bfaction[playerid][Owner] = 1;
pInfo[playerid] [pBuilding] = 1;
}
else
{
if(pInfo[playerid][pBuilding] == 1)
{
SendClientMessage(playerid,COLOR_RED,"This faction is allready bought from someone else");
}
}
}
}
}
if(dialogid == 8)
{
if(response)
{
if(listitem == 0)
{
SendClientMessage(playerid,COLOR_RED, "There is no house for sale");
}
if(listitem == 1)
{
SendClientMessage(playerid,COLOR_RED, "There is no house for sale");
}
if(listitem == 2)
{
SendClientMessage(playerid,COLOR_RED, "There is no house for sale");
}
}
}
return 1;
}
Re: Buy/Sell property -
Stm - 07.01.2014
tnx

and about the call back i don`t know