[FilterScript] AFK BACK Simple
#1

http://pastebin.com/9Ltx9zfd
http://www.solidfiles.com/d/2be1c81125/
http://www.mediafire.com/?boghbzy625blz2q
Hope U Like It
Dont Forget Rate Me
Type To Afk /afk To Back /back
Reply
#2

No Pics??
Dude, people want to see your script instantly,
ain't nobody got time to install it then see it in game! :P
Reply
#3

im still new in forum but i dont know how to put picture
Reply
#4

pawn Code:
//Variables
new AFK[MAX_PLAYERS];
Okay so I see that you're declaring a new variable, and I am guessing this is to save the player's AFK status.

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/afk", cmdtext, true, 10) == 0)
    {
        new string[128];
        //
        format(string,sizeof(string),"%s(%d) Is now AFK 'Away From Keyboard'", PlayerName(playerid), playerid);
        SendClientMessageToAll(COLOR_GREEN, string);
        //
        SendClientMessage(playerid,COLOR_YELLOW,"Use /back when your back");
        //
        AFK[playerid] =1;
        //
        TogglePlayerControllable(playerid, 0);
        return 1;
    }
 
    if (strcmp("/back", cmdtext, true, 10) == 0)
    {
        new string[128];
        //
        format(string,sizeof(string),"%s(%d) Is now back on his computer", PlayerName(playerid), playerid);
        SendClientMessageToAll(COLOR_GREEN, string);
        //
        SendClientMessage(playerid,COLOR_YELLOW,"Use /afk if you want to use AFK again");
        //
        AFK[playerid] =0;
        //
        TogglePlayerControllable(playerid, 1);
        return 1;
    }
    return 0;
}
But you're not even using it? What's the point of having it if you're not even using it, you're just setting it to true or false whether they're AFK or not, but you never actually use it in a check such as an 'if' statement.

pawn Code:
stock PlayerName(playerid)
{
  new name[255];
  GetPlayerName(playerid, name, 255);
  return name;
}
This amazed me, you're using a cell size of 255 just to store a player name? You only 24 cells for a player name. So you can just use the reference 'MAX_PLAYER_NAME'.

Anyway I can see that you're new to scripting and newbies do tend to make mistakes, the code may work perfectly fine yes, but the methods used are bad. Again I am not trying to hate or anything, good work for the effort.
Reply
#5

Remember the player can still be killed with TogglePlayerControllable() you need to set their health to SetPlayerHealth(playerid, 0x7F800000);
Reply
#6

Quote:
Originally Posted by BpVanshVk
View Post
No Pics??
Dude, people want to see your script instantly,
ain't nobody got time to install it then see it in game! :P
We all know the afk system works so, I don't see why he should post one just for a text or textdraw like that :

pawn Code:
new string[128];
format(string,sizeof(string),"%s(%d) Is now AFK 'Away From Keyboard'", PlayerName(playerid), playerid);
SendClientMessageToAll(COLOR_GREEN, string);

And indeed the players can be killed if he use your script because the player toggle controllable is not here to give unlimited hp's, but only to freeze the players (y). So you will need to set the players to infinite health. Like Pottus said.
Reply
#7

It Work In Server
Reply
#8

wow Thank U REP+ im useing it Thank u Very Much
Reply
#9

Good.
Reply
#10

Thanks All And I Will Script More Hope U Like My Script If u Like It Rate Me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)