#1

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 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
PlayerInfo[i][pAdmin] < 1)
            {
                
GetPlayerPos(iPlayerPos[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(iCOLOR_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?
Reply
#2

Post forward IdleKick();
also post the timer line
Reply
#3

I dont have it man, i just made that, cuz im new programing and im really confused, what i need?
Reply
#4

Post afk command ?
Reply
#5

and also back from afk command.
Reply
#6

I dont have it i think i was making a anti afk system with this
Reply
#7

ok after some minutes I'll post here afk and back command with limit of afk in 10 minutes
Reply
#8

DO you have an admin system ?
if yes post for me the command that set player an admin.
Reply
#9

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(playeridtext[])
{
    if(
IsAfk[playerid] == true)
    {
        
IsAfk[playerid] = false;
        new 
str[180], pname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpnamesizeof(pname));
        
format(strsizeof(str), "%s has backed from afk."pname);
        
SendClientMessageToAll(-1str);
        
TogglePlayerControllable(playerid1);
    }
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
IsAfk[playerid] == true)
    {
        
IsAfk[playerid] = false;
        new 
str[180], pname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpnamesizeof(pname));
        
format(strsizeof(str), "%s has backed from afk."pname);
        
SendClientMessageToAll(-1str);
        
TogglePlayerControllable(playerid1);
    }
    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(playeridpnamesizeof(pname));
    
format(strsizeof(str), "%s has backed from afk."pname);
    
SendClientMessageToAll(-1str);
    
TogglePlayerControllable(playerid1);
    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"6000001"i"playerid);
    }
    
IsAfk[playerid] = true;
    new 
str[180], pname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpnamesizeof(pname));
    
format(strsizeof(str), "%s is afk now."pname);
    
SendClientMessageToAll(-1str);
    
TogglePlayerControllable(playerid0);
    return 
1;    
}
forward IdleKick(playerid);
public 
IdleKick(playerid)
{
    
SetTimerEx("KickPlayer"5000"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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)