23.01.2014, 23:55
Hello dear samp members I have problem with temp ban function..
I wanted to know maybe you could help me out.. I know that I'm doing something totally wrong...
Here is the error:
Error Line:
Here is the KICKTIMER public:
Here is the public:
EDIT:
Oh and maybe you can see my cmd if it looks good..
Thank you for your time to seeing my code..
With respect Scrillex.
I wanted to know maybe you could help me out.. I know that I'm doing something totally wrong...
Here is the error:
pawn Код:
error 028: invalid subscript (not an array or too many subscripts): "KickTimer"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
pawn Код:
KickTimer[playerid] = SetTimerEx("KickPlayer",200,false,"d",playerid);
pawn Код:
forward KickTimer(playerid);
public KickTimer(playerid)
{
Kick(playerid);
}
pawn Код:
forward CheckTempBan(playerid);
public CheckTempBan(playerid)
{
if(PlayerInfo[playerid][pBanT] >= gettime())
{
new str[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
new minu, hour ,day, sec = PlayerInfo[playerid][pBanT] - gettime();
format(str, sizeof(str),"** (KICK) %s (%d) (Account banned from server for %s)", pName,playerid,ConvertTime(sec,minu,hour,day));
SendClientMessage(COLOR_RED,playerid,str);
KickTimer[playerid] = SetTimerEx("KickPlayer",200,false,"d",playerid);
}
else if(pInfo[playerid][pBanT] > 0)
{
new year,month,day;
getdate(year,month,day);
new str[128];
SendClientMessage(playerid,COLOR_RED,"** Your tempban period has expired, welcome back!");
format(str,sizeof(str),"Expired on: %d/%d/%d",year,month,day);
SendClientMessage(COLOR_RED,playerid,str);
PlayerInfo[playerid][TempBan] = 0;
}
return 1;
}
Oh and maybe you can see my cmd if it looks good..
pawn Код:
CMD:tempban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
new id, reason[128], aName[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
new days, year, month, day, hour, minute;
if(sscanf(params, "uis[250]", id, days, reason)) return SendClientMessage(playerid, -1, "{F70505}Usage: {FFFFFF}/tempban <playerid> <days> <reason>");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "Invalid player ID.");
GetPlayerName(playerid, aName, sizeof(aName));
GetPlayerName(id, pName, sizeof(pName));
PlayerInfo[id][pBanT] = (gettime() + (86400*days));
getdate(year, month, day);
gettime(hour, minute);
new tBans[256], echo[256], banmsg[128];
format(tBans, sizeof(tBans), "** %s (%d) has been temporarily banned by Admin %s (%d) for %d days | Reason: %s (%02d/%02d/%04d | %02d:%02d)", pName, id, aName, playerid, days, reason, day, month, year, hour, minute);
format(banmsg, sizeof(banmsg), "Admin %s (%d) has temp banned you for %d days | Reason: %s", aName, playerid, days, reason);
SendClientMessageToAll(COLOR_RED, tBans);
SendClientMessage(id, COLOR_RED, banmsg);
KickTimer[id] = SetTimerEx("KickPlayer", 100, false, "d", id);
}
return 1;
}
With respect Scrillex.