31.05.2014, 20:07
Usa Um Gettime
https://sampwiki.blast.hk/wiki/Gettime
https://sampwiki.blast.hk/wiki/Gettime
pawn Код:
CMD:tempban(playerid, params[]) {
new
id,
hours
;
if(sscanf(params, "uis", id, hours, params)) {
SendClientMessage(playerid, -1, "Uso: \ "/ ban <playerid> <horas> <razгo> \"");
} else {
if(id == INVALID_PLAYER_ID) {
SendClientMessage(playerid, -1, "Jogador nгo encontrado");
} else {
if(0 < hours < 24) {
dUserSetINT(PlayerName(id)).("ban", (gettime() + (hours * 60 * 60)));
Kick(id);
} else {
SendClientMessage(playerid, -1, "Maximo 23 horas");
}
}
}
return true;
}
pawn Код:
public OnPlayerConnect(playerid)
{
new
banned = dUserINT(PlayerName(playerid)).("ban")
;
if(banned) {
if(banned == 1) {
Kick(playerid);
} else {
if(banned < gettime()) {
dUserSetInt(PlayerName(playerid)).("ban", 0);
} else {
Kick(playerid);
}
}
}
return 1
};