Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //easy-scripting.net (Vincent Petritz) für sa-mp.de
- #include <a_samp>
- #include <ocmd>
- #include <sscanf2>
- #define FarbeRot 0xC30000FF
- new Text:AFK[2];
- forward AFKend(pID);
- public OnFilterScriptInit()
- {
- print("\nAFK System by Vincent Petritz wurde erfolgreich geladen.\n");
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- SetPVarInt(i, "AFKcheck", 0);
- }
- AFK[0] = TextDrawCreate(50,144, "AFK-Code:");
- TextDrawBackgroundColor(AFK[0], 255);
- TextDrawFont(AFK[0], 2);
- TextDrawLetterSize(AFK[0], 1.200000, 2.000000);
- TextDrawColor(AFK[0], -1);
- TextDrawSetOutline(AFK[0], 1);
- TextDrawSetProportional(AFK[0], 1);
- TextDrawSetShadow(AFK[0], 0);
- AFK[1] = TextDrawCreate(250,144, " ");
- TextDrawBackgroundColor(AFK[1], 255);
- TextDrawFont(AFK[1], 2);
- TextDrawLetterSize(AFK[1], 1.200000, 2.000000);
- TextDrawColor(AFK[1], -1);
- TextDrawSetOutline(AFK[1], 1);
- TextDrawSetProportional(AFK[1], 1);
- TextDrawSetShadow(AFK[1], 0);
- return 1;
- }
- ocmd:afkcheck(playerid, params[])
- {
- new pID;
- if(sscanf(params, "u", pID))
- return SendClientMessage(playerid, FarbeRot, "Benutzung: /afkcheck [ID]");
- if(!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, FarbeRot, "Du bist kein Administrator!");
- if(IsPlayerConnected(pID))
- {
- if(GetPVarInt(pID, "AFKcheck") == 0)
- {
- new str1[128], str2[128], admin[MAX_PLAYER_NAME], spieler[MAX_PLAYER_NAME];
- GetPlayerName(pID, spieler, sizeof(spieler));
- GetPlayerName(playerid, admin, sizeof(admin));
- AFKask(pID);
- format(str1, sizeof(str1), "[AFK-System]: %s wird auf Anwesenheit überprüft!", spieler);
- format(str2, sizeof(str2), "[AFK-System]: %s lässt dich auf Anwesenheit überprüfen!", admin);
- SendClientMessage(playerid, FarbeRot, str1);
- SendClientMessage(pID, FarbeRot, str2);
- }
- }
- return 1;
- }
- ocmd:notafk(playerid, params[])
- {
- new number[20];
- if(sscanf(params, "s", number))
- return SendClientMessage(playerid, FarbeRot, "Benutzung: /notafk [Nummer]");
- if(GetPVarInt(playerid, "AFKcheck") == 1)
- {
- new str[10];
- new Value = GetPVarInt(playerid, "AFKnum");
- valstr(str, Value);
- if(!strcmp(number, str))
- {
- TextDrawHideForPlayer(playerid, AFK[0]);
- TextDrawHideForPlayer(playerid, AFK[1]);
- SetPVarInt(playerid, "AFKcheck", 0);
- SetPVarInt(playerid, "AFKnum", 0);
- }
- else
- {
- SendClientMessage(playerid, FarbeRot, "Falscher Code!");
- }
- }
- else { SendClientMessage(playerid, FarbeRot, "Du bist nicht AFK gemeldet worden!"); }
- return 1;
- }
- public AFKend(pID)
- {
- if(GetPVarInt(pID, "AFKcheck") == 1)
- {
- new str[128], spieler[MAX_PLAYER_NAME];
- GetPlayerName(pID, spieler, sizeof(spieler));
- format(str, sizeof(str), "AFK-System: %s war AFK und wird daher gekickt!", spieler);
- SendClientMessageToAll(FarbeRot, str);
- Kick(pID);
- }
- else { }
- return 1;
- }
- stock AFKask(pID)
- {
- new rand = random(87654)+12345;
- new str[25];
- SetPVarInt(pID, "AFKcheck", 1);
- SetPVarInt(pID, "AFKnum", rand);
- TextDrawShowForPlayer(pID, AFK[0]);
- format(str, sizeof(str), " ~r~%d", rand);
- TextDrawSetString(AFK[1], str);
- TextDrawShowForPlayer(pID, AFK[1]);
- SetTimerEx("AFKend", 60000, false, "u", pID);
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SetPVarInt(playerid, "AFKcheck", 0);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement