Jump to content
  • 0

pomoc AFK SYSTEM


WARNING EPIC CODE

Dotaz

5 odpovědí na tuto otázku

Recommended Posts

  • 0

#include <a_samp>

#define yellow 0xFFFF00AA
#define COLOR_YELLOW 0xFFFF00AA

new Text3D:label[MAX_PLAYERS];


public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Afk SYSTEM");
print("--------------------------------------\n");
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/afk", cmdtext, true) == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "You are now AFK, type /back to move again!");
TogglePlayerControllable(playerid,0);
label[playerid] = Create3DTextLabel("AFK",yellow,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
new string3[70];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));

format(string3, sizeof(string3), "%s is now Away from the keyboard!", name);
SendClientMessageToAll(COLOR_YELLOW, string3);
}

if(strcmp("/back", cmdtext, true) == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "You are now back!");
TogglePlayerControllable(playerid,1);
new string3[70];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));

format(string3, sizeof(string3), "%s is now Back!", name);
SendClientMessageToAll(COLOR_YELLOW, string3);
Delete3DTextLabel(Text3D:label[playerid]);
return 1;
}
return 0;
}
Link to comment
Share on other sites

  • 0
#include <a_samp>

#define FUTURE_TIME (60)

COMMAND:afk(playerid,params[]){
new Name[32],string[128];
GetPlayerName(playerid, Name, 32);
if(GetPVarInt(playerid,"AFK") == 0){
if(GetPVarInt(playerid,"AFK_TIME") > gettime()){
new str[128];
format(str,128,"[AFK] AFK můžeš být až za %i sekund.",GetPVarInt(playerid,"AFK_TIME")-gettime());
SendClientMessage(playerid,-1,str);
}else{
strins(Name, "[AFK]", 0);
SetPlayerName(playerid, Name);
format(string,128,"Hráč %s je nyní AFK (\"%s\").",Name,params);
SendClientMessageToAll(-1,string);
TogglePlayerControllable(playerid,false);
SetPVarInt(playerid,"AFK_World",GetPlayerVirtualWorld(playerid));
ExSetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(playerid)+2012);
SetPVarInt(playerid,"AFK",1);
}
}else{
strdel(Name, 0, 5);
SetPlayerName(playerid,Name);
format(string,128,"Hráč %s je zpět.",Name);
SendClientMessageToAll(-1,string);
new Future = gettime() + FUTURE_TIME;
SetPVarInt(playerid,"AFK_TIME",Future);
TogglePlayerControllable(playerid,true);
SetPlayerVirtualWorld(playerid,GetPVarInt(playerid,"AFK_World"));
DeletePVar(playerid,"AFK");
DeletePVar(playerid,"AFK_World");
}
return 1;
}

;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...