Jump to content
  • 0

Script Error ! Player not Attached!


hardelite

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  44
  • Reputation:   2
  • Joined:  01/09/18
  • Last Seen:  

Hello everyone!
I'm having some problems with the script, I wish someone could help me, please.

Script:

Spoiler

// Release by Envolvents - 18/06/2017 05:40
// Correção nas variáveis e add bindatcmd (joinrd)
prontera,152,151,5    script    Corra ou Morra    1904,{

goto EnterRDSub;

OnInit:
    bindatcmd "joinrd",strnpcinfo(3)+"::OnJoinCommand";
    set .joinannounce, 2;
    end;
    
OnJoinCommand:
    set .@size, getarraysize( getvariableofnpc( .aid, "RunOrDie" ) );

    if (.start != 1)
    // message strcharinfo(0), "O portal para o Corra ou Morra está fechado no momento.";
    // else
    callsub EnterRDSub;
    end;
    
EnterRDSub:
    if (strcharinfo(3) == "poring_c01") end;
    
    if ( ( .@size = getvariableofnpc( .aidtotal, "RunOrDie" ) ) >= 100 ) { // 100 participant max
        mes "[^00AFFFCorra ou Morra^000000]";
        mes "Desculpe, o evento chegou ao seu número máximo de participantes.";
        close;
    }
    
    if (Class != Job_Novice) {
        mes "[Corra ou Morra]";
        mes "Desculpe, apenas ^4682B4Aprendizes^000000 podem participar do evento.";
        close;
    }

    if (BaseLevel != 1 || JobLevel != 1) {
        mes "[Corra ou Morra]";
        mes "Desculpe, apenas ^4682B4Aprendizes^000000 level ^FF00001/1^000000 podem participar do evento. ";
        mes "Fale com o menino ^20a53cDankar^000000 em prontera para lhe tornar um aprendiz.";
        close;
    }
    
    if(getvariableofnpc( .start, "RunOrDie" )) {
    mes "[Corra ou Morra]";
    mes "Olá, "+strcharinfo(0)+"! Seja bem-vind"+ (Sex?"o":"a") +" ao portal do evento Corra ou Morra!";
    mes    "Gostaria de participar ?";
    // next;
    if(select("- Participar do Evento:- Não, obrigado!") == 2) end;
    percentheal 100, 100;
    warp "poring_c01",103,100;
    set getvariableofnpc( .aid[ .@size ], "RunOrDie" ), getcharid(3);
    set getvariableofnpc( .aidtotal, "RunOrDie" ), getvariableofnpc( .aidtotal, "RunOrDie" ) +1;
    
    switch (.joinannounce) {
        case 1: mapannounce .map$, "O jogador [" + strcharinfo(0) + "] entrou no Corra ou Morra.",0,0xFFFF00; break;
        case 2: announce "O jogador [" + strcharinfo(0) + "] entrou no Corra ou Morra.",0,0xFFFF00; break;
    }

    end;
    } else {
    mes "[Corra ou Morra]";
    mes "Desculpe, o evento está fechado no momento.";
    mes "";
    mes "Os horários do evento são:";
    mes "- ^FF000000:00^000000 / ^FF000003:00^000000 / ^FF000006:00^000000 / ^FF000009:00^000000";
    mes "- ^FF000012:00^000000 / ^FF000015:00^000000 / ^FF000018:00^000000 / ^FF000021:00^000000";
    close;
    end;
    }
}

-    script    RunOrDie    -1,{
OnInit:
    // disablenpc "Corra ou Morra";
    bindatcmd "enablerd", "RunOrDie::OnJoinCommand", 99,100;
    .onesec = 1000; // use for script debugging... set to 100 to make the announcement run faster
    set .min2start,    5;    // Tempo (em minutos) para o início do evento após a abertura da entrada do evento
    setarray $@pr_flags[0],0,1,2,3,4,5,11,12,13,31,33,34,37,43,47,mf_nostorage,mf_noguildstorage;    // Lista de Mapflags.

    for(set .@y,0; .@y < getarraysize($@pr_flags); set .@y,.@y+1)
    setmapflag $@pr_mapa$,$@pr_flags[.@y];

    removemapflag $@pr_mapa$,6;            // Removendo mapflag pvp se estiver ativo no mapa.
    removemapflag $@pr_mapa$,9;            // Removendo mapflag gvg se estiver ativo no mapa.
    if (.min2start < 1) .min2start = 1;
    end;

OnJoinCommand:
OnClock1000:
OnClock1332:
    deletearray .aid;
    .aidtotal = 0;
    mapwarp "poring_c01", "prontera", 155,185;
    killmonsterall "poring_c01";
    
    
    for (.@i = .min2start; .@i; .@i--) {
        announce "[Corra ou Morra]: O Portal está aberto, em [" + .@i + "] minuto" + (.@i == 1 ? "" : "s") +
                " o evento será iniciado!",bc_all,0xFFFF00;
        .start = 1;
        sleep2 60000;
    }
    
    sleep 1000;

    announce "[Corra ou Morra]: O portal para o evento foi fechado.",bc_all,0xFFFF00;

    if ( .aidtotal < 2 ) { // cannot start event if nobody joins(0) or just having (1) player
        announce "[Corra ou Morra]: O evento foi cancelado, não há jogadores suficientes para continuar!",bc_all,0xFFFF00;
        mapwarp "poring_c01", "prontera", 152,151;
        deletearray .aid;
        .aidtotal = 0;
        .start = 0;
        end;
    }

    mapannounce "poring_c01", "[Corra ou Morra]: Bem-vindo ao evento Corra ou Morra!",bc_map,0xFFFF00;
    sleep 3 * .onesec;
    mapannounce "poring_c01", "[Corra ou Morra]: Para os jogadores que não conhecem este evento, é muito simples!",bc_map,0xFFFF00;
    sleep 3 * .onesec;
    mapannounce "poring_c01", "[Corra ou Morra]: Você precisa ficar longe de tudo o que você acha que é PERIGOSO!!",bc_map,0xFFFF00;
    sleep 3 * .onesec;
    mapannounce "poring_c01", "[Corra ou Morra]: Fique vivo, não importa como!",bc_map,0xFFFF00;
    sleep 3 * .onesec;
    mapannounce "poring_c01", "[Corra ou Morra]: O ÚLTIMO SOBREVIVENTE será o VENCEDOR",bc_map,0xFFFF00;
    sleep 3 * .onesec;
    mapannounce "poring_c01", "[Corra ou Morra]: O evento começará em 3....",bc_map,0xFFFF00;
    sleep 1 * .onesec;
    mapannounce "poring_c01", "[Corra ou Morra]: 2...",bc_map,0xFFFF00;
    sleep 1 * .onesec;
    mapannounce "poring_c01", "[Corra ou Morra]: 1..",bc_map,0xFFFF00;
    sleep 1 * .onesec;
    mapannounce "poring_c01", "[Corra ou Morra]: Comece a correr agora!",bc_map,0xFFFF00;
    while ( .start ) {
        .@more += rand(1,2);
        monster "poring_c01", 0,0, "[cRO] Bomb Poring", 1904, 2 + .@more, "", 0;
        monster "poring_c01", 0,0, "[cRO] Bomb Poring", 1904, 2 + .@more, "", 1;
        monster "poring_c01", 0,0, "[cRO] Bomb Poring", 1904, 2 + .@more, "", 2;
        sleep 5000;
    }
    end;
OnPCDieEvent:
OnPCLogoutEvent:
    if ( strcharinfo(3) == "poring_c01" && .start ) {
        if ( .aidtotal > 1 ) {
            for ( .@i = 0; .@i < .aidtotal; .@i++ ) {
                if ( getcharid(3) == .aid[.@i] ) {
                    deletearray .aid[.@i], 1;
                    .aidtotal--;
                    percentheal 100, 100;
                    dispbottom "[Corra ou Morra]: O evento chegou ao fim para você.";
                    warp "prontera",155,185;
                }
            }
        }
        if ( .aidtotal == 1 ) {
            .start = 0;
            killmonsterall "poring_c01";
            announce "[Corra ou Morra]: O Jogador ["+rid2name(.aid) +"] foi o último a sobreviver no evento Corra ou Morra e ganhou 1x "+getitemname(18200)+". Obrigado a todos que participaram.", 0;
            sleep 5000;
            if ( isloggedin( .aid ) ) {
                attachrid .aid;
                getitem 18200,1;
                warp "prontera", 155,185;
            }
            deletearray .aid;
            .aidtotal = 0;
        }
    }
    end;
}

Error:

erro.png

 

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  107
  • Reputation:   27
  • Joined:  02/12/14
  • Last Seen:  

Quando a variável não tem prefixo, ela é do tipo permanente para personagem, que no caso é esta mf_nostorage. Ela esta sendo utilizada dentro da label OnInit. Está label é chamada pelo servidor quando o NPC é carregado, e não por um jogador. Por isto esta tendo conflito.

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

this mapflag doesn't exists in your emulator or you didnt defined it as a constant.

mf_noguildstorage

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  26
  • Reputation:   1
  • Joined:  06/25/16
  • Last Seen:  

As all the others said,  you are creating an array with this items:

setarray $@pr_flags[0],0,1,2,3,4,5,11,12,13,31,33,34,37,43,47,mf_nostorage,mf_noguildstorage;    // Lista de Mapflags.

Under an OnInit label. So...

This will be executed as soon the server starts or the scripts are reloaded without any player attached.

The values mf_nostorage and mf_noguildstorage have the sintax of a character persistant variable but as no player is attached it cannot get those values.

Those mapflags apparently are not default ones... So... as Emistry said, you make them a constant or if you can, replace them by their number.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...