Carpet

Carpet

2M Downloads

Unable to spawn a player using scriptAutoLoad

Kevinkoh-Lynx opened this issue ยท 0 comments

commented

I have a script named spawnplayer.sc that spawns a player when i run /script load spawnplayer.

However it fails to spawn a player when loaded with scriptAutoLoad.

Below is the script:

__config() -> m(l('stay_loaded', true));
_checknspawn() -> (
    print('Spawning npc'); 
    print(run('/player npc spawn')); 
    run('/c npc')
);

current_tick = tick_time();
print('Current tick: ' + current_tick);

if(
    current_tick == 0, 
    print('Sever initialising, reloading script 20 ticks later.');
    //schedule(
    //    20,
    //    _() -> run('/script load spawnplayer')
    //)
    _checknspawn()
    ,
    _checknspawn()
)