SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 09/02/2012, 02:06 AM   #1
misho1
Gangsta
 
misho1's Avatar
 
Join Date: Feb 2011
Location: Egypt
Posts: 789
Reputation: 23
Default Simple AFK System

Hi,
This Is Simple FS Made By Me
That When You Type /AFK You Will Be Away From Keyboard And When You Type /Back You Will Return From AFK

Commands:
/AFK
/BACK

[EDITED]Here Is It:
pawn Code:
////////////////////////////Simple AFK System By Misho//////////////////////////
#include a_samp
#include ysi\y_commands
#define RED   0xFF0000FF
#define GREEN 0x008000FF
#define BLUE  0x0000FFFF
#define ORANGE    0xFF8000FF
new AFK[MAX_PLAYERS];
new Float:Health;


public OnFilterScriptInit()
{
    print("\n**************************************");
    print("********Simple AFK FS By Misho*********");
    print("**************************************\n");
    return 1;
}



public OnPlayerText(playerid, text[])
{
    if(AFK[playerid] ==1)
    {
        SendClientMessage(playerid,RED,"You're In AFK You Can't Talk");
        return 0;
}
    return 1;
}


                YCMD:afk(playerid,params[],help)
                {
                new string[128];
                new PNAME[MAX_PLAYER_NAME];
                if(AFK[playerid] ==1)
                {
                return SendClientMessage(playerid,RED,"You're Already In AFK");
                }
                if(IsPlayerInAnyVehicle(playerid) == 1)
                {
                AFK[playerid] = 1;
                SetVehicleHealth(GetPlayerVehicleID(playerid),9999999999);
                GetVehicleHealth(GetPlayerVehicleID(playerid),Health);
                SendClientMessage(playerid,RED,"You're Now In AFK");
                GetPlayerName(playerid, PNAME, MAX_PLAYERS);
                format(string, sizeof(string), "%s Is Now In AFK", PNAME);
                SendClientMessageToAll(BLUE,string);
                TogglePlayerControllable(playerid,0);
                return 1;
                }
                AFK[playerid] = 1;
                SetPlayerHealth(playerid,999999999);
                GetPlayerHealth(playerid,Health);
                SendClientMessage(playerid,RED,"You're Now In AFK");
                GetPlayerName(playerid, PNAME, MAX_PLAYERS);
                format(string, sizeof(string), "%s Is Now In AFK", PNAME);
                SendClientMessageToAll(BLUE,string);
                TogglePlayerControllable(playerid,0);
                return 1;
            }

                YCMD:back(playerid,params[],help)
                {
                new string[128];
                new PNAME[MAX_PLAYER_NAME];
                if(AFK[playerid] ==0)
                {
                return SendClientMessage(playerid,RED,"You're Not In AFK To Use This Command");
                }
                if(IsPlayerInAnyVehicle(playerid) == 1)
                {
                AFK[playerid] = 0;
                SetVehicleHealth(GetPlayerVehicleID(playerid),Health);
                TogglePlayerControllable(playerid,1);
                SendClientMessage(playerid,GREEN,"You're Back From AFK");
                GetPlayerName(playerid, PNAME, MAX_PLAYERS);
                format(string, sizeof(string), "%s Back From AFK", PNAME);
                SendClientMessageToAll(ORANGE,string);
                return 1;
                }
                AFK[playerid] = 0;
                SetPlayerHealth(playerid,Health);
                SendClientMessage(playerid,GREEN,"You're Back From AFK");
                GetPlayerName(playerid, PNAME, MAX_PLAYERS);
                format(string, sizeof(string), "%s Back From AFK", PNAME);
                SendClientMessageToAll(ORANGE,string);
                TogglePlayerControllable(playerid,1);
                return 1;
            }

Credits:
Misho:Script It
V_LOPE:Helped Me In Something

NEW:Bug Fixed

Sry For My Bad English
__________________
Code:
My Works:
(1)PM (2)Colors Menu 
(3)AFK (4)Gangs War (5)Huge Jump (6)Stunts LSA (7)Stunts LVA (8)Water Jump (9)Zombies DM

Last edited by misho1; 08/08/2012 at 05:19 PM. Reason: Forgot Something
misho1 is offline   Reply With Quote
Old 09/02/2012, 02:36 AM   #2
Gravity4501
Little Clucker
 
Gravity4501's Avatar
 
Join Date: Dec 2011
Posts: 26
Reputation: 2
Default Re: Simple AFK System

Nice Good Job!
__________________

Need a scripting team Join here http://www.facebook.com/groups/169122796521171/
Gravity4501 is offline   Reply With Quote
Old 09/02/2012, 02:37 AM   #3
misho1
Gangsta
 
misho1's Avatar
 
Join Date: Feb 2011
Location: Egypt
Posts: 789
Reputation: 23
Default Re: Simple AFK System

thnx
__________________
Code:
My Works:
(1)PM (2)Colors Menu 
(3)AFK (4)Gangs War (5)Huge Jump (6)Stunts LSA (7)Stunts LVA (8)Water Jump (9)Zombies DM
misho1 is offline   Reply With Quote
Old 09/02/2012, 06:33 AM   #4
V_LOPE
Big Clucker
 
Join Date: Sep 2011
Posts: 123
Reputation: 24
Default Re: Simple AFK System

simple but nice.
Good Job.
V_LOPE is offline   Reply With Quote
Old 09/02/2012, 07:15 AM   #5
suhrab_mujeeb
Guest
 
Posts: n/a
Default Re: Simple AFK System

This can be used as a health restorer. A player health is 1.0 and when he /AFKs, his health is set to 999999999 or whatever and when he /BACKs his health is restored to 100.0. Great!
  Reply With Quote
Old 09/02/2012, 08:01 AM   #6
V_LOPE
Big Clucker
 
Join Date: Sep 2011
Posts: 123
Reputation: 24
Default Re: Simple AFK System

suhrab is correct.

added this .
pawn Code:
//at top
new Float:OldHealth;
//.....:::: In /afk command ::::.....//
GetPlayerHealth(playerid,OldHealth);
//.......::: in /back command ::...//
SetPlayerHealth(playerid,OldHealth);
V_LOPE is offline   Reply With Quote
Old 09/02/2012, 08:24 AM   #7
suhrab_mujeeb
Guest
 
Posts: n/a
Default Re: Simple AFK System

You also have to see if the player is in vehicle and then set his vehicle health. If he isn't in a vehicle, how can you set the vehicle's health?
  Reply With Quote
Old 09/02/2012, 02:43 PM   #8
misho1
Gangsta
 
misho1's Avatar
 
Join Date: Feb 2011
Location: Egypt
Posts: 789
Reputation: 23
Default Re: Simple AFK System

Quote:
Originally Posted by suhrab_mujeeb View Post
This can be used as a health restorer. A player health is 1.0 and when he /AFKs, his health is set to 999999999 or whatever and when he /BACKs his health is restored to 100.0. Great!
Sry I Wasn't know About Get Old Health
Quote:
Originally Posted by V_LOPE View Post
simple but nice.
Good Job.
Thnx
Quote:
Originally Posted by V_LOPE View Post
suhrab is correct.

added this .
pawn Code:
//at top
new Float:OldHealth;
//.....:::: In /afk command ::::.....//
GetPlayerHealth(playerid,OldHealth);
//.......::: in /back command ::...//
SetPlayerHealth(playerid,OldHealth);
Thnx For This I Add Your Name In the Credits
__________________
Code:
My Works:
(1)PM (2)Colors Menu 
(3)AFK (4)Gangs War (5)Huge Jump (6)Stunts LSA (7)Stunts LVA (8)Water Jump (9)Zombies DM

Last edited by misho1; 17/02/2012 at 11:12 AM.
misho1 is offline   Reply With Quote
Old 09/02/2012, 11:35 PM   #9
ryan39
Little Clucker
 
Join Date: Feb 2012
Posts: 24
Reputation: 2
Default Re: Simple AFK System

Thanks for this AFK system.
ryan39 is offline   Reply With Quote
Old 10/02/2012, 01:46 AM   #10
misho1
Gangsta
 
misho1's Avatar
 
Join Date: Feb 2011
Location: Egypt
Posts: 789
Reputation: 23
Default Re: Simple AFK System

Quote:
Originally Posted by ryan39 View Post
Thanks for this AFK system.
You're Welcome!
__________________
Code:
My Works:
(1)PM (2)Colors Menu 
(3)AFK (4)Gangs War (5)Huge Jump (6)Stunts LSA (7)Stunts LVA (8)Water Jump (9)Zombies DM
misho1 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [FS] Simple GPS System Jofi Filterscripts 24 27/12/2013 07:37 PM
[FilterScript] Experience system + Simple Account System KingHual Filterscripts 70 12/12/2012 12:39 AM
[FilterScript] Simple FAS Car Fix System 0.3d FaSihYouSf Filterscripts 6 26/12/2011 05:38 PM
[FilterScript] [FS] Simple AFK System [AoA]RyDeR Filterscripts 15 31/10/2011 07:10 AM
Simple GPS system DaRealz Help Archive 14 03/05/2011 07:47 PM


All times are GMT. The time now is 05:03 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.