Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--
- // This is an Brand new afk system + Random server message by team of MughuL
- // Hope you'll like it . For more info & detail loggon to www.unstunting.tk
- #include <a_samp>
- #include <zcmd>
- forward SendRandomMessage();
- #define CURRENT_MESSAGES 4
- #define MESSAGE_INTERVAL 60
- #define MESSAGE_COLOR 0x4169E1FF
- new RM[CURRENT_MESSAGES][128];
- #define CURRENT_MESSAGES 4
- #define green 0xFF0000 //Color green.
- #define red 0xFF0000FF //Color red.
- #define orange 0xFF9900AA // Color orange.
- #define Disable_AFKCHAT == true //Change it from true to false if you don't want AFK users to be restricted in Chatting.
- #define sname "SERVER" //Change the SERVER to your hostname but it must be typed between the quotes(").
- new AFK[MAX_PLAYERS];
- new Text3D: tAFK[MAX_PLAYERS];
- new AFKcount;
- #define COLOR_PINK 0xFF66FFAA
- public OnFilterScriptInit()
- {
- print("\n------------------------------------------");
- print(" Afk system");
- print(" Random Message");
- print(" Fully Loaded By MughuL Bacha");
- print("--------------------------------------------\n");
- AddRandomMessage("{FF0000}[TIP]: {FFFFFF}Please use {FF0000}/commands, /jumps, /dms, /stuns, /credits and /help {FFFFFF}for help.");
- AddRandomMessage("{FF0000}[TIP]: {FFFFFF}Did you see any player hacking/cheating ? Please use {FF0000}/report {FFFFFF}to report them.");
- AddRandomMessage("{FF0000}[TIP]: {FFFFFF}Want to Edit Your Game Profile ? Please use {FF0000}/cp.");
- AddRandomMessage("{FF0000}[TIP]: {FFFFFF}Please make sure to visit our Website {FF0000} -=- www.unstunting.smffy.com -=-");
- SetTimer("SendRandomMessage", MESSAGE_INTERVAL * 9000, 1);
- return 1;
- }
- new Float:xpos,Float:ypos,Float:zpos;
- new ainterior;
- new Float:hp[MAX_PLAYERS];
- new Float:armour[MAX_PLAYERS];
- CMD:afk(playerid,params[])
- {
- if(AFK[playerid] == 1)
- {
- return GameTextForPlayer(playerid, "You are already in AFK. Use /back",3000,3);
- }
- new Lname[MAX_PLAYER_NAME];
- new string[128];
- GetPlayerName(playerid,Lname,sizeof(Lname));
- SetPlayerPos(playerid,xpos,ypos,zpos);
- SetPlayerInterior(playerid,ainterior);
- GetPlayerHealth(playerid,hp[playerid]);
- GetPlayerArmour(playerid,armour[playerid]);
- SetPlayerHealth(playerid,100000);
- SetPlayerArmour(playerid,0);
- SetPlayerInterior(playerid,3);
- SetPlayerPos(playerid,-2668.868408,1410.360107,906.460937);
- TogglePlayerControllable(playerid,0);
- ApplyAnimation(playerid,"DANCING","dance_loop", 4.1,1,1,1,1,1);
- tAFK[playerid] = Create3DTextLabel("AFK-MODE", 0xFF0000FF, 0.0, 0.0, 2.0, 40, 0, 0);
- Attach3DTextLabelToPlayer(tAFK[playerid],playerid, 0.0, 0.0, 0.4);
- PlayerPlaySound(playerid,1185,2944.7271,-729.7914,1.9063);
- format(string, sizeof(string), "{00FFBF}[INFO]:{FCD9AC}%s is now Away From Keyboard.{00FFBF}(/Afk)", Lname);
- SendClientMessageToAll(green,string);
- AFK[playerid]=1;
- AFKcount++;
- return 1;
- }
- CMD:back(playerid,params[])
- {
- if(AFK[playerid] == 0)
- {
- GameTextForPlayer(playerid, "You are not in AFK to use this command.",3000,3);
- }
- else
- {
- SpawnPlayer(playerid);
- new string[192];
- new Bname[MAX_PLAYER_NAME];
- GetPlayerName(playerid,Bname,sizeof(Bname));
- SetPlayerPos(playerid,xpos,ypos,zpos);
- SetPlayerInterior(playerid,ainterior);
- SetPlayerHealth(playerid,hp[playerid]);
- SetPlayerArmour(playerid,armour[playerid]);
- PlayerPlaySound(playerid,1056,0.0,0.0,0.0);
- Delete3DTextLabel(tAFK[playerid]);
- format(string, sizeof(string), "{00FFBF}[INFO]:{FCD9AC}%s is now back.{FCD9AC}{00FFBF}(/Back)", Bname);
- SendClientMessageToAll(green,string);
- AFK[playerid]=0;
- new str1[128];
- format(str1, sizeof(str1),"Welcome Back To Server Please Enjoy your Stay.", sname);
- SendClientMessage(playerid, orange, str1);
- AFKcount--;
- }
- return 1;
- }
- CMD:afkhelp(playerid,prams[])
- {
- SendClientMessage(playerid, red, "~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=");
- SendClientMessage(playerid, orange, "Universal Team has succesfully fixed the afk sys.");
- SendClientMessage(playerid, red, "{00FFBF}/Afk, /Back, /Afklist, /afkhelp");
- SendClientMessage(playerid, orange, "Please Send us Feedback or any request at unstunting.tk");
- SendClientMessage(playerid, red, "~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=");
- return 1;
- }
- CMD:afklist(playerid,params[])
- {
- new string[128];
- new Lsname[MAX_PLAYER_NAME];
- new cstring[128];
- SendClientMessage(playerid, orange, "****************************************");
- SendClientMessage(playerid, green, " Players Away From keyBoard");
- SendClientMessage(playerid, orange, "****************************************");
- format(cstring,sizeof(cstring),"There are currently %d player(s) in AFK mode.", AFKcount);
- SendClientMessage(playerid, orange, cstring);
- for(new i = 0; i< MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(AFK[i] == 1)
- {
- GetPlayerName(i,Lsname,sizeof(Lsname));
- format(string,sizeof(string),"{ff0000}%s (ID:%d)", Lsname, i);
- SendClientMessage(playerid, orange, string);
- }
- }
- }
- return 1;
- }
- public SendRandomMessage()
- {
- static lastmessage = 0;
- new rand = random(CURRENT_MESSAGES);
- while(rand == lastmessage && CURRENT_MESSAGES != 1) { rand = random(CURRENT_MESSAGES); }
- lastmessage = rand;
- SendClientMessageToAll(MESSAGE_COLOR, RM[lastmessage]);
- }
- stock AddRandomMessage(text[])
- {
- for(new m; m < CURRENT_MESSAGES; m++)
- {
- if(!strlen(RM[m]))
- {
- strmid(RM[m], text, 0, 127);
- return 1;
- }
- }
- return 0;
- }
- #if defined Disable_AFKCHAT == true
- public OnPlayerText(playerid,text[])
- {
- if(AFK[playerid] == 1)
- {
- GameTextForPlayer(playerid, "You cannot talk while you are in AFK-MODE.",3000,3);
- return 0;
- }
- return 1;
- }
- #endif
- public OnPlayerConnect(playerid)
- {
- AFK[playerid] = 0;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment