[FilterScript] Simple AFK System :D [FIRST FILTERSCRIPT]
#1

AFK System
Hi all,

now i make AFK system just 30 Mins, its pretty simple, but you can AFK in vehicles

COMMAND:
/afk for AFK mode and type /afk again For back from AFK mode

DOWNLOAD:
Solidfiles AMX File : Solidfiles
Solidfiles PWN File : Solidfiles

For Pawno Code :
PHP код:
#include <a_samp>
#include <ZCMD>
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xAA3333AA
#define COLOR_BLACK 0x0E0101FF
new Text3D:AFKLABEL[MAX_PLAYERS];
new 
AFK[MAX_PLAYERS];
new 
Float:OldPHealth;
new 
Float:NewPHealth;
new 
Float:OldPArmour;
new 
Float:NewPArmour;
#pragma unused NewCHealth
#pragma unused NewPHealth
#pragma unused NewPArmour
new Float:OldCHealth;
new 
Float:NewCHealth;
public 
OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
"AFK System by Mya");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
AFK[playerid] = 0;
     return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    if(
AFK[playerid] == 1)
    {
        new 
name[MAX_PLAYER_NAME];
        new 
WasAFK[70];
        
GetPlayerName(playeridnamesizeof(name));
        
format(WasAFKsizeof(WasAFK), "%s{FFFFFF} Has logged out while in /AFK Mode"name);
        
SendClientMessageToAll(COLOR_REDWasAFK);
        
AFK[playerid] = 0;
    }
}
CMD:afk(playeridparams[])
{
    if(
AFK[playerid] == 0)
    {
         new 
vehicleid;
        
GetPlayerHealth(playerid,OldPHealth);
        
GetPlayerArmour(playeridOldPArmour);
        
GetVehicleHealth(vehicleid,OldCHealth);
           
SetPlayerHealth(playerid999999);
        
SetPlayerArmour(playerid999999);
        
SetVehicleHealth(vehicleid,999999);
        
SendClientMessage(playeridCOLOR_RED"You are now Away from the Keyboard, type /afk again to resume playing.");
        
SetPlayerColor(playeridCOLOR_BLACK);
        
AFK[playerid] = 1;
        
AFKLABEL[playerid] = Create3DTextLabel("Away From Keyboard",COLOR_YELLOW,30.0,40.0,50.0,40.0,0);
        
Attach3DTextLabelToPlayer(AFKLABEL[playerid], playerid0.00.00.7);
        
TogglePlayerControllable(playerid,0);
        new 
AfkMessage[70];
        new 
name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
        
format(AfkMessagesizeof(AfkMessage), "**%s {FFFFFF}Now Is AFK(away from keyboard)"name);
        
SendClientMessageToAll(COLOR_YELLOWAfkMessage);
    }
    else
    {
         new 
vehicleid;
         
SendClientMessage(playeridCOLOR_RED"Welcome back, you are no longer flagged as Away From Keyboard!");
         
TogglePlayerControllable(playerid,1);
         
SetPlayerHealth(playerid,OldPHealth);
         
SetPlayerArmour(playerid,OldPArmour);
         
SetVehicleHealth(vehicleid,OldCHealth);
         
SetPlayerColor(playerid0xFFFFFFAA);
         
AFK[playerid] = 0;
         new 
AfkMessage[70];
         new 
name[MAX_PLAYER_NAME];
         
GetPlayerName(playeridnamesizeof(name));
         
format(AfkMessagesizeof(AfkMessage), "**%s {FFFFFF}Now back from AFK(away from keyboard)"name);
         
SendClientMessageToAll(COLOR_YELLOWAfkMessage);
         
Delete3DTextLabel(Text3D:AFKLABEL[playerid]);
     }
     return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)