• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] HELP ME PLS SYNC

Level 2
Joined
Jun 16, 2021
Messages
7
please help, I can’t synchronize the line that I extracted from a file using the Preloader function using BlzSetAbilityTooltip. Here is my code - and it kicks players out of the game

1711724150328.png


I beg you to give or show a normal example of solving the problem, written in JASS. I don't work with LUA (((
 
Level 24
Joined
Jun 26, 2020
Messages
1,852
You need two triggers for this, 1 to send the data, and other to receive it:
JASS:
function SendData takes nothing returns nothing
    local player p = <The player you want> // The event doesn't need to have a triggering player
    if p == GetLocalPlayer() then
        call BlzSendSyncData(<Your preffix>, FileIO_Read("Test.txt"))
    endif
endfunction

function Init1 takes nothing returns nothing
    local trigger t = CreateTrigger()
    // Create the trigger with any event you want, like "game started" or "game elapsed time is 5 seconds"
    call TriggerAddAction(t, function SendData)
endfunction
JASS:
function LoadData takes nothing returns nothing
    local player p = GetTriggerPlayer()
    local integer pid = GetPlayerId(p)
    set savecode_first_part[pid] = BlzGetTriggerSyncData()
endfunction

function Init2 takes nothing returns nothing
    local trigger t = CreateTrigger()
    call BlzTriggerRegisterPlayerSyncEvent(t, Player(0), <Your preffix>, false)
    call TriggerAddAction(t, function LoadData)
endfunction
 
Top