Код:
}
switch(dialogid)
{
case PropertyBuyDialog:
{
new PropertysCountV;
for(new i = 0; i < MAX_PROPERTYS_IN_SERVER; i ++)
{
if(strcmp(PropertySystem[i][pOwner], "0"))
{
if(!strcmp(PropertySystem[i][pOwner], GetPlayerNameEx(playerid), false, MAX_PLAYER_NAME))
{
PropertysCountV ++;
}
}
}
if(PropertysCountV >= 2)
{
return SendClientMessage(playerid, -1, "Jus jau turite 2 verslus!");
}
}
//new pID = playerData[playerid][SomeoneVariable][0];
if(response)
{
if(PropertySystem[pID][pOwnerForCredits])
{
//new String[270];
new Credits = KiekKredituTuri(GetPlayerNameEx(playerid));
if(Credits < PropertySystem[pID][pPrice]) return SendClientMessage(playerid, -1, "Jums neuюtenka kreditш!");
Credits -= PropertySystem[pID][pPrice];
format(String, sizeof(String), "UPDATE `players` SET `Kreditai` = '%d' WHERE `Vardas` = '%s'", Credits, GetPlayerNameEx(playerid));
mysql_query(String);
format(String, sizeof(String), "Sлkmingai nusipirkote verslа uю %s {ffffff}kreditш (-us)!", konvertuoti_pinigus(PropertySystem[pID][pPrice]));
SendClientMessage(playerid, -1, String);
SendClientMessage(playerid, -1, "Savo verslа valdyti galлsite paraрж /verslai{ffffff}!");
strdel(PropertySystem[pID][pOwner], 0, MAX_PLAYER_NAME);
strcat(PropertySystem[pID][pOwner], GetPlayerNameEx(playerid), MAX_PLAYER_NAME);
format(String, sizeof(String), "{FF0000}%s\n \n{ffffff}Kaina: %d {ffffff}kreditш (-ai)\n{ffffff}Pelnas: €%d/1 {ffffff}min\n{ffffff}Savininkas: {FF0000}%s\n \n{ffffff}Spausk ENTER",
PropertySystem[pID][pTitle], PropertySystem[pID][pPrice], PropertySystem[pID][pEarning], PropertySystem[pID][pOwner]);
UpdateDynamic3DTextLabelText(PropertySystem[pID][pTextLabel], -1, String);
SaveProperty(pID);
}
else
{
if(GetPlayerMoneyA(playerid) >= PropertySystem[pID][pPrice])
{
new String[270];
format(String, sizeof(String), "[INFO]: {ffffff}Sлkmingai nusipirkote verslа uю €%s{ffffff}!", konvertuoti_pinigus(PropertySystem[pID][pPrice]));
SendClientMessage(playerid, -1, String);
SendClientMessage(playerid, -1, "[INFO]: {ffffff}Savo verslа valdyti galлsite paraрж /verslai{ffffff}!");
GivePlayerMoneyA(playerid, -PropertySystem[pID][pPrice]);
strdel(PropertySystem[pID][pOwner], 0, MAX_PLAYER_NAME);
strcat(PropertySystem[pID][pOwner], GetPlayerNameEx(playerid), MAX_PLAYER_NAME);
format(String, sizeof(String), "{FF0000}%s\n \n{ffffff}Kaina: €%s\n{ffffff}Pelnas: €%d/1 {ffffff}min\n{ffffff}Savininkas: {FF0000}%s\n \n{ffffff}Spausk ENTER",
PropertySystem[pID][pTitle], konvertuoti_pinigus(PropertySystem[pID][pPrice]), PropertySystem[pID][pEarning], PropertySystem[pID][pOwner]);
UpdateDynamic3DTextLabelText(PropertySystem[pID][pTextLabel], -1, String);
SaveProperty(pID);
}
else
{
SendClientMessage(playerid, -1, "[KLAIDA]: {ffffff}Jums neuюtenka pinigш рio verslo nusipirkimui!");
}
}
return 1;