SA-MP Forums Archive
[FilterScript] AFK BACK Simple - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] AFK BACK Simple (/showthread.php?tid=439528)



AFK BACK Simple - daemon3304 - 25.05.2013

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


Re: AFK BACK Simple - BpVanshVk - 25.05.2013

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



Re: AFK BACK Simple - daemon3304 - 26.05.2013

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


Re: AFK BACK Simple - Bicentric - 26.05.2013

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.


Re: AFK BACK Simple - Pottus - 26.05.2013

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


Re : Re: AFK BACK Simple - thegreathom - 26.05.2013

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.


Re: AFK BACK Simple - daemon3304 - 26.05.2013

It Work In Server


Re: AFK BACK Simple - amoitwil - 26.05.2013

wow Thank U REP+ im useing it Thank u Very Much


Re: AFK BACK Simple - iMTube™ - 26.05.2013

Good.


Re: AFK BACK Simple - daemon3304 - 26.05.2013

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