06.12.2017, 13:10
Is it possible if this:
then spawn player at the house he owns..
for ref.
thanks..
PHP код:
if(Houses[house][EHouseOwnerSQLID] = GetPVarInt(playerid, "CharID")) {
PHP код:
SetPlayerPos(playerid, Houses[i][EHouseX],Houses[i][EHouseY],Houses[i][EHouseZ]);
PHP код:
YCMD:buyhouse(playerid, params[], help) {
new msg[128];
if(help) {
SendClientMessage(playerid, X11_WHITE, "Used for buying a house");
return 1;
}
new num = GetNumOwnedHouses(playerid);
if(num >= GetPVarInt(playerid, "MaxHouses")) {
SendClientMessage(playerid, X11_TOMATO_2, "You cannot own any more houses!");
return 1;
}
new house = getStandingHouse(playerid);
if(house == -1) {
SendClientMessage(playerid, X11_TOMATO_2, "You must be standing near a house");
return 1;
}
if(Houses[house][EHouseOwnerSQLID] != 0) {
SendClientMessage(playerid, X11_TOMATO_2, "This house is already owned by someone");
return 1;
}
new confirmtext[32];
if(!sscanf(params,"s[32]",confirmtext)) {
if(strcmp(confirmtext,"confirm", true) != 0) {
SendClientMessage(playerid, X11_TOMATO_2, "You must type /buyhouse confirm");
return 1;
}
} else {
format(msg, sizeof(msg), "* This house costs $%s, type /buyhouse confirm",getNumberString(Houses[house][EHouseValue]));
SendClientMessage(playerid, COLOR_LIGHTGREEN, msg);
return 1;
}
new money = GetMoneyEx(playerid);
if(money < Houses[house][EHouseValue]) {
format(msg, sizeof(msg), "You do not have enough money, you need $%s more to buy this house.",getNumberString(Houses[house][EHouseValue]-money));
SendClientMessage(playerid, X11_TOMATO_2, msg);
return 1;
}
GiveMoneyEx(playerid, -Houses[house][EHouseValue]);
setHouseOwner(house, playerid);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Congratulations on your new house!");
return 1;
}