function Test(hero)
if hero == "..." then
end
end
Trigger(OBJECT_TOUCH_TRIGGER, ...).
In your case, the code needs to be changed as follows:
function OPIT(hero)
number = GetCurrentPlayer() --I recommend replacing this with number=GetObjectOwner(hero)
local Gold = GetPlayerResource(number,6) --It's better to keep the variable local
if Gold >= 6000 then
QuestionBoxForPlayers(number,"Maps/Multiplayer/JoyPatriot/Teks/Vopros.txt", "yes([["..hero.."]])", "no")
else MessageBoxForPlayers(number,"Maps/Multiplayer/JoyPatriot/Teks/OP.txt", nil)
end
end
function yes(hero)
number = GetCurrentPlayer() --The same. It's better to use number=GetObjectOwner(hero)
local Gold = GetPlayerResource(number) --There's nothing wrong with repeating the operation, although it could be done better; but the main thing is that the error of overwriting something in the Gold variable has been eliminated
SetPlayerResource(number,6,Gold-6000)
LevelUpHero(hero)
return parse '' --We remove the machine error, which has no effect. Otherwise, a warning will be spammed in the console
end
SetObjectEnabled("OP",nil);
Trigger(OBJECT_TOUCH_TRIGGER,"OP","OPIT");P.s. I recommend giving variables meaningful names. And objects too. For example, "ExperienceStone" and "ExperienceStoneTouch", respectively...
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________