Continue in somewhere down in a callback
#1

Hey guys,
I have a 'config' command, which sets some things for the server. But now i want a admin config, and a normal person config. I know you can just do 'if( adminthing == 5 )', and if youre not a level 5 admin it shows you a message. But i want it that it shows the dialog, but not the admin dialog.
pawn Код:
YCMD:config(playerid, params[], help)
{
    #pragma unused help
    if( !strcmp(params, "admin", true ) )
    {
        if( AIsPlayerHeadAdmin( playerid ) )
        {
       
        } else continue at Notadmin; // when youre not an head admin, it continues at 'Notadmin'
    }
    else
    {
        Notadmin // Notadmin is right here, and it should continue to those things down
        new Info[256], UOW[14], RPM[14];
        switch( WeaponInfo[playerid][pUseOwn] )
        {
            case 0: UOW = ""C_RED"false";
            case 1: UOW = ""C_GREEN"true";
        }
        switch( PlayerInfo[playerid][pReceivePM] )
        {
            case 0: RPM = ""C_RED"false";
            case 1: RPM = ""C_GREEN"true";
        }
        format( Info, sizeof Info, ""C_WHITE"Use own weapons: %s \n"C_WHITE"Receive pm's: %s", UOW, RPM );
        ShowPlayerDialog(playerid, CONFIGEDIT, DIALOG_STYLE_LIST, "Configuration Dialog", Info, "Change", "Save");
    }
   
    return 1;
}
It should be possible, and i know a way how it can be done, but is there a complexer way to do this?
The thing what i had in mind was:
pawn Код:
YCMD:config(playerid, params[], help)
{
    #pragma unused help
    if( !strcmp(params, "admin", true ) )
    {
        if( AIsPlayerHeadAdmin( playerid ) )
        {
       
        }
        else
        {
            new Info[256], UOW[14], RPM[14];
            switch( WeaponInfo[playerid][pUseOwn] )
            {
                case 0: UOW = ""C_RED"false";
                case 1: UOW = ""C_GREEN"true";
            }
            switch( PlayerInfo[playerid][pReceivePM] )
            {
                case 0: RPM = ""C_RED"false";
                case 1: RPM = ""C_GREEN"true";
            }
            format( Info, sizeof Info, ""C_WHITE"Use own weapons: %s \n"C_WHITE"Receive pm's: %s", UOW, RPM );
            ShowPlayerDialog(playerid, CONFIGEDIT, DIALOG_STYLE_LIST, "Configuration Dialog", Info, "Change", "Save");
        }
    }
    else
    {
        new Info[256], UOW[14], RPM[14];
        switch( WeaponInfo[playerid][pUseOwn] )
        {
            case 0: UOW = ""C_RED"false";
            case 1: UOW = ""C_GREEN"true";
        }
        switch( PlayerInfo[playerid][pReceivePM] )
        {
            case 0: RPM = ""C_RED"false";
            case 1: RPM = ""C_GREEN"true";
        }
        format( Info, sizeof Info, ""C_WHITE"Use own weapons: %s \n"C_WHITE"Receive pm's: %s", UOW, RPM );
        ShowPlayerDialog(playerid, CONFIGEDIT, DIALOG_STYLE_LIST, "Configuration Dialog", Info, "Change", "Save");
    }
   
    return 1;
}
But as you can see, the command will be huge.

~Wesley
Reply
#2

https://sampwiki.blast.hk/wiki/Keywords:Statements#goto
Reply
#3

Exactly what i was looking for!
Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)