Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //gAFK System, credits to: Gotti, Aleluja (Idea)
- #include <a_samp>
- #include <zcmd>
- #define pink "{FF00D9}"
- enum posinfo
- {
- Float:posx,
- Float:posy,
- Float:posz,
- Float:posangle,
- };
- new PosInfo[MAX_PLAYERS][posinfo];
- public OnFilterScriptInit()
- {
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SendClientMessage(playerid, 0xFFFFFFAA,"This server is running gAFK system by: {FF00D9}Gotti");
- SetPVarInt(playerid,"afk",1);
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- PosInfo[playerid][posx] = 0;
- PosInfo[playerid][posy] = 0;
- PosInfo[playerid][posz] = 0;
- PosInfo[playerid][posangle] = 0;
- return 1;
- }
- COMMAND:afk(playerid, params[]) {
- if(GetPVarInt(playerid,"afk") == 2) return SendClientMessage(playerid,0xFFFFFFAA,"Vec ste {FF00D9}AFK{FFFFFF}! Koristite {FF00D9}/back{FFFFFF} da se vratite!");
- {
- SetPVarInt(playerid,"afk",2);
- new Float:x, Float:y, Float:z, Float:angle;
- GetPlayerPos(playerid,x,y,z);
- GetPlayerFacingAngle(playerid, angle);
- PosInfo[playerid][posx] = x;
- PosInfo[playerid][posy] = y;
- PosInfo[playerid][posz] = z;
- PosInfo[playerid][posangle] = angle;
- new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(string, sizeof(string), "{FF00D9}%s{FFFFFF} je sada AFK", pname);
- SendClientMessageToAll(0xAAAAAAAA, string);
- TogglePlayerControllable(playerid,false);
- SetPlayerPos(playerid, 376.8465,2538.0879,16.5391);
- }
- return 1; }
- COMMAND:back(playerid, params[]) {
- if(GetPVarInt(playerid,"afk") == 1) return SendClientMessage(playerid,0xFFFFFFAA,"Niste {FF00D9}AFK{FFFFFF}, tako da ne mozete koristiti ovu komandu!");
- {
- if(PosInfo[playerid][posx] != 0 && PosInfo[playerid][posy] != 0 && PosInfo[playerid][posz] != 0)
- {
- SetPVarInt(playerid,"afk",1);
- SetPlayerPos(playerid,PosInfo[playerid][posx],PosInfo[playerid][posy],PosInfo[playerid][posz]);
- ResetPlayerWeapons(playerid);
- SetPlayerFacingAngle(playerid, PosInfo[playerid][posangle]);
- new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(string, sizeof(string), "{FF00D9}%s{FFFFFF} vise nije AFK", pname);
- SendClientMessageToAll(0xFFFFFFAA, string);
- TogglePlayerControllable(playerid,true);
- }
- }
- return 1; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement