Commands Problem
#1

Код:
CMD:acmds(playerid, params[])
{
    if(PlayerInfo[playerid][aLevel] < 1) return SendClientMessage(playerid, RED, "Invalid command. Type /cmds to see a list of available commands.");
    {
        ShowPlayerDialog(playerid, ACMDS_LIST, DIALOG_STYLE_MSGBOX , "{FFFFFF}NVCNR Admin Commands",
"{FFFFFF}Lvl4: /(h/b)cmds /set(score/level/vip/helper/hhelper/builder)\nLvl3: /restart /(ban)ip /set(wanted/health/armour/cash/skin) /get\nLvl2: /aweaps /car /force /jetpack /ban /afix /events /god(car) /goto /explode /ip /flip /akill /give(gun/cash)\nLvl1: /goto(at/cells) /(un)mute /nmute /®warn /kick /ann /asay /dcar /clearchat /addnos /disarm\nLvl1: /duty /a /(spec)off /cage /(un)freeze /ap /aranks /mutelist /(save/load)pos /exitat /plus /minus /undercover",
 "Ok", "");
    }
	return true;
}
make this lvl 1 only saw lvl 1 cmd and lvl 2 can saw lvl 2? can u make it like this and remove dailog.
Reply
#2

I'am sorry but your posting constantly and most of the times you haven't even attempted things yourself. KyleSmith is right, there is no point in you scripting a Gamemode due to you have very very little pawn knowledge. Try tutorials and build yourself up (skills). This will not happen over night, it will take time.
Reply
#3

Quote:

I'am sorry but your posting constantly and most of the times you haven't even attempted things yourself. KyleSmith is right, there is no point in you scripting a Gamemode due to you have very very little pawn knowledge. Try tutorials and build yourself up (skills). This will not happen over night, it will take time.

True. but ill help you this time only, because you always spam on Scripting help, try learn something here
https://sampwiki.blast.hk/wiki/Scripting_Basics

Do it like this :
pawn Код:
CMD:acmds(playerid)// you dont need params
{
if(PlayerInfo[playerid][aLevel] < 1)
{
//admin commands here
}
if(PlayerInfo[playerid][aLevel] < 2)
{
//admin commands here
}
if(PlayerInfo[playerid][aLevel] < 3)
{
//admin commands here
}
// and so on until until to your max admin level
return 1;
}
Reply
#4

thanks!
Reply
#5

Код:
CMD:acmds(playerid, params[])
{
if(PlayerInfo[playerid][aLevel] < 1)
SendClientMessage(playerid,LIGHTGREEN,"Your Admin Commands");
SendClientMessage(playerid,YELLOW,"duty /a - admin chat /(spec)off /cage /(un)freeze /ap /aranks /mutelist /goto /get /plus /minus");

if(PlayerInfo[playerid][aLevel] < 2)
SendClientMessage(playerid,LIGHTGREEN,"Your Admin Commands");
SendClientMessage(playerid,YELLOW,"duty /a - admin chat /(spec)off /cage /(un)freeze /ap /aranks /mutelist /goto /get /plus /minus /aweaps /car /force /jetpack /ban /afix /events /god(car) /explode /ip /flip /akill /give(gun/cash) /(un)mute /nmute /®warn - ruleswarn /kick /ann /asay /dcar /clearchat /addnos /disarm");

if(PlayerInfo[playerid][aLevel] < 3)
SendClientMessage(playerid,LIGHTGREEN,"Your Admin Commands");
SendClientMessage(playerid,YELLOW,"duty /a - admin chat /(spec)off /cage /(un)freeze /ap /aranks /mutelist /goto /get /plus /minus /aweaps /car /force /jetpack /ban /afix /events /god(car) /explode /ip /flip /akill /give(gun/cash) /(un)mute /nmute /®warn - ruleswarn /kick /ann /asay /dcar /clearchat /addnos /disarm /(ban)ip /set(wanted/health/armour/cash/skin)");

if(PlayerInfo[playerid][aLevel] < 4)
SendClientMessage(playerid,LIGHTGREEN,"Your Admin Commands");
SendClientMessage(playerid,YELLOW,"duty /a - admin chat /(spec)off /cage /(un)freeze /ap /aranks /mutelist /goto /get /plus /minus /aweaps /car /force /jetpack /ban /afix /events /god(car) /explode /ip /flip /akill /give(gun/cash) /(un)mute /nmute /®warn - ruleswarn /kick /ann /asay /dcar /clearchat /addnos /disarm /(ban)ip /set(wanted/health/armour/cash/skin) /(h/b)cmds - house/biz /set(score/level/vip/helper/hhelper - head helper/builder /restart");
return 1;
}
they show only lvl 1 cmds can u help me?
Reply
#6

Use switch(); its faster.

pawn Код:
CMD:acmds(playerid, params[])
{
    switch(PlayerInfo[playerid][aLevel])
    {
        case 1:
        {
            // SendClientMessage(...
        }
        case 2:
        {
            // SendClientMessage(...
        }
        case 3:
        {
            // SendClientMessage(...
        }
        case 4:
        {
            // SendClientMessage(...
        }
        case 5:
        {
            // SendClientMessage(...
        }
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by sscarface
Посмотреть сообщение
Код:
CMD:acmds(playerid, params[])
{
if(PlayerInfo[playerid][aLevel] < 1)
SendClientMessage(playerid,LIGHTGREEN,"Your Admin Commands");
SendClientMessage(playerid,YELLOW,"duty /a - admin chat /(spec)off /cage /(un)freeze /ap /aranks /mutelist /goto /get /plus /minus");

if(PlayerInfo[playerid][aLevel] < 2)
SendClientMessage(playerid,LIGHTGREEN,"Your Admin Commands");
SendClientMessage(playerid,YELLOW,"duty /a - admin chat /(spec)off /cage /(un)freeze /ap /aranks /mutelist /goto /get /plus /minus /aweaps /car /force /jetpack /ban /afix /events /god(car) /explode /ip /flip /akill /give(gun/cash) /(un)mute /nmute /®warn - ruleswarn /kick /ann /asay /dcar /clearchat /addnos /disarm");

if(PlayerInfo[playerid][aLevel] < 3)
SendClientMessage(playerid,LIGHTGREEN,"Your Admin Commands");
SendClientMessage(playerid,YELLOW,"duty /a - admin chat /(spec)off /cage /(un)freeze /ap /aranks /mutelist /goto /get /plus /minus /aweaps /car /force /jetpack /ban /afix /events /god(car) /explode /ip /flip /akill /give(gun/cash) /(un)mute /nmute /®warn - ruleswarn /kick /ann /asay /dcar /clearchat /addnos /disarm /(ban)ip /set(wanted/health/armour/cash/skin)");

if(PlayerInfo[playerid][aLevel] < 4)
SendClientMessage(playerid,LIGHTGREEN,"Your Admin Commands");
SendClientMessage(playerid,YELLOW,"duty /a - admin chat /(spec)off /cage /(un)freeze /ap /aranks /mutelist /goto /get /plus /minus /aweaps /car /force /jetpack /ban /afix /events /god(car) /explode /ip /flip /akill /give(gun/cash) /(un)mute /nmute /®warn - ruleswarn /kick /ann /asay /dcar /clearchat /addnos /disarm /(ban)ip /set(wanted/health/armour/cash/skin) /(h/b)cmds - house/biz /set(score/level/vip/helper/hhelper - head helper/builder /restart");
return 1;
}
they show only lvl 1 cmds can u help me?
Seriously? You are not closing the brackets of those if statements.

Should be
pawn Код:
if(PlayerInfo[playerid][aLevel] ==1 )
{
    Your dialog here
}
 if(PlayerInfo[playerid][aLevel] ==2 )
{
    Your dialog here
}

//and so on
Plus: Every single player would be able to see admin level 1 commands because you wrote if(PlayerInfo[playerid][aLevel] < 1) That means that if my admin level is less than 1, I will get the dialog with the commmands. Should be ==
CHECK SOME TUTORIALS!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)