Thanks it works, also remove_quotes needed.
One more question, how to check is there a string character in szTime ?
is it correct: ?
PHP Code:
new bantime;
if(containi(szTime, "m") != -1)
{
bantime = str_to_num(szTime) * 60;
}else if(containi(szTime, "h") != -1)
{
bantime = str_to_num(szTime) * 60 * 60;
}else if(containi(szTime, "d") != -1)
{
bantime = str_to_num(szTime) * 60 * 60 * 24;
}
I would like to make that if player writes 1m in bantime, the bantime would be 60seconds
if 1h then the player would be banned for 1 hour.
if 1d then the player would be banned for 1 day.
and then check if bantime exceeds the limit (7 days is max)
PHP Code:
if(bantime > 604800)
{
client_print_color(id, DontChange, "^4[ INFO ]^1 ban_time can not exceed more than 7 days")
return PLUGIN_HANDLED_MAIN;
}
It should auto convert to seconds then I'm going to use get_systime() + bantime.
So am I doing it correctly ?
Why this is not working ?:
I set user mute time with this:
[php]
mutetime = str_to_num(szTime) * 60 * 60;
iMute[player] = get_systime() + mutetime;
format(szTemp,charsmax(szTemp),"INSERT INTO `bans` ( `ip` , `mute_time`, `mute_reason`, `mute_admin`)VALUES ('%s','%d', '%s', '%s');", szTargetIp, get_systime() + mutetime, szReason, szAdminName)
[php]
and on say event I check this:
PHP Code:
if(get_systime() + iMute[id] > get_systime())
{
client_print_color(id, DontChange, "^4[ INFO ]^1 You can not chat while you are mutted")
return PLUGIN_HANDLED;
}
But user still can chat even if his mute time is higher than systime.