Few problems
#1

I got few problems with my commands in zcmd.
here are some screenies:

Im not sure if u are able to see it but my command /setadmin [ID] [LEVEL] is messed up a bit.
When I do it on someone it says to me [Admin *Admin Name* Made you a Admin*] but it suppouse to say to the person I made admin not to me?

here is the pawn cmd
pawn Код:
}
CMD:setadmin(playerid, params[])
{
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][Admin] >= 9)
            {
                new sendername[MAX_PLAYER_NAME];
                new giveplayername[MAX_PLAYER_NAME];
                new giveplayerid,level;
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
                if (!sscanf(params, "ii", giveplayerid,level))
                {
                    if (giveplayerid != INVALID_PLAYER_ID)
                        {
                                new string[128];
                                format(string, sizeof(string), "The admin %s has made you a level %d admin",sendername,level);
                                        SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                                        format(string, sizeof(string), "You have made %s a level %d admin",giveplayername,level);
                                        SendClientMessage(playerid, COLOR_YELLOW, string);
                                        PlayerInfo[giveplayerid][Admin] = level;
                                }
                        }
                        else SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/setadmin [playerid] [level]");
                }
                else SendClientMessage(playerid, COLOR_RED1, "You are not a Community Staff Member! Or Your Level is too low!");
        }
        return 1;
}
And here is other one aka /kick, same as /setadmin it sends to wrong person. Im sorry for the small pictures :/

Here is pawn source for kick

pawn Код:
CMD:kick(playerid,params[])
    {
        if(PlayerInfo[playerid][Admin] >=2)
        {
            new id,n[MAX_PLAYER_NAME],reason[35], on[MAX_PLAYER_NAME], string[128], string2[128];
            if(sscanf(params,"uz",id, reason)) return SendClientMessage(playerid,COLOR_GREY,"SYNTAX:/kick [ID] [reason]");
            else if(playerid == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_YELLOW,"Player not found");
            else
            {
            GetPlayerName(playerid,n,sizeof(n));
            GetPlayerName(id,on,sizeof(on));
            format(string,sizeof(string),"You have been kicked by Admin: %s for: %s",n,reason);
            SendClientMessage(playerid,COLOR_RED,string);
            format(string2, sizeof(string), "Admin Action: %s has kicked %s for: %s",n,on,reason);
            SendClientMessageToAll(COLOR_RED,string2);
            Kick(id);
            }
        }
        else return SendClientMessage(playerid,COLOR_RED1, "You are not a Community Staff Member! Or Your Level is too low!");
        return 1;
    }
If you need to see them beter right click open them Hold CTRL and move your mouse wheel forward.

Could anyone help me fixing it?

EDIT: I got one more problem:
pawn Код:
CMD:ask(playerid, params[])
{
       new question[128], pname[24];
       if(sscanf(params, "s[128]", question))
       {
                SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/ask <question>");
       }
       else
       {
               GetPlayerName(playerid, pname, 24);
               for(new i = 0; i<MAX_PLAYERS; i++)
               {
                      if(IsPlayerConnected(i) && IsPlayerAdmin(i))
                      {
                              new str[128];
                              format(str, sizeof(str), "Question From %s(%d) : %s", pname, playerid, question)
                              SendClientMessage(i, COLOR_LEMON, str);
                      }
                }
         }
        return 1;
}
Gives me error
pawn Код:
TC-RP1.pwn(576) : error 001: expected token: ";", but found "-identifier-"
Reply
#2

pawn Код:
CMD:setadmin(playerid, params[])
{
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][Admin] >= 9)
            {
                new sendername[MAX_PLAYER_NAME];
                new giveplayername[MAX_PLAYER_NAME];
                new giveplayerid,level;
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
                if (!sscanf(params, "ui", giveplayerid,level)) //u = username.
                {
                    if (giveplayerid != INVALID_PLAYER_ID)
                        {
                                new string[128];
                                format(string, sizeof(string), "The admin %s has made you a level %d admin",sendername,level);
                                        SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                                        format(string, sizeof(string), "You have made %s a level %d admin",giveplayername,level);
                                        SendClientMessage(playerid, COLOR_YELLOW, string);
                                        PlayerInfo[giveplayerid][Admin] = level;
                                }
                        }
                        else SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/setadmin [playerid] [level]");
                }
                else SendClientMessage(playerid, COLOR_RED1, "You are not a Community Staff Member! Or Your Level is too low!");
        }
        return 1;
}
You're missing an ; at the end of your code.

pawn Код:
CMD:ask(playerid, params[])
{
       new question[128], pname[24];
       if(sscanf(params, "s[128]", question))
       {
                SendClientMessage(playerid, COLOR_GREY, "SYNTAX:/ask <question>");
       }
       else
       {
               GetPlayerName(playerid, pname, 24);
               for(new i = 0; i<MAX_PLAYERS; i++)
               {
                      if(IsPlayerConnected(i) && IsPlayerAdmin(i))
                      {
                              new str[128];
                              format(str, sizeof(str), "Question From %s(%d) : %s", pname, playerid, question); //<----- here
                              SendClientMessage(i, COLOR_LEMON, str);
                      }
                }
         }
        return 1;
}
Try changing 'z' to s[35] for a string.
pawn Код:
CMD:kick(playerid,params[])
    {
        if(PlayerInfo[playerid][Admin] >=2)
        {
            new id,n[MAX_PLAYER_NAME],reason[35], on[MAX_PLAYER_NAME], string[128], string2[128];
            if(sscanf(params,"us[35]",id, reason)) return SendClientMessage(playerid,COLOR_GREY,"SYNTAX:/kick [ID] [reason]"); //here
            else if(playerid == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_YELLOW,"Player not found");
            else
            {
            GetPlayerName(playerid,n,sizeof(n));
            GetPlayerName(id,on,sizeof(on));
            format(string,sizeof(string),"You have been kicked by Admin: %s for: %s",n,reason);
            SendClientMessage(playerid,COLOR_RED,string);
            format(string2, sizeof(string), "Admin Action: %s has kicked %s for: %s",n,on,reason);
            SendClientMessageToAll(COLOR_RED,string2);
            Kick(id);
            }
        }
        else return SendClientMessage(playerid,COLOR_RED1, "You are not a Community Staff Member! Or Your Level is too low!");
        return 1;
    }
Reply
#3

setadmin works perfectly now but /ask is kinda, when u do /ask [TEXT] admins dont get the message? as well kick is still the same? when I change us to s the cmd is useless and dont work at all?

EDIT: Fixed /ask I just need /kick fixed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)