27.07.2013, 18:33
This is my /o and /noooc, but I got some issues with the commands. As an admin I may talk all the time on /o, that is what I want. But when I /noooc (enables it) the players should be able to write in /o so everyone can see it. But it doesn't happen. Because when they are using it, either if it's enabled or disabled, it says they are not authorized. I cannot find the problem here, mind helping me?
Also what is wrong with this command? I can't get it.
This is the two lines:
Whole kick command:
pawn Код:
CMD:o(playerid, params[])
{
new sendername[MAX_PLAYER_NAME], string[160];
if(!(PlayerInfo[playerid][pAdmin] >= 1)) return SendClientMessage(playerid, COLOR_NOAUTH, "You are not authorized to use this command.");
if(isnull(params)) return SendClientMessage(playerid, COLOR_NOAUTH,"USAGE: /o [chat]");
if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "The OOC channel has been disabled by an administrator.");
return 1;
}
GetPlayerName(playerid,sendername,sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string,160,"[OOC]: %s: %s", sendername, params);
printf("%s", string);
OOCOff(COLOR_OOC,string);
return 1;
}
CMD:noooc(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 1 && (!noooc))
{
noooc = 1;
SendClientMessageToAll(COLOR_GRAD2, "The OOC chat has been disabled by an admin.");
}
else if (PlayerInfo[playerid][pAdmin] >= 1 && (noooc))
{
noooc = 0;
SendClientMessageToAll(COLOR_GRAD2, "The OOC chat has been enabled by an admin.");
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
}
return 1;
}
public OOCOff(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!gOoc[i])
{
SendClientMessage(i, color, string);
}
}
}
}
pawn Код:
error 035: argument type mismatch (argument 2)
error 035: argument type mismatch (argument 2)
pawn Код:
if(sscanf(params,"uz",id,reason)) return SendClientMessage(playerid, COLOR_GREY,"USAGE: /kick [playerid/partofname] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY,"Invalid player id");
pawn Код:
CMD:kick(playerid,params[])
{
new id,name1[MAX_PLAYER_NAME], reason[35],name2[MAX_PLAYER_NAME], string[128];
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_NOAUTH,"You are not authorized to use this command.");
if(sscanf(params,"uz",id,reason)) return SendClientMessage(playerid, COLOR_GREY,"USAGE: /kick [playerid/partofname] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY,"Invalid player id");
else
{
GetPlayerName(playerid,name1,sizeof(name1));
GetPlayerName(id,name2,sizeof(name2));
format(string, sizeof(string),"AdmCmd: %s was kicked by %s, reason: %s",name2,name1,reason);
SendClientMessageToAll(COLOR_LIGHTRED,string);
Kick(id);
}
return 1;
}