22.03.2009, 08:19
hey, iv tried adding to my script the view or see cmds and pms thing like ladmin and other admin scripts. is there a way i could add this to a fs or my game mode? and how
Kinetic ~ /me does this.
Register: Kinetic ~ 192.168.0.1 Login: Kinetic ~ 192.168.0.1
forward SendAdminMessage(color, string[]);
public SendAdminMessage(color, string[])
{
for(new i=0; i<=GetMaxPlayers(); i++)
{
if(IsPlayerAdmin(i))
{
SendClientMessage(i, color, string);
}
}
return 1;
}
if(strcmp("/command", cmdtext, true) == 0)
{
new str[64];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "%s(ID:%d) typed the /command command", name, playerid);
SendAdminMessage(0xffffffff, str);
return 1;
}
Originally Posted by Kinetic
Ah, ok, I understand. Well first thing you have to do is make the SendAdminMessage function
pawn Код:
pawn Код:
|
public OnPlayerCommandText(playerid, cmdtext[])
{
new pName[MAX_PLAYER_NAME],string[256];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
for(new i=0; i<=GetMaxPlayers(); i++)
{
if(IsPlayerAdmin(i))
{
format(string,sizeof(string),"%s(id:%d) typed the command %s",pName,playerid,cmdtext);
SendClientMessage(i,0xffffffff,string);
}
}
//Your commands here...
return 0;
}
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
new pNameRec[MAX_PLAYER_NAME],pNameSend[MAX_PLAYER_NAME],string[256];
GetPlayerName(playerid,pNameRec,MAX_PLAYER_NAME);
GetPlayerName(playerid,pNameSend,MAX_PLAYER_NAME);
for(new i=0; i<=GetMaxPlayers(); i++)
{
if(IsPlayerAdmin(i))
{
format(string,sizeof(string),"%s(id:%d) sent the message "%s" to %s(id:%d)",pNameSend,playerid,text,pNameRec,recieverid);
SendClientMessage(i,0xffffffff,string);
}
}
return 1;
}