player enum
#1

pawn Код:
CMD:ban(playerid, params[])
{
    new id, reason[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, ""COL_RED"ERROR: You do not have the privilege to access this command!");
    if(sscanf(params, "us", id, reason)) SendClientMessage(playerid, -1, ""COL_RED"USAGE: /ban [id] [reason]");
    else if(id==playerid) SendClientMessage(playerid, -1, ""COL_RED"ERROR: You cannot ban yourself!");
    else if(id==INVALID_PLAYER_ID) SendClientMessage(playerid, -1, ""COL_RED"ERROR: Player is not connected!");
    else {
        new name1[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], kickmes[128];
        GetPlayerName(playerid, name1, sizeof(name1));
        GetPlayerName(id, name2, sizeof(name2));
        format(kickmes, sizeof(kickmes), "%s[%d] has banned player %s[%d]. Reason: %s", name1, playerid, name2, id);
        SendClientMessageToAll(-1, kickmes);
        PlayerInfo[id][pBanned] = 1;
    }
    return 1;
}
Код:
		PlayerInfo[id][pBanned] = 1;
}
Because I set the target id to ID. Is it good to make it PlayerInfo[id][pBanned] = 1; or still PlayerInfo[playerid][pBanned] = 1;?

Q#2: It will be automatically banned for all IP's from that computer or not?
Reply
#2

playerid is the admin, so if you set it to playerid, it will ban the admin >_<
set it to ID.
_________
I don't see you have added Ban(id);
Ban(id) will ban the IP and add it to samp.ban
if you don't have that, your ip is not banned.
Reply
#3

Quote:
Originally Posted by MythicalMarauder
Посмотреть сообщение
playerid is the admin, so if you set it to playerid, it will ban the admin >_<
set it to ID.
_________
I don't see you have added Ban(id);
Ban(id) will ban the IP and add it to samp.ban
if you don't have that, your ip is not banned.
ok. thanks
Quote:
Originally Posted by ******
Посмотреть сообщение
If in future you are not sure about a little thing like this, why not just go in-game and test both versions - see which one works.
it's because I am scripting currently, and I don't want something like: after scripting a little, I'll test it. I want batch by batch. and I also asked here to be fully sure.
Reply
#4

Yep ****** is right. If u do testing after adding ur whole codes and find a bug then u will get mad in finding the problem. I always check my server after adding codes if it is working fine or not. U can get server crash problem, login problem, and many more if u add ur codes like this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)