Admin Message
#1

Hello, everyone. I was wondering how could I make an Admin Message Chat, where normal players can use to talk to admins, and the command would be like /a(dmin)m(essage).
The command usage could be like: /am (text) for players and /am (id) (text) for admins.
Reply
#2

What enum are you using. Or using RCON admin system?
Reply
#3

that?
pawn Код:
CMD:talkadmins(playerid,params[])
{
new string[144],name[MAX_PLAYER_NAME];
if(sscanf(params,"s",string)) return SendClientMessage(playerid,red,"Use /talkadmins [text]");
for (new i; i < MAX_PLAYERS; i++)
    {
     GetPlayerName(playerid,name,sizeof(name));    
if(yourvariable[i][variabletoyouradministrator] >0)
{
format(string,sizeof(string),"[Admin Talk]%s:%s",name,string);
SendClientMessage(i,color,string);
       }
    }
return true;
}
Reply
#4

Quote:
Originally Posted by vitorvlv
Посмотреть сообщение
that?
pawn Код:
CMD:talkadmins(playerid,params[])
{
new string[144],name[MAX_PLAYER_NAME];
if(sscanf(params,"s",string)) return SendClientMessage(playerid,red,"Use /talkadmins [text]");
for (new i; i < MAX_PLAYERS; i++)
    {
     GetPlayerName(playerid,name,sizeof(name));    
if(yourvariable[i][variabletoyouradministrator] >0)
{
format(string,sizeof(string),"[Admin Talk]%s:%s",name,string);
SendClientMessage(i,color,string);
       }
    }
return true;
}
This doesn't support any admin system plus it's a mess.
Reply
#5

if(PlayerInfo[playerid][pAdmin] >= 1)
Reply
#6

Quote:
Originally Posted by Denying
Посмотреть сообщение
This doesn't support any admin system plus it's a mess.
just replace the variables, nothing too complicated here works perfectly.
Quote:
Originally Posted by DuarteCambra
Посмотреть сообщение
if(PlayerInfo[playerid][pAdmin] >= 1)
i put your variables

pawn Код:
CMD:talkadmins(playerid,params[])
{
new string[144],name[MAX_PLAYER_NAME];
if(sscanf(params,"s",string)) return SendClientMessage(playerid,-1,"Use /talkadmins [text]");
for (new i; i < MAX_PLAYERS; i++)
{
GetPlayerName(playerid,name,sizeof(name));
if(PlayerInfo[i][pAdmin] >= 1)
{
format(string,sizeof(string),"[Admin Talk]%s:%s",name,string);
SendClientMessage(i,-1,string);
}
SendClientMessage(playerid,-1,"Your message was sent to administrators");
}
return true;
}
Reply
#7

You need the sscanf include, then #include <sscanf> at the top of your script!

pawn Код:
CMD:cm(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1 )
        return SendClientMessage(playerid, -1, "You are not an admin!"); // Change

    new
        text[128];

    if(sscanf(params, "s", text))
        return SendClientMessage(playerid, -1, "USAGE: /cm [Message]");
       
    new
        text1[128];
    format(text1, sizeof(text1), "Admin %s says: %s", GetName(playerid), text);
    SendClientMessageToAll(-1, text1);
    return 1;
}
Reply
#8

Quote:
Originally Posted by FunnyBear
Посмотреть сообщение
You need the sscanf include, then #include <sscanf> at the top of your script!

pawn Код:
CMD:cm(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1 )
        return SendClientMessage(playerid, -1, "You are not an admin!"); // Change

    new
        text[128];

    if(sscanf(params, "s", text))
        return SendClientMessage(playerid, -1, "USAGE: /cm [Message]");
       
    new
        text1[128];
    format(text1, sizeof(text1), "Admin %s says: %s", GetName(playerid), text);
    SendClientMessageToAll(-1, text1);
    return 1;
}
He wants the player to talk to the admins, not the admins talk to all players
Reply
#9

For Players
pawn Код:
CMD:talkadmins(playerid,params[])
{
new string[144],name[MAX_PLAYER_NAME];
if(sscanf(params,"s",string)) return SendClientMessage(playerid,-1,"Use /talkadmins [text]");
for (new i; i < MAX_PLAYERS; i++)
{
GetPlayerName(playerid,name,sizeof(name));
if(PlayerInfo[i][pAdmin] >= 1)
{
format(string,sizeof(string),"[Admin Talk]%s:%s",name,string);
SendClientMessage(i,-1,string);
}
SendClientMessage(playerid,-1,"Your message was sent to administrators");
}
return true;
}
For Admins
pawn Код:
CMD:talkplayer(playerid,params[])
{
new string[144],name[MAX_PLAYER_NAME],targetid;
if(sscanf(params,"us",string)) return SendClientMessage(playerid,-1,"Use /talkplayer [id] [text]");
if(PlayerInfo[playerid][pAdmin] <1) return SendClientMessage(playerid,-1,"You are not administrator");
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"Admin %s told you: %s",name,text);
SendClientMesage(id,-1,string);
return true;
}
remembering what the friend said above is correct, you need zcmd and sscanf2.
Reply
#10

Quote:
Originally Posted by vitorvlv
Посмотреть сообщение
For Players
pawn Код:
CMD:talkadmins(playerid,params[])
{
new string[144],name[MAX_PLAYER_NAME];
if(sscanf(params,"s",string)) return SendClientMessage(playerid,-1,"Use /talkadmins [text]");
for (new i; i < MAX_PLAYERS; i++)
{
GetPlayerName(playerid,name,sizeof(name));
if(PlayerInfo[i][pAdmin] >= 1)
{
format(string,sizeof(string),"[Admin Talk]%s:%s",name,string);
SendClientMessage(i,-1,string);
}
SendClientMessage(playerid,-1,"Your message was sent to administrators");
}
return true;
}
For Admins
pawn Код:
CMD:talkplayer(playerid,params[])
{
new string[144],name[MAX_PLAYER_NAME],targetid;
if(sscanf(params,"us",string)) return SendClientMessage(playerid,-1,"Use /talkplayer [id] [text]");
if(PlayerInfo[playerid][pAdmin] <1) return SendClientMessage(playerid,-1,"You are not administrator");
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"Admin %s told you: %s",name,text);
SendClientMesage(id,-1,string);
return true;
}
remembering what the friend said above is correct, you need zcmd and sscanf2.
That's basicly it, but couldn't it be /am for both admins and players? To admins it would be /am [id] [text] and to players would be like /am [text], any way I could do that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)