/admins
#1

(Rus)
как сделать чтобы при написании команды /admins высветилось диалоговое окошко сколько в игре админов в онлайн!

(Eng)
how to make when writing commands /admins get a dialog box much in the game admins online!
Reply
#2

For this you need ZCMD
https://sampforum.blast.hk/showthread.php?tid=91354

You also need to make a Stock with Name (if you already have a stock like this, then you won't need this just use the one you already have)

PHP код:
stock Name(playerid)
{
    new 
string[24];
    
GetPlayerName(playerid,string,24);
    new 
str[24];
    
strmid(str,string,0,strlen(string),24);
    for(new 
0MAX_PLAYER_NAMEi++)
    return 
str;

Power is enum of the admin level.


Here is the code of /admins:
PHP код:
COMMAND:admins(playerid)
{
    
SendClientMessage(playerid"Admins");
    for(new 
i=0;i<MAX_PLAYERS;i++)
    {
        if((
PlayerInfo[i][power] > && IsPlayerConnected(i) && PLAYERLIST_authed[i])
        {
                
SendClientMSG(playerid" %s %s (ID: %d)"Name(i), iPlayerInfo[i][power]);
            }
        }
    } 
I hope it helped you.
NB! This is not a dialog box, this sends it directly to your chatpage.
Reply
#3

pawn Код:
#define onadmin//on top

cmd:admins(playerid,parmas[])
{
new name[50],mess[150];
for(new i=0;i<=MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && IsPlayerAsmin(i))
{
GetPlayerName(i,name,sizeof(name));
format(mess,sizeof(mess),"%s\n%s",mess,name);
}}
ShowPlayerDialog(playerid,onadmin,DIALOG_STYLE_MSGBOX,"{00cc00}Online Admins",mess,"COOL","");
return 1;
}
Reply
#4

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
pawn Код:
#define onadmin//on top

cmd:admins(playerid,parmas[])
{
new name[50],mess[150];
for(new i=0;i<=MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && IsPlayerAsmin(i))
{
GetPlayerName(i,name,sizeof(name));
format(mess,sizeof(mess),"%s\n%s",mess,name);
}}
ShowPlayerDialog(playerid,onadmin,DIALOG_STYLE_MSGBOX,"{00cc00}Online Admins",mess,"COOL","");
return 1;
}
Код HTML:
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5782) : error 019: not a label: "cmd"
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5782) : warning 217: loose indentation
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5782) : error 017: undefined symbol "admins"
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5787) : error 017: undefined symbol "IsPlayerAsmin"
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : error 029: invalid expression, assumed zero
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : warning 215: expression has no effect
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : warning 215: expression has no effect
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : warning 215: expression has no effect
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : warning 215: expression has no effect
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : warning 215: expression has no effect
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : error 001: expected token: ";", but found ")"
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : error 029: invalid expression, assumed zero
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


7 Errors.
Reply
#5

You need the zcmd include in your pawno/include folder, then include it as you include a_samp.

Also, there's an orthographic mistake here :

IsPlayerAsmin

Think it stands for IsPlayerAdmin.
Reply
#6

Add this on top of your script
Код HTML:
#include <zcmd>
And then put this
Код HTML:
#define onadmin//on top

cmd:admins(playerid,parmas[])
{
new name[50],mess[150];
for(new i=0;i<=MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && IsPlayerAdmin(i))
{
GetPlayerName(i,name,sizeof(name));
format(mess,sizeof(mess),"%s\n%s",mess,name);
}}
ShowPlayerDialog(playerid,onadmin,DIALOG_STYLE_MSGBOX,"{00cc00}Online Admins",mess,"COOL","");
return 1;
}
Reply
#7

Код HTML:
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5782) : error 019: not a label: "cmd"
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5782) : error 017: undefined symbol "admins"
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : error 029: invalid expression, assumed zero
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : warning 215: expression has no effect
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : warning 215: expression has no effect
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : warning 215: expression has no effect
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : warning 215: expression has no effect
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : warning 215: expression has no effect
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : error 001: expected token: ";", but found ")"
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : error 029: invalid expression, assumed zero
F:\GTA\СЕРВ\samp03e_svr_r2_win3\gamemodes\LG.Games.pwn(5792) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#8

zCMDs commands have to be out of a callback (callbacks are like OnPlayerCommandText (they always begin with a public symbol). The reason is simple : each zCMD command is a callback in itself.

Try to create a callback into another and you'll get some errors.
Reply
#9

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
zCMDs commands have to be out of a callback (callbacks are like OnPlayerCommandText (they always begin with a public symbol). The reason is simple : each zCMD command is a callback in itself.

Try to create a callback into another and you'll get some errors.
for example, how ?
Reply
#10

Using "cmd:" is wrong. Use either:
pawn Код:
CMD:admins(playerid, parmas[])
or:
pawn Код:
cmd(admins, playerid, parmas[])
You'll need to include zcmd:
pawn Код:
#include <a_samp>
#include <zcmd>
and use them out of any callback. Just add them at the bottom of your script so you don't get confused.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)