make afk
#1

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;
    } 
Reply
#2

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;
    } 
Reply
#3

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
Reply
#4

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.
Reply
#5

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

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);
Reply
#7

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

show /back ur cmd
Reply
#9

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;

Reply
#10

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;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)