player enum - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: player enum (
/showthread.php?tid=502290)
player enum -
Extraordinariness - 23.03.2014
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?
Re: player enum -
MythicalMarauder - 23.03.2014
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.
Re: player enum -
Extraordinariness - 23.03.2014
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.
Re: player enum -
Hanuman - 23.03.2014
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