27.03.2011, 17:39
Hello. Firstly I am barely new scripter (Let's say just noob
) and secondly I'm trying to make my own roleplay server gamemode. Anyway. I have problems with my house system.
And more accurately with the pickup.
I have 3 houses setted aroudnt the town for now. The problem is when I go at first house pickup that I set it shows the gametext fine, but if I do /buyhouse, it doesn't changes (To show the owner and shit, it keep saying "For sale!".). But the things with the other houses are different. When I go at their pickups it doesn't shows any gametext but if i type /buyhouse everything fixes up. It shows the owner and other things instead of "For sale" and when I type /sellhouse it's still fine, the gametext changes back to "For sale" and everything si good.
So the problem is that the gametext on the first house doesn't changes when I type /buyhouse and other house's gametext doesn't even shows before I do /buyhouse.
Here is the OnPlayerPickUpPickup callback.
And here is /buyhouse command.
PS: I am sorry, maybe the script is verry shitty but before all I am still fucking newbie. Please help me to debug my script. Thank you in advance.

And more accurately with the pickup.
I have 3 houses setted aroudnt the town for now. The problem is when I go at first house pickup that I set it shows the gametext fine, but if I do /buyhouse, it doesn't changes (To show the owner and shit, it keep saying "For sale!".). But the things with the other houses are different. When I go at their pickups it doesn't shows any gametext but if i type /buyhouse everything fixes up. It shows the owner and other things instead of "For sale" and when I type /sellhouse it's still fine, the gametext changes back to "For sale" and everything si good.
So the problem is that the gametext on the first house doesn't changes when I type /buyhouse and other house's gametext doesn't even shows before I do /buyhouse.
Here is the OnPlayerPickUpPickup callback.
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid) //Pickup callback
{
for(new J; J<MAX_HOUSES; J++) //Loops through all houses
{
if(pickupid == PickupID[J]) //If the pickupid is one of our house ones
{
new str[75], ID = pickupid +1;
if(HouseInfo[J][Owned] == 1)
{
format(str, sizeof(str), "~g~Bayside %i~n~~r~Owner: ~w~%s~n~~g~Type ~w~/enter", ID, HouseInfo[J][HouseOwner]);
}
if(HouseInfo[J][Owned] == 0)
{
format(str, sizeof(str), "~g~For sell~n~~w~Bayside %i~n~~r~Price: ~g~$~w~%d~n~~g~Type ~w~/buyhouse", ID, HouseInfo[ID][HouseCost]);
}
new str2[150];
format(str2, sizeof(str2), "%s", str);
GameTextForPlayer(playerid, str2, 2500, 3);
return 1;
}
}
return 0;
}
pawn Код:
if (strcmp("/buyhouse", cmdtext, true, 10) == 0)
{
for(new i; i<MAX_HOUSES; i++)
{
if(!IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ])) continue;
new Pname[24], pFile[258]; GetPlayerName(playerid, Pname, 24);
for(new S; S<MAX_HOUSES; S++)
format(hFile, sizeof(hFile), "/Houses/House%i.ini", i);
format(pFile, sizeof(pFile), "/accounts/%s.ini", Pname);
{
new tmp[256];
tmp = dini_Get(pFile, "HouseOwn");
new tmpint = strval(tmp);
if (tmpint == 1) return SendClientMessage(playerid, 0xDF4949AA, "You already own a house!");
}
if(GetPlayerMoney(playerid) < HouseInfo[i][HouseCost]) return SendClientMessage(playerid, 0xDF4949AA, "You don't have enough money to buy this house");
if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xDF4949AA, "This house is already owned!");
GivePlayerMoney(playerid, - HouseInfo[i][HouseCost]);
GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3);
HouseInfo[i][Owned] = 1;
GetPlayerName(playerid, Pname, 24);
format(HouseInfo[i][HouseOwner], 24, "%s", Pname);
dini_Set(hFile, "HouseOwner", Pname);
dini_IntSet(pFile, "HouseOwn", 1);
DestroyPickup(PickupID[i]);
PickupID[i] = CreatePickup(1273, 23, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ], -1);
return 1;
}
SendClientMessage(playerid, 0xDF4949AA, "You are not close enough to a house");
return 1;
}