/o issues? [UPDATED]
#1

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?

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);
            }
        }
    }
}
Also what is wrong with this command? I can't get it.
pawn Код:
error 035: argument type mismatch (argument 2)
error 035: argument type mismatch (argument 2)
This is the two lines:
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");
Whole kick command:
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;
}
Reply
#2

You shall explain better...
Reply
#3

pawn Код:
if(!(PlayerInfo[playerid][pAdmin] >= 1)) return SendClientMessage(playerid, COLOR_NOAUTH, "You are not authorized to use this command.");
If you look closely, you can see that you make it so players with admin level 0 receive this message.
not >= 1 is 0 or less. That is why normal players can't use /o.
Reply
#4

Quote:
Originally Posted by MellowHammer
Посмотреть сообщение
pawn Код:
if(!(PlayerInfo[playerid][pAdmin] >= 1)) return SendClientMessage(playerid, COLOR_NOAUTH, "You are not authorized to use this command.");
If you look closely, you can see that you make it so players with admin level 0 receive this message.
not >= 1 is 0 or less. That is why normal players can't use /o.
The thing is that I want the players to use /o when it is enabled and not disable. The admins can use it all the time, and that is correct. But when it is enabled they should get permissions to use it, and not when it's disabled though. Just the admins shall get permissions to use it all the time, if I am editing that - all the players may use it all the time I guess?
Reply
#5

Forgot you have this in the code?
pawn Код:
if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
    {
        SendClientMessage(playerid, COLOR_GRAD2, "The OOC channel has been disabled by an administrator.");
        return 1;
    }
That prevents from NORMAL PLAYERS ONLY to use it when it's disabled.
Reply
#6

Quote:
Originally Posted by MellowHammer
Посмотреть сообщение
Forgot you have this in the code?
pawn Код:
if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
    {
        SendClientMessage(playerid, COLOR_GRAD2, "The OOC channel has been disabled by an administrator.");
        return 1;
    }
That prevents from NORMAL PLAYERS ONLY to use it when it's disabled.
Oh lol sorry for that, noticed it now. Thank you I will try it as soon as the CMD:kick has been fixed, updated the topic. Guess you know how to fix that aswell? I really appreciate your help. Repuation + for that mate.
Reply
#7

Wanna link me to that thread?
Reply
#8

Quote:
Originally Posted by MellowHammer
Посмотреть сообщение
Wanna link me to that thread?
I updated it in this thread, so you might see it here. Below the other /o issue
Reply
#9

Try s instead of z
pawn Код:
if(sscanf(params,"us",id,reason)) return SendClientMessage(playerid, COLOR_GREY,"USAGE: /kick [playerid/partofname] [reason]");
Reply
#10

Quote:
Originally Posted by Necip
Посмотреть сообщение
Try s instead of z
pawn Код:
if(sscanf(params,"us",id,reason)) return SendClientMessage(playerid, COLOR_GREY,"USAGE: /kick [playerid/partofname] [reason]");
Got the same errors.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)