#1

i need commant /ask and type and go message admin can help me?
Reply
#2

Your admin level variable is..? Simply, how do you check if a player is admin in your commands?
Reply
#3

Quote:
Originally Posted by antonisrodos94
Посмотреть сообщение
i need commant /ask and type and go message admin can help me?
You could do like this, if you want a player to have ability to send a message to admins:-

pawn Код:
COMMAND:ask(playerid, params[])
{
    new Fstring[164], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    if(sscanf(params, "s[128]", Fstring))
    {
        SendClientMessage(playerid,  -1, "ERROR: Usage /ask [message]");
        return 1;
    }
    else
    {
        for(new f = 0; f < MAX_PLAYERS; f++)
        {
            if(IsPlayerConnected(f))
            {
                if(IsPlayerAdmin(f)) // you could change into your own admin system
                {
                    format(Fstring, sizeof(Fstring), "(PM TO ADMINS) %s: %s ", name, Fstring);
                    SendClientMessage(f, -1, Fstring);
                }
            }
        }
    }
    return 1;
}
Give it a try and tell me if it works.

-FalconX
Reply
#4

2 error can fix?


C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6602) : error 017: undefined symbol "ask"
C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6606) : error 017: undefined symbol "sscanf"
C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6634) : warning 225: unreachable code
C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6602) : warning 203: symbol is never used: "COMMAND"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#5

pawn Код:
if(!strcmp(cmdtext, "/ask", true, 4)) {
    new str[128], pName[24];
    GetPlayerName(playerid, pName, 24);
    format(str, sizeof str, "%s asked: %s", pName, cmdtext[5]);
    for(new i=0; i<MAX_PLAYERS;++i) {
        if(IsPlayerAdmin(i)) { // You might need your alevel variable if you're using an admin script!
            SendClientMessage(i, -1, str);
        }
    }
    return 1;
}
Reply
#6

C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6603) : warning 219: local variable "pName" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.

can i fix this warning?
Reply
#7

Quote:
Originally Posted by antonisrodos94
Посмотреть сообщение
C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6603) : warning 219: local variable "pName" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.

can i fix this warning?
Change the name of the variable, make it "pname" instead of "pName".pName is already created somewhere in your script that's why it's warning you for duplicity.
Reply
#8

It should be pName[MAX_PLAYER_NAME]
Reply
#9

Thanks all for Help!!
Reply
#10

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
It should be pName[MAX_PLAYER_NAME]
No, MAX_PLAYER_NAME equals 24 so it's the same.

pName[MAX_PLAYER_NAME] is the same as pName[24].

From a_samp.inc:
pawn Код:
#define MAX_PLAYER_NAME (24)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)