AFK -
Jaua10 - 11.07.2018
Sup guys hope you good! , im new in this lenguage pawn and right now im making a server roleplay from 0 and im trying to make a cmd for player when they got over 10 minutes afk the server get kick the player but if you're admin never kicks you no matter the time the admin got afk. i have this what i see on tutorials and something...
PHP код:
public IdleKick()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] < 1)
{
GetPlayerPos(i, PlayerPos[i][0], PlayerPos[i][1], PlayerPos[i][2]);
if(PlayerPos[i][0] == PlayerPos[i][3] && PlayerPos[i][1] == PlayerPos[i][4] && PlayerPos[i][2] == PlayerPos[i][5])
{
SendClientMessage(i, COLOR_FAILED, " You have been kicked from the server for being AFK over 10 continous minutes");
Kick(i);
}
PlayerPos[i][3] = PlayerPos[i][0];
PlayerPos[i][4] = PlayerPos[i][1];
PlayerPos[i][5] = PlayerPos[i][2];
}
}
}
}
and this are my errors:
Код HTML:
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2231) : warning 235: public function lacks forward declaration (symbol "IdleKick")
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2239) : error 017: undefined symbol "PlayerPos"
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2239) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2239) : error 001: expected token: ";", but found "]"
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2239) : error 029: invalid expression, assumed zero
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2239) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
can you give me a hand please?
Re: AFK -
Osamakurdi - 11.07.2018
Post forward IdleKick();
also post the timer line
Re: AFK -
Jaua10 - 11.07.2018
I dont have it man, i just made that, cuz im new programing and im really confused, what i need?
Re: AFK -
Osamakurdi - 11.07.2018
Post afk command ?
Re: AFK -
Osamakurdi - 11.07.2018
and also back from afk command.
Re: AFK -
Jaua10 - 11.07.2018
I dont have it i think i was making a anti afk system with this
Re: AFK -
Osamakurdi - 11.07.2018
ok after some minutes I'll post here afk and back command with limit of afk in 10 minutes
Re: AFK -
Osamakurdi - 11.07.2018
DO you have an admin system ?
if yes post for me the command that set player an admin.
Re: AFK -
Osamakurdi - 11.07.2018
PHP код:
// TOP OF SCRIPT
#include <a_samp>
#include <zcmd>
new killtimer[MAX_PLAYERS], bool:IsAfk[MAX_PLAYERS];
//ADD THESE LINES INTO YOUR PUBLICS
public OnPlayerText(playerid, text[])
{
if(IsAfk[playerid] == true)
{
IsAfk[playerid] = false;
new str[180], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(str, sizeof(str), "%s has backed from afk.", pname);
SendClientMessageToAll(-1, str);
TogglePlayerControllable(playerid, 1);
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(IsAfk[playerid] == true)
{
IsAfk[playerid] = false;
new str[180], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(str, sizeof(str), "%s has backed from afk.", pname);
SendClientMessageToAll(-1, str);
TogglePlayerControllable(playerid, 1);
}
return 1;
}
//ADD THOSE LINES AT THE LAST OF YOUR SCRIPT
CMD:back(playerid)
{
if(IsAfk[playerid] == false) return SendClientMessage(playerid, -1, "ERROR:You arn't afk.");
IsAfk[playerid] = false;
new str[180], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(str, sizeof(str), "%s has backed from afk.", pname);
SendClientMessageToAll(-1, str);
TogglePlayerControllable(playerid, 1);
return true;
}
CMD:afk(playerid)
{
if(IsAfk[playerid] == true) return SendClientMessage(playerid, -1, "ERROR:You are already afk.");
if(!IsPlayerAdmin(playerid))
{
killtimer[playerid] = SetTimerEx("IdleKick", 600000, 1, "i", playerid);
}
IsAfk[playerid] = true;
new str[180], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(str, sizeof(str), "%s is afk now.", pname);
SendClientMessageToAll(-1, str);
TogglePlayerControllable(playerid, 0);
return 1;
}
forward IdleKick(playerid);
public IdleKick(playerid)
{
SetTimerEx("KickPlayer", 500, 0, "i", playerid);
SendClientMessage(playerid, -1, " You have been kicked from the server for being AFK over 10 continous minutes");
return 1;
}
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
Kick(playerid);
return 1;
}
replace LINE:
Код:
if(!IsPlayerAdmin(playerid))
in your admin system.
Re: AFK -
Jaua10 - 11.07.2018
I think you dont understand me, sorry for my bad english.
I was trying to just made an anti AFK system that would help me to kick out the players who have 10 minutes continuous AFK, but if this is an admin never kick out of the server independently of how long this admin takes AFK. I dont want afk cmd and back cmd, but thanks anyways pal for your time.