Ban Name
#8

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Try something like this:

pawn Код:
command(banname,playerid,params[])
{
    if(Stats[playerid][AdminLevel] >= 5) {
        new name, namestring[24], string[128], sendername[MAX_PLAYER_NAME];
        if(unformat(params,"s[24]",name)) return SendClientMessage(playerid, COLOR_WHITE,"{777777}[SYNTAX]{FFFFFF} /BanName [Player Name]");
        format(namestring, sizeof(string), "%s", name);
        if(dini_Exists(namestring)) {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "{00FF00}[SERVER]{FFFFFF} Admin %s has banned the account named %s.", sendername, namestring);
            SendClientMessageToAll(COLOR_WHITE, string);
            dini_IntSet(namestring, "pBanned", 1);
        } else {
            format(string, sizeof(string), "{FF0000}[ERROR]{FFFFFF} %s is not a registered account.", namestring);
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
    } else {
        SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[ERROR]{FFFFFF} You can't use this command, stop trying to be cool.");
    }
    return 1;
}
Change "pBanned" on dini_IntSet to the name of the variable that is in the file.

So if you load it like this:

pawn Код:
dini_Int(file, "PlayerBanned");
Your going to have to change pBanned to PlayerBanned, and so forth.

EDIT: Plus, why don't you have an extra folder for scriptfiles? You're just checking for the players name in scriptfiles. What if you want a business system or a vehicle saving system? It's not recommended to save them in the same spot or it will look bad and will be hard to find certain files.
Exactly what I needed, I appreciate it, thanks for the help.
Reply


Messages In This Thread
Ban Name - by TyThaBomb - 25.06.2012, 22:00
Re: Ban Name - by Kindred - 25.06.2012, 22:15
Re: Ban Name - by Djole1337 - 25.06.2012, 22:20
Re: Ban Name - by TyThaBomb - 25.06.2012, 22:22
Re: Ban Name - by Djole1337 - 25.06.2012, 22:24
Re: Ban Name - by TyThaBomb - 25.06.2012, 22:25
Re: Ban Name - by Kindred - 25.06.2012, 22:26
Re: Ban Name - by TyThaBomb - 25.06.2012, 22:29

Forum Jump:


Users browsing this thread: 3 Guest(s)