17.03.2015, 21:11
(
Последний раз редактировалось Mya; 25.03.2015 в 08:12.
)
AFK System
Hi all,now i make AFK system just 30 Mins, its pretty simple, but you can AFK in vehicles
COMMAND:
/afk for AFK mode and type /afk again For back from AFK mode DOWNLOAD:
Solidfiles AMX File : SolidfilesSolidfiles PWN File : Solidfiles
For Pawno Code :
PHP код:
#include <a_samp>
#include <ZCMD>
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xAA3333AA
#define COLOR_BLACK 0x0E0101FF
new Text3D:AFKLABEL[MAX_PLAYERS];
new AFK[MAX_PLAYERS];
new Float:OldPHealth;
new Float:NewPHealth;
new Float:OldPArmour;
new Float:NewPArmour;
#pragma unused NewCHealth
#pragma unused NewPHealth
#pragma unused NewPArmour
new Float:OldCHealth;
new Float:NewCHealth;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("AFK System by Mya");
print("--------------------------------------\n");
return 1;
}
public OnPlayerConnect(playerid)
{
AFK[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(AFK[playerid] == 1)
{
new name[MAX_PLAYER_NAME];
new WasAFK[70];
GetPlayerName(playerid, name, sizeof(name));
format(WasAFK, sizeof(WasAFK), "%s{FFFFFF} Has logged out while in /AFK Mode", name);
SendClientMessageToAll(COLOR_RED, WasAFK);
AFK[playerid] = 0;
}
}
CMD:afk(playerid, params[])
{
if(AFK[playerid] == 0)
{
new vehicleid;
GetPlayerHealth(playerid,OldPHealth);
GetPlayerArmour(playerid, OldPArmour);
GetVehicleHealth(vehicleid,OldCHealth);
SetPlayerHealth(playerid, 999999);
SetPlayerArmour(playerid, 999999);
SetVehicleHealth(vehicleid,999999);
SendClientMessage(playerid, COLOR_RED, "You are now Away from the Keyboard, type /afk again to resume playing.");
SetPlayerColor(playerid, COLOR_BLACK);
AFK[playerid] = 1;
AFKLABEL[playerid] = Create3DTextLabel("Away From Keyboard",COLOR_YELLOW,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(AFKLABEL[playerid], playerid, 0.0, 0.0, 0.7);
TogglePlayerControllable(playerid,0);
new AfkMessage[70];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(AfkMessage, sizeof(AfkMessage), "**%s {FFFFFF}Now Is AFK(away from keyboard)", name);
SendClientMessageToAll(COLOR_YELLOW, AfkMessage);
}
else
{
new vehicleid;
SendClientMessage(playerid, COLOR_RED, "Welcome back, you are no longer flagged as Away From Keyboard!");
TogglePlayerControllable(playerid,1);
SetPlayerHealth(playerid,OldPHealth);
SetPlayerArmour(playerid,OldPArmour);
SetVehicleHealth(vehicleid,OldCHealth);
SetPlayerColor(playerid, 0xFFFFFFAA);
AFK[playerid] = 0;
new AfkMessage[70];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(AfkMessage, sizeof(AfkMessage), "**%s {FFFFFF}Now back from AFK(away from keyboard)", name);
SendClientMessageToAll(COLOR_YELLOW, AfkMessage);
Delete3DTextLabel(Text3D:AFKLABEL[playerid]);
}
return 1;
}