Need help with something.
#1

Hello, i want to know how to write in a player account if he is not Online.
Im creating a command /blacklist to write in the player account something like pBlackListed = 1 but i don't know how to do it.

Some help?

ty
Reply
#2

Then use /blacklist [Username] instead of /blacklist [Playerid].
Username is a string.
Reply
#3

yea i know that but how will the /blacklist command will write inside a player account if he is not on the server?
can you show me an ex

ty
Reply
#4


Simple CMD , using strtok,strcmp,dini.
pawn Код:
if (strcmp(cmdtext,"/nameban",true) == 0)
{
     if(IsPlayerAdmin(playerid))
     {
           new tmp[256];
           tmp = strtok(cmdtext, idx);
           if(!strlen(tmp)) return 0;
           new name[MAX_PLAYER_NAME],target[256];
           GetPlayerName(strval(tmp),name,sizeof(name));
           format(target,sizeof(target),"%s.ini",name);
           dini_IntSet(target,"idiot",1);
     }
     return 1;
}
Reply
#5

You forgot what you need to place in OnPlayerConnect :P

target[256]. Are you goddamn crazy? You should read why not to use houmungous sizes. Maximum text message size is 128. - /nameban's lenght (7) The maximum string should be [121]
so, I suggest changing target[256] to target[121].

Also i prefer using this instead of GetPlayerName:
pawn Код:
stock PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
return name;
}
Then add this in OnPlayerConnect:
[pawn]
if (dini_Int(PlayerName(playerid),"idiot")) Kick(playerid);
Kicks him for having a bad name.
Reply
#6

Dont try to make it look bad ..... Its just fine .
Trying to find the little problems .... lame .
Reply
#7

Quote:
Originally Posted by Elka_Blazer
Посмотреть сообщение
Dont try to make it look bad ..... Its just fine .
Trying to find the little problems .... lame .
It is bad. Little problems? Do you realize if you use that huge amount for every variable, your server will lag like crazy?

1. Do not use DINI, it opens file, write/reads file and closes it every command.
2. Do NOT use strtok, use SSCANF.
3. USE DCMD/ZCMD
Reply
#8

so my command is like this:

pawn Код:
if(strcmp(cmd, "/blacklist", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /BlackList [Nume] [Motiv");
                return 1;
            }
            giveplayerid = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[64];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /BlackList [Nume] [Motiv");
                    return 1;
                }
                new playername3[MAX_PLAYER_NAME];
                new string3[64];
                GetPlayerName(giveplayerid, playername3, sizeof(playername3));
                format(string3, sizeof(string3), "users/%s.ini", playername3);
                new File: hFile = fopen(playername3, io_write);
                if (hFile)
                {
                   PlayerInfo[playerid][pBlackList] = 1;
                   format(string, sizeof(string), "AdmCmd: %s a fost adaugat in BlackList de catre %s, Motiv: %s", giveplayer, sendername, (result));
                   BlackListLog(string);
                   format(string, sizeof(string), "AdmCmd: %s a fost adaugat in BlackList de catre %s, Motiv: %s", giveplayer, sendername, (result));
                   SendClientMessageToAll(COLOR_LIGHTRED, string);
                   fclose(hFile);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, " Doar adminii pot folosi aceasta comanda!!!");
                return 1;
            }
        }
        return 1;
    }
but is baning myself /blacklist myname non-rp name. = Im_BanK was added in the BlackList by Im_BanK , reason: non-rp name.

why is that happening>?

What can i do to ban the writed name.?
Reply
#9

No one common ...

i realy need this. can someone help me?
sorry for duble post.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)