Global variables confusion
#1

I have some doubts about the global variables, I hope that someone can answer me, greetings.

I have the following variable in my gamemode (at least 10 equals)

Код:
new HouseID;
I use it to give you the id of a house

Код:
HouseID = i; (i = GetNearestHouseID(playerid))
So, if player X is using this variable (at least it is in 5 consecutive house functions) and player Y uses the /house command at the same time the value of HouseID would change completely to the house closest to it, so both the HouseID value of player X will not be worth the same as when he use the command .. right?


Then, the solution to that would be the following:

Код:
new HouseID[MAX_PLAYERS];
And

Код:
HouseID[playerid] = i (i = GetNearestHouseID(playerid))
But, if I want to add sell the house by dialogues, I can not use HouseID [playerid] since in the playerid dialog it would be the id of the player Y (to whom the house will be sold)

What can I do in this case? .. the same thing happens to me in 3 different opportunities, not only with the system of houses .. can someone help me ?, thanks!
Reply


Messages In This Thread
Global variables confusion - by OdgFox - 03.02.2018, 06:01
Re: Global variables confusion - by jasperschellekens - 03.02.2018, 10:47
Re: Global variables confusion - by OdgFox - 03.02.2018, 14:56
Re: Global variables confusion - by Mugala - 03.02.2018, 16:35
Re: Global variables confusion - by OdgFox - 03.02.2018, 17:05
Re: Global variables confusion - by Mugala - 03.02.2018, 17:16
Re: Global variables confusion - by OdgFox - 03.02.2018, 19:29

Forum Jump:


Users browsing this thread: 1 Guest(s)