SA-MP Forums Archive
make afk - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: make afk (/showthread.php?tid=563190)



make afk - s3ek - 14.02.2015

i want when player use /afk , Write on top his skin (AFK)
help

PHP код:
CMD:afk(playerid,params[])
    {
        if(
AFK[playerid] == 1)
        {
        return 
SendClientMessage(playerid,COLOR_RED,"You're Already In AFK");
        }
        new 
string[128];
        new 
PNAME[MAX_PLAYER_NAME];
        new 
vehicleid;
        
vehicleid GetPlayerVehicleID(playerid);
        
AFK[playerid] = 1;
        
SetPlayerHealth(playerid,999999999);
        
SetVehicleHealth(vehicleid,9999999999);
        
GetPlayerHealth(playerid,OldHealth);
        
GetVehicleHealth(vehicleid,OldHealth);
        
SendClientMessage(playerid,GREEN,"You're Now In AFK");
        
GetPlayerName(playeridPNAMEMAX_PLAYERS);
        
format(stringsizeof(string), "{ffff00}%s now away from keyboard"PNAME);
        
SendClientMessageToAll(COLOR_BLUE,string);
        
TogglePlayerControllable(playerid,0);
        return 
1;
    } 



Re: make afk - Golf - 14.02.2015

PHP код:
CMD:afk(playerid,params[])
    {
        if(
AFK[playerid] == 1)
        {
        return 
SendClientMessage(playerid,COLOR_RED,"You're Already In AFK");
        }
        new 
string[128],string2[128],Text3D:PlayerLabel[MAX_PLAYERS];
        new 
PNAME[MAX_PLAYER_NAME];
        new 
vehicleid;
        
vehicleid GetPlayerVehicleID(playerid);
        
AFK[playerid] = 1;
        
SetPlayerHealth(playerid,999999999);
        
SetVehicleHealth(vehicleid,9999999999);
        
GetPlayerHealth(playerid,OldHealth);
        
GetVehicleHealth(vehicleid,OldHealth);
        
SendClientMessage(playerid,GREEN,"You're Now In AFK");
        
GetPlayerName(playeridPNAMEMAX_PLAYERS);
        
format(stringsizeof(string), "{ffff00}%s now away from keyboard"PNAME);
        
format(stringsizeof(string2), "{ffff00}AFK %s"PNAME);
        
PlayerLabel[playerid] = Create3DTextLabel(string2, -10.00.00.020.001);
        
Attach3DTextLabelToPlayer(PlayerLabel[playerid], playerid0.00.00.3);
        
SendClientMessageToAll(COLOR_BLUE,string);
        
TogglePlayerControllable(playerid,0);
        return 
1;
    } 



Re: make afk - s3ek - 14.02.2015

Quote:
Originally Posted by Golf
Посмотреть сообщение
PHP код:
CMD:afk(playerid,params[])
    {
        if(
AFK[playerid] == 1)
        {
        return 
SendClientMessage(playerid,COLOR_RED,"You're Already In AFK");
        }
        new 
string[128],string2[128],Text3D:PlayerLabel[MAX_PLAYERS];
        new 
PNAME[MAX_PLAYER_NAME];
        new 
vehicleid;
        
vehicleid GetPlayerVehicleID(playerid);
        
AFK[playerid] = 1;
        
SetPlayerHealth(playerid,999999999);
        
SetVehicleHealth(vehicleid,9999999999);
        
GetPlayerHealth(playerid,OldHealth);
        
GetVehicleHealth(vehicleid,OldHealth);
        
SendClientMessage(playerid,GREEN,"You're Now In AFK");
        
GetPlayerName(playeridPNAMEMAX_PLAYERS);
        
format(stringsizeof(string), "{ffff00}%s now away from keyboard"PNAME);
        
format(stringsizeof(string2), "{ffff00}AFK %s"PNAME);
        
PlayerLabel[playerid] = Create3DTextLabel(string2, -10.00.00.020.001);
        
Attach3DTextLabelToPlayer(PlayerLabel[playerid], playerid0.00.00.3);
        
SendClientMessageToAll(COLOR_BLUE,string);
        
TogglePlayerControllable(playerid,0);
        return 
1;
    } 
not work


Re : make afk - streetpeace - 14.02.2015

PHP код:
CMD:afk(playerid,params[])
    {
        if(
AFK[playerid] == 1)
        {
        return 
SendClientMessage(playerid,COLOR_RED,"You're Already In AFK");
        }
        new 
string[128],string2[128],Text3D:PlayerLabel[MAX_PLAYERS];
        new 
PNAME[MAX_PLAYER_NAME];
        new 
vehicleid;
        
vehicleid GetPlayerVehicleID(playerid);
        
AFK[playerid] = 1;
        
SetPlayerHealth(playerid,999999999);
        
SetVehicleHealth(vehicleid,9999999999);
        
GetPlayerHealth(playerid,OldHealth);
        
GetVehicleHealth(vehicleid,OldHealth);
        
SendClientMessage(playerid,GREEN,"You're Now In AFK");
        
GetPlayerName(playeridPNAMEMAX_PLAYERS);
        
format(stringsizeof(string), "{ffff00}%s now away from keyboard"PNAME);
        
format(string2sizeof(string2), "{ffff00}AFK %s"PNAME);
        
PlayerLabel[playerid] = Create3DTextLabel(string2, -10.00.00.020.001);
        
Attach3DTextLabelToPlayer(PlayerLabel[playerid], playerid0.00.00.3);
        
SendClientMessageToAll(COLOR_BLUE,string);
        
TogglePlayerControllable(playerid,0);
        return 
1;
    } 
Should work.


Re: make afk - Golf - 14.02.2015

Only other players will see label wich are attached to your head


Re : make afk - streetpeace - 14.02.2015

You failed Golf in this line :
pawn Код:
format(string, sizeof(string2), "{ffff00}AFK %s", PNAME); // string
        PlayerLabel[playerid] = Create3DTextLabel(string2, -1, 0.0, 0.0, 0.0, 20.0, 0, 1);
Should be :
pawn Код:
format(string2, sizeof(string2), "{ffff00}AFK %s", PNAME);
        PlayerLabel[playerid] = Create3DTextLabel(string2, -1, 0.0, 0.0, 0.0, 20.0, 0, 1);



Re: make afk - s3ek - 14.02.2015

now it work but , after using /back it didnt removed ?


Re: make afk - Golf - 14.02.2015

show /back ur cmd


Re: make afk - s3ek - 14.02.2015

PHP код:
CMD:back(playerid,params[])
    {
        if(
AFK[playerid] == 0)
        {
        return 
SendClientMessage(playerid,COLOR_RED,"You're Not In AFK To Use This Command");
        }
        new 
string[128];
        new 
PNAME[MAX_PLAYER_NAME];
        
AFK[playerid] = 0;
        new 
vehicleid;
        
vehicleid GetPlayerVehicleID(playerid);
        
SetPlayerHealth(playerid,OldHealth);
        
SetVehicleHealth(vehicleid,OldHealth);
        
SendClientMessage(playerid,GREEN,"You're Back From AFK");
        
GetPlayerName(playeridPNAMEMAX_PLAYERS);
        
format(stringsizeof(string), "{ffff00}%s now back to keyboard"PNAME);
        
SendClientMessageToAll(COLOR_ORANGE,string);
        
TogglePlayerControllable(playerid,1);
        return 
1;




Re: make afk - Golf - 14.02.2015

PHP код:
new Text3D:PlayerLabel[MAX_PLAYERS];
CMD:afk(playerid,params[])
    {
        if(
AFK[playerid] == 1)
        {
        return 
SendClientMessage(playerid,COLOR_RED,"You're Already In AFK");
        }
        new 
string[128],string2[128];
        new 
PNAME[MAX_PLAYER_NAME];
        new 
vehicleid;
        
vehicleid GetPlayerVehicleID(playerid);
        
AFK[playerid] = 1;
        
SetPlayerHealth(playerid,999999999);
        
SetVehicleHealth(vehicleid,9999999999);
        
GetPlayerHealth(playerid,OldHealth);
        
GetVehicleHealth(vehicleid,OldHealth);
        
SendClientMessage(playerid,GREEN,"You're Now In AFK");
        
GetPlayerName(playeridPNAMEMAX_PLAYERS);
        
format(string2sizeof(string), "{ffff00}%s now away from keyboard"PNAME);
        
format(string2sizeof(string2), "{ffff00}AFK %s"PNAME);
        
PlayerLabel[playerid] = Create3DTextLabel(string2, -10.00.00.020.001);
        
Attach3DTextLabelToPlayer(PlayerLabel[playerid], playerid0.00.00.3);
        
SendClientMessageToAll(COLOR_BLUE,string);
        
TogglePlayerControllable(playerid,0);
        return 
1;
    }
    
    
CMD:back(playerid,params[])
    {
        if(
AFK[playerid] == 0)
        {
        return 
SendClientMessage(playerid,COLOR_RED,"You're Not In AFK To Use This Command");
        }
        new 
string[128];
        new 
PNAME[MAX_PLAYER_NAME];
        
AFK[playerid] = 0;
        new 
vehicleid;
        
vehicleid GetPlayerVehicleID(playerid);
        
SetPlayerHealth(playerid,OldHealth);
        
SetVehicleHealth(vehicleid,OldHealth);
        
SendClientMessage(playerid,GREEN,"You're Back From AFK");
        
GetPlayerName(playeridPNAMEMAX_PLAYERS);
        
format(stringsizeof(string), "{ffff00}%s now back to keyboard"PNAME);
        
SendClientMessageToAll(COLOR_ORANGE,string);
        
RemovePlayerAttachedObject(playeridPlayerLabel[playerid]);
        
TogglePlayerControllable(playerid,1);
        return 
1;