Admin Message -
DuarteCambra - 22.03.2013
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.
Re: Admin Message -
[DX]Aru12345 - 24.03.2013
What enum are you using. Or using RCON admin system?
Re: Admin Message -
vitorvlv - 24.03.2013
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;
}
Re: Admin Message -
Denying - 24.03.2013
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.
Re: Admin Message -
DuarteCambra - 24.03.2013
if(PlayerInfo[playerid][pAdmin] >= 1)
Re: Admin Message -
vitorvlv - 24.03.2013
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;
}
Re: Admin Message -
FunnyBear - 24.03.2013
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;
}
Re: Admin Message -
vitorvlv - 24.03.2013
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
Re: Admin Message -
vitorvlv - 24.03.2013
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.
Re: Admin Message -
DuarteCambra - 24.03.2013
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?