Jump to content
  • 0

Can't use command outside mapflag


Imbecile

Question


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  52
  • Reputation:   1
  • Joined:  04/14/17
  • Last Seen:  

Hello. So i want to make players can't use commands like @storage, @load or @go on pvp and gvg mapflag but still can use @refresh. So I use this script

 

```

-    script    atcommand_main    -1,{
    OnAtStorage:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom .@atcmd_command$ + " failed in PVP/GVG maps";
        }
        else {
            openstorage;
        }
        end;
        
    OnAtLoad:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom .@atcmd_command$ + " failed in PVP/GVG maps";
        }
        else {
            warp "SavePoint", 0, 0;
        }
        end;
        
    OnAtGo:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom .@atcmd_command$ + " failed in PVP/GVG maps";
        }
        else {
            // Implement go logic if needed
        }
        end;

    OnInit:
        // Binding @storage, @load, and @go commands
        bindatcmd "storage", strnpcinfo(3) + "::OnAtStorage";
        bindatcmd "load", strnpcinfo(3) + "::OnAtLoad";
        bindatcmd "go", strnpcinfo(3) + "::OnAtGo";
        end;
}```

 

but the problem is that the commands @storage, @load, and @go can't be used outside the PVP and gvg mapflag. can someone please help me?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  383
  • Reputation:   78
  • Joined:  10/30/12
  • Last Seen:  

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  52
  • Reputation:   1
  • Joined:  04/14/17
  • Last Seen:  

9 hours ago, mrfizi said:

hello sir. do you mean creating new mapflag?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  78
  • Reputation:   19
  • Joined:  12/24/18
  • Last Seen:  

21 hours ago, Imbecile said:

Hello. So i want to make players can't use commands like @storage, @load or @go on pvp and gvg mapflag but still can use @refresh. So I use this script

 

```

-    script    atcommand_main    -1,{
    OnAtStorage:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom .@atcmd_command$ + " failed in PVP/GVG maps";
        }
        else {
            openstorage;
        }
        end;
        
    OnAtLoad:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom .@atcmd_command$ + " failed in PVP/GVG maps";
        }
        else {
            warp "SavePoint", 0, 0;
        }
        end;
        
    OnAtGo:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom .@atcmd_command$ + " failed in PVP/GVG maps";
        }
        else {
            // Implement go logic if needed
        }
        end;

    OnInit:
        // Binding @storage, @load, and @go commands
        bindatcmd "storage", strnpcinfo(3) + "::OnAtStorage";
        bindatcmd "load", strnpcinfo(3) + "::OnAtLoad";
        bindatcmd "go", strnpcinfo(3) + "::OnAtGo";
        end;
}```

 

but the problem is that the commands @storage, @load, and @go can't be used outside the PVP and gvg mapflag. can someone please help me?

 

Try not tested

 

-	script	atcommand_main	-1,{
    
    OnAtStorage:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        // Check if player is in PVP or GVG map
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom "You cannot use @storage in PVP/GVG maps.";
        }
        else {
            openstorage;
        }
        end;
        
    OnAtLoad:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        // Check if player is in PVP or GVG map
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom "You cannot use @load in PVP/GVG maps.";
        }
        else {
            warp "SavePoint", 0, 0;
        }
        end;
        
    OnAtGo:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        // Check if player is in PVP or GVG map
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom "You cannot use @go in PVP/GVG maps.";
        }
        else {
            // Implement go logic if needed
        }
        end;

    // Bind the commands to their respective NPC scripts
    OnInit:
        bindatcmd "storage", strnpcinfo(3) + "::OnAtStorage";
        bindatcmd "load", strnpcinfo(3) + "::OnAtLoad";
        bindatcmd "go", strnpcinfo(3) + "::OnAtGo";
        end;
}

 

Edited by Mice
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  52
  • Reputation:   1
  • Joined:  04/14/17
  • Last Seen:  

On 12/2/2024 at 2:49 AM, Mice said:

 

Try not tested

 

-	script	atcommand_main	-1,{
    
    OnAtStorage:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        // Check if player is in PVP or GVG map
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom "You cannot use @storage in PVP/GVG maps.";
        }
        else {
            openstorage;
        }
        end;
        
    OnAtLoad:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        // Check if player is in PVP or GVG map
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom "You cannot use @load in PVP/GVG maps.";
        }
        else {
            warp "SavePoint", 0, 0;
        }
        end;
        
    OnAtGo:
        // Check GM level before proceeding
        if (getgmlevel() < 90) {
            dispbottom "You must be GM level 90 or above to use this command!";
            end;
        }
        .@map$ = strcharinfo(3);
        // Check if player is in PVP or GVG map
        if (getmapflag(.@map$, mf_pvp) || getmapflag(.@map$, mf_gvg)) {
            dispbottom "You cannot use @go in PVP/GVG maps.";
        }
        else {
            // Implement go logic if needed
        }
        end;

    // Bind the commands to their respective NPC scripts
    OnInit:
        bindatcmd "storage", strnpcinfo(3) + "::OnAtStorage";
        bindatcmd "load", strnpcinfo(3) + "::OnAtLoad";
        bindatcmd "go", strnpcinfo(3) + "::OnAtGo";
        end;
}

 

hello sir. thank you for being so helpful. when I'm using the script you gave me, it makes other players can't use @go, @load and @storage anywhere lol. so I decided not using it. thank you for your help @Mice ❤️

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...