Jump to content
  • 0

Can't use command outside mapflag


Question

Posted

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?

4 answers to this question

Recommended Posts

  • 0
Posted (edited)
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
  • 0
Posted
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 ❤️

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...