Two potential problems with admin system
#1

First Error:
pawn Код:
error 035: argument type mismatch (argument 1)
if (!IsNumeric(money)) return SendClientMessage(playerid,COLOR_GRAY,"AdmCmd: Invalid ammount.");


stock IsNumeric(const string[])
{
    new length=strlen(string);
    if (length==0) return false;
    for (new i = 0; i < length; i++)
    {
        if (
        (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
        || (string[i]=='-' && i!=0)                       // A '-' but not at first.
        || (string[i]=='+' && i!=0)                       // A '+' but not at first.
        ) return false;
    }
    if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
    return true;
}
2nd Error: When I do a admin command it's uspposed to tell only to admins what he did, but it doesn't.
pawn Код:
if(strcmp(cmd, "/money", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "USAGE: /money [id] [money]");
                return 1;
            }
            new playa;
            new money;
            playa = strval(tmp);
            tmp = strtok(cmdtext, idx);
            money = strval(tmp);
            if (!IsNumeric(money)) return SendClientMessage(playerid,COLOR_GRAY,"AdmCmd: Invalid ammount.");
            if (PlayerInfo[playerid][pAdminLevel] == 3)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        new string[128], name[28], giveplayer[28];
                        GetPlayerName(playerid, name, sizeof(name));
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        PlayerInfo[playerid][pMoney] += money;
                        format(string,sizeof(string), "AdmWarn: Lead Administrator %s has given %d$ to %s.",name, money, giveplayer);
                        SendAdminMessage(COLOR_LIGHTBLUE,string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAY, "You don't have authorization.");
            }
        }
        return 1;
    }

// Tho it gives money properly, no admin message is sent.

stock SendAdminMessage(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1) if(PlayerInfo[i][pIsGolden] == 1) SendClientMessage(i, color, string);
    }
    return 1;
}
Thanks ALOT to whoever fixes my probs.
Reply


Messages In This Thread
Two potential problems with admin system - by admantis - 05.01.2011, 18:30
Re: Two potential problems with admin system - by iggy1 - 05.01.2011, 18:32
Re: Two potential problems with admin system - by admantis - 05.01.2011, 18:34
Re: Two potential problems with admin system - by veyron - 05.01.2011, 18:36
Re: Two potential problems with admin system - by iggy1 - 05.01.2011, 18:37
Re: Two potential problems with admin system - by admantis - 05.01.2011, 18:38
Re: Two potential problems with admin system - by iggy1 - 05.01.2011, 18:40
Re: Two potential problems with admin system - by veyron - 05.01.2011, 18:40
Re: Two potential problems with admin system - by admantis - 05.01.2011, 18:47

Forum Jump:


Users browsing this thread: 1 Guest(s)