Всем привет.
Хочу сделать в моде гто фишку,с покупкой респа,пример.
Свободный респ,и на нём зелёная иконка домика.
При покупке респа игроком,зелёная иконка дома,становилась красной.
Понятно и удобно.
Да я знаю что это нубовский вопрос. Но я нуб в pawno.
Собственно команды /hbuy и /hsell прилагаю: [pwn] if((strcomp(cmd, "/housebuy", true) == 1) || (strcomp(cmd, "/hbuy", true) == 1))
{
if (!IsPlayerAtHouse(playerid))
{
SendPlayerFormattedText(playerid, lang_texts[8][14] , 0,COLOUR_RED);
return 1;
} else {
new id=GetHouseID(playerid);
new temp[MAX_STRING];
if (id > -1)
{
if (IsPlayerRegistered(playerid))
{
if (PlayerGangid[playerid] != 0) {
new price;
price = Houses[id][Houses_Cost] + Houses[id][Houses_Buyout];
if(Player[playerid][Money] >= price)
{
if(strcomp(Houses[id][Houses_Owner], oGetPlayerName(playerid), true) == 1)
{
SendPlayerFormattedText(playerid, lang_texts[8][15] , 0,COLOUR_RED);
}
else
{
new owner=-1;
for (new ownerid = 0; ownerid < MAX_PLAYERS; ownerid++)
{
if (IsPlayerConnected(ownerid))
{
if(strcomp(Houses[id][Houses_Owner], oGetPlayerName(ownerid), true) == 1)
{
format(temp,sizeof(temp), lang_texts[8][16] ,Houses[id][Houses_Name],oGetPlayerName(playerid));
SendPlayerFormattedText(ownerid, temp, 0,COLOUR_RED);
set(temp,nullstr);
owner=ownerid;
}
}
}
oGivePlayerMoney(playerid,0-price,1);
if (owner > -1)
{
oGivePlayerMoney(owner,0+price,1);
}
else
{
new dinifilename[MAX_STRING];
format(dinifilename,sizeof(dinifilename),"%sGTO.Player.%s.txt",PlayerDB,EncodeName(Houses[id][Houses_Owner]));
if (dini_Exists(dinifilename))
{
new tempmoney;
tempmoney = strval(dini_Get(dinifilename,"Money"));
tempmoney = tempmoney + price;
valstr(temp,tempmoney);
dini_Set(dinifilename,"Money",temp);
set(temp,nullstr);
}
}
set(Houses[id][Houses_Owner],oGetPlayerName(playerid));
set(Houses[id][Houses_Gang],PlayerGangName[playerid]);
Houses[id][Houses_Buyout] = 0;
new dinifilename[MAX_STRING];
format(dinifilename,sizeof(dinifilename),"%sGTO.Houses.%s.txt",HousesDB,Houses[id][Houses_Name]);
if (dini_Exists(dinifilename))
{
dini_Set(dinifilename,"Owner",Houses[id][Houses_Owner]);
dini_Set(dinifilename,"Gang",Houses[id][Houses_Gang]);
valstr(temp,Houses[id][Houses_Buyout]);
dini_Set(dinifilename,"Buyout",temp);
set(temp,nullstr);
}
format(temp,sizeof(temp), lang_texts[8][17] ,Houses[id][Houses_Name]);
SendPlayerFormattedText(playerid, temp, 0,COLOUR_GREEN);
set(temp,nullstr);
new logstring[256];
format(logstring, sizeof (logstring), "player: %d: %s: bought the '%s' (house)",playerid,oGetPlayerName(playerid),Houses[id][Houses_Name]);
WriteLog(logstring);
}
} else {
SendPlayerFormattedText(playerid, lang_texts[8][18] , 0,COLOUR_RED);
}
} else { SendPlayerFormattedText(playerid, lang_texts[8][19] , 0,COLOUR_RED); }
} else {
SendPlayerFormattedText(playerid, lang_texts[8][20] , 0,COLOUR_RED);
}
} else {
SendPlayerFormattedText(playerid, lang_texts[8][21] , 0,COLOUR_RED);
}
return 1;
}
}
//---------------------
//-- sell house --
if((strcomp(cmd, "/housesell", true) == 1) || (strcomp(cmd, "/hsell", true) == 1))
{
if (!IsPlayerAtHouse(playerid))
{
SendPlayerFormattedText(playerid, lang_texts[8][22] , 0,COLOUR_RED);
return 1;
} else {
new id=GetHouseID(playerid);
new temp[MAX_STRING];
if (id > -1)
{
if (IsPlayerRegistered(playerid))
{
if(strcomp(Houses[id][Houses_Owner], oGetPlayerName(playerid), true) == 0)
{
SendPlayerFormattedText(playerid, lang_texts[8][23] , 0,COLOUR_RED);
} else {
new price;
price = Houses[id][Houses_Cost] + Houses[id][Houses_Buyout];
price = (price * 85) / 100;
oGivePlayerMoney(playerid,0+price,1);
set(Houses[id][Houses_Owner],"Unknown");
Houses[id][Houses_Buyout] = 0;
new dinifilename[MAX_STRING];
format(dinifilename,sizeof(dinifilename),"%sGTO.Houses.%s.txt",HousesDB,Houses[id][Houses_Name]);
if (dini_Exists(dinifilename))
{
dini_Set(dinifilename,"Owner","Unknown");
dini_Set(dinifilename,"Gang","Unknown");
dini_Set(dinifilename,"UpKeepLeft","Unknown");
valstr(temp,Houses[id][Houses_Buyout]);
dini_Set(dinifilename,"Buyout",temp);
set(temp,nullstr);
}
format(temp,sizeof(temp), lang_texts[8][24] ,Houses[id][Houses_Name]);
SendPlayerFormattedText(playerid, temp, 0,COLOUR_GREEN);
set(temp,nullstr);
SendPlayerFormattedText(playerid, lang_texts[8][25] , 0,COLOUR_GREEN);
new logstring[256];
format(logstring, sizeof (logstring), "player: %d: %s: sold the '%s' (house)",playerid,oGetPlayerName(playerid),Houses[id][Houses_Name]);
WriteLog(logstring);
}
} else {
SendPlayerFormattedText(playerid, lang_texts[8][26] , 0,COLOUR_RED);
SendPlayerFormattedText(playerid, lang_texts[8][27] , 0,COLOUR_RED);
}
} else {
SendPlayerFormattedText(playerid, lang_texts[8][28] , 0,COLOUR_RED);
}
return 1;
}
}[/pwn]
Заранее спасибо за помощь,за правильную помощь поставлю +.
Добавлено (11.09.2009, 12:16)
---------------------------------------------
Ну что никто не поможет?