SA-MP Forums Archive
How does it actually works? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How does it actually works? (/showthread.php?tid=234462)



How does it actually works? - NiXeL - 03.03.2011

Can anyone explain me how to create houses? I don't understand how to associate player's account with house (I writing from scratch and using ini reg system writen by myself)


Re: How does it actually works? - Mean - 03.03.2011

You need to make your own house system, possibly by creating pickups, and putting it into variables, [HiC]TheKiller has made a tutorial on how to make houses, you can also look at gl_property filterscript, provided by SA-MP with GrandLarc.


Re: How does it actually works? - NiXeL - 03.03.2011

I know how to create pickups.
I can't get other things.
For example, how to prevent player from buying house if he's already had one. And what if player's account has been removed, what about his house?


Re: How does it actually works? - Marricio - 03.03.2011

Use vars, like..

pawn Код:
new HasHouse[MAX_PLAYERS];
new IsInHouse[MAX_PLAYERS];
etc..


AW: Re: How does it actually works? - Nero_3D - 03.03.2011

Quote:
Originally Posted by NiXeL
Посмотреть сообщение
I know how to create pickups.
I can't get other things.
For example, how to prevent player from buying house if he's already had one. And what if player's account has been removed, what about his house?
Lets say there is a house line in the player file (house = -1)
and if he bought a house, lets say houseid 5 (house = 5)
if we read it than and it isnt -1, he got a house

For easier usage just load the saved data into variables

Quote:
Originally Posted by Marricio
Посмотреть сообщение
Use vars, like..

pawn Код:
new HasHouse[MAX_PLAYERS];
new IsInHouse[MAX_PLAYERS];
etc..
If his account is removed the house is ownerless and can be bought again...

After all an house system isnt that complicated,
its more or less two pickups with one id (enter pickup / exit pickup / houseid)


Re: How does it actually works? - Lorrden - 03.03.2011

Using arrays is to recomend..

pawn Код:
enum playerinfo {
    pHouseKey
};

new PlayerInfo[MAX_PLAYERS][pHouseKey];



Re: How does it actually works? - Cameltoe - 03.03.2011

Quote:
Originally Posted by Lorrden
Посмотреть сообщение
Using arrays is to recomend..

pawn Код:
enum playerinfo {
    pHouseKey
};

new PlayerInfo[MAX_PLAYERS][pHouseKey];
Sorry for the off-topicness, but did i hear ARRAY? woop woop !

Though, it should be :

pawn Код:
enum playerinfo {
    pHouseKey
};

new PlayerInfo[MAX_PLAYERS][playerinfo];



Re: AW: Re: How does it actually works? - Marricio - 03.03.2011

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
If his account is removed the house is ownerless and can be bought again...
I know that, i just dont know what is his type of saving system..
But also, its possible to inserting the var value into the .ini file..


Re: AW: Re: How does it actually works? - NiXeL - 04.03.2011

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Lets say there is a house line in the player file (house = -1)
and if he bought a house, lets say houseid 5 (house = 5)
if we read it than and it isnt -1, he got a house

For easier usage just load the saved data into variables



If his account is removed the house is ownerless and can be bought again...

After all an house system isnt that complicated,
its more or less two pickups with one id (enter pickup / exit pickup / houseid)
Man, I was thinking about absolutly the same way, but there was somthing to stop me. If you give me the answer, I think I'll do it that way!

Quote:

If his account is removed the house is ownerless and can be bought again...

HOW? Thank you very much in advance!


AW: Re: AW: Re: How does it actually works? - Nero_3D - 04.03.2011

Quote:
Originally Posted by NiXeL
Посмотреть сообщение
HOW? Thank you very much in advance!
The players are associated with the house's, and the house's need to be associated with the players

For that we only need one file ("houses.txt")
There we could add the owernames like ("house_x = name")
Or we just add the names and the line count is the houseid

And if the guy removes now his account we read his houseid and he got one we set the ownername to empty
(You could use 0's (not owned) and 1's (owned) instead of the ownername but maybe you need it for some kind of message)