Кто мне скажет что я делаю не так почему функция не работает?
function Trig_gold_Actions takes nothing returns nothing local string s = SubString(GetEventPlayerChatString(), 6, StringLength(GetEventPlayerChatString())) local integer i = S2I(s) local integer e = GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD) call SetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD , e + i) endfunction
//=========================================================================== function InitTrig_gold takes nothing returns nothing set gg_trg_gold = CreateTrigger( ) call TriggerRegisterPlayerChatEvent( gg_trg_gold, Player(0), "-gold", true ) call TriggerAddAction( gg_trg_gold, function Trig_gold_Actions ) endfunction
Не даже с пробелом не работает. Еслия посавлю вместо i которая отвечает за перевод S2I какую либо цифру то все работает, а всесте с string не работает.
function Trig_gold_Actions takes nothing returns nothing local string s = SubString(GetEventPlayerChatString(), 6, StringLength(GetEventPlayerChatString())) local integer i = S2I(s) local integer e = GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD) call SetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD , e + 200) endfunction
//=========================================================================== function InitTrig_gold takes nothing returns nothing set gg_trg_gold = CreateTrigger( ) call TriggerRegisterPlayerChatEvent( gg_trg_gold, Player(0), "-gold", true ) call TriggerAddAction( gg_trg_gold, function Trig_gold_Actions ) endfunction