Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <a_npc>
- #include <ocmd>
- #pragma tabsize 0
- #define COLOR_RED 0xFF0000FF
- #define COLOR_BLACK 0x000000FF
- new destroy[10], Text:blackscreen, Abfrage[MAX_PLAYERS], Lagging[MAX_PLAYERS], AntiMultiPost = 0, Durchlauf = 0, Wiederholung = 0;
- public OnFilterScriptInit(){
- print("\n--------------------------------------");
- print(" GodModeTester geladen...");
- print("--------------------------------------\n");
- destroy[0] = CreateObject(974,1396.09997559,-23.00000000,1002.70001221,0.00000000,0.00000000,0.00000000);
- destroy[1] = CreateObject(974,1402.80004883,-24.50000000,1002.70001221,0.00000000,0.00000000,0.00000000);
- destroy[2] = CreateObject(974,1402.79980469,-23.00000000,1002.70001221,0.00000000,0.00000000,0.00000000);
- destroy[3] = CreateObject(974,1396.09960938,-24.50000000,1002.70001221,0.00000000,0.00000000,0.00000000);
- destroy[4] = CreateObject(985,1406.19995117,-24.29999924,1001.20001221,0.00000000,0.00000000,270.00000000);
- destroy[5] = CreateObject(985,1392.69921875,-24.09960938,1001.20001221,0.00000000,0.00000000,89.99499512);
- destroy[6] = CreateObject(985,1402.00000000,-24.50000000,1005.40002441,90.00000000,180.00000000,270.00000000);
- destroy[7] = CreateObject(985,1398.59997559,-24.39999962,1005.40002441,90.00000000,180.00549316,89.98400879);
- destroy[8] = CreateObject(1412,1405.40002441,-25.10000038,1001.20001221,0.00000000,0.00000000,90.00000000);
- destroy[9] = CreateObject(1412,1405.40002441,-25.20000076,1003.20001221,0.00000000,0.00000000,90.00000000);
- blackscreen = TextDrawCreate(642.000000, 2.000000, "~n~");
- TextDrawBackgroundColor(blackscreen, 255);
- TextDrawFont(blackscreen, 1);
- TextDrawLetterSize(blackscreen, 0.500000, 49.299957);
- TextDrawColor(blackscreen, -1);
- TextDrawSetOutline(blackscreen, 0);
- TextDrawSetProportional(blackscreen, 1);
- TextDrawSetShadow(blackscreen, 1);
- TextDrawUseBox(blackscreen, 1);
- TextDrawBoxColor(blackscreen, 255);
- TextDrawTextSize(blackscreen, -2.000000, 0.000000);
- ConnectNPC("GodModeTester","GodModeTester");
- return 1;}
- public OnFilterScriptExit(){
- print("\n--------------------------------------");
- print(" GodModeTester entladen...");
- print("--------------------------------------\n");
- DestroyObject(destroy[0]);
- DestroyObject(destroy[1]);
- DestroyObject(destroy[2]);
- DestroyObject(destroy[3]);
- DestroyObject(destroy[4]);
- DestroyObject(destroy[5]);
- DestroyObject(destroy[6]);
- DestroyObject(destroy[7]);
- DestroyObject(destroy[8]);
- DestroyObject(destroy[9]);
- TextDrawDestroy(blackscreen);
- return 1;}
- public OnPlayerConnect(playerid){
- if(IsPlayerNPC(playerid)){
- new botname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, botname, sizeof(botname));
- if(!strcmp(botname, "GodModeTester", true)){
- print("GodModeTester connectet.");}
- return 1;}
- return 1;}
- public OnPlayerDisconnect(playerid, reason){
- if(IsPlayerNPC(playerid)){
- new botname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, botname, sizeof(botname));
- if(!strcmp(botname, "GodModeTester", true)){
- print("GodModeTester disconnectet.");}
- return 1;}
- return 1;}
- public OnPlayerSpawn(playerid){
- if(IsPlayerNPC(playerid)){
- new botname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, botname, sizeof(botname));
- if(!strcmp(botname, "GodModeTester", true)){
- SetPlayerSkin(playerid, 217);
- GivePlayerWeapon(playerid, 38, 999999999);
- SetPlayerPos(playerid, 1390.40002441,-23.79999924,1000.59997559);
- SetPlayerVirtualWorld(playerid, 100);
- SetPlayerInterior(playerid, 1);
- SetPlayerColor(playerid, 0xFFFFFF00);}
- return 1;}
- return 1;}
- ocmd:gm(playerid,params[]){
- new pID, name[MAX_PLAYERS], name1[MAX_PLAYERS], string[124];
- if(Abfrage[pID] >= 1) return SendClientMessage(playerid,COLOR_RED,"Es befindet sich grade jemand in der GodModeAbfrage!");
- if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,COLOR_RED,"Du darfst diesen Befehl nicht nutzen!"); //-------------Sollte dem Adminsystem angepasst werden-------------//
- if(sscanf(params,"u",pID))return SendClientMessage(playerid, COLOR_RED, "Benutze: /gm [Spieler]");
- if(!IsPlayerConnected(pID))return SendClientMessage(playerid, COLOR_RED, "Der Spieler ist nicht eingeloggt!");
- new Float:X,Float:Y,Float:Z, Interior=GetPlayerInterior(pID),Skin=GetPlayerSkin(pID), Virtual=GetPlayerVirtualWorld(pID), Float:Health, Float:Armour;
- GetPlayerPos(pID,X,Y,Z);
- GetPlayerHealth(pID, Health);
- GetPlayerArmour(pID, Armour);
- GetPlayerName(playerid,name,sizeof(name));
- GetPlayerName(pID,name1,sizeof(name1));
- format(string,sizeof(string), "%s lässt %s auf GodMode überprüfen.",name, name1);
- printf(string);
- SetPVarFloat(pID,"X",X);
- SetPVarFloat(pID,"Y",Y);
- SetPVarFloat(pID,"Z",Z);
- SetPVarInt(pID,"Interior",Interior);
- SetPVarInt(pID,"Virtual",Virtual);
- SetPVarInt(pID,"Skin",Skin);
- SetPVarFloat(pID,"Armour",Armour);
- SetPVarFloat(pID,"Health",Health);
- TextDrawShowForPlayer(pID, blackscreen);
- for(new i = 0; i < 9; i++){
- SendClientMessage(pID, COLOR_BLACK,"");}
- SendClientMessage(pID, COLOR_RED, "Du wirst auf GodMode überprüft.");
- SetPlayerVirtualWorld(pID, 100);
- SetPlayerInterior(pID, 1);
- SetPlayerPos(pID, 1405.80004883,-23.89999962,1000.59997559);
- ClearAnimations(pID);
- GivePlayerWeapon(pID, 0,0);
- SetPlayerSkin(pID, 0);
- TogglePlayerControllable(pID, 1);
- SetPlayerFacingAngle(pID, 90);
- SetPlayerArmour(pID, 0);
- SetPlayerHealth(pID, 100);
- AntiMultiPost = 0;
- Abfrage[pID] = SetTimerEx("GodModeTesting", 50, 1, "i", pID);
- Lagging[pID] = SetTimerEx("LaggingTesting", 250, 1, "i", pID);
- return 1;}
- forward LaggingTesting(playerid);
- public LaggingTesting(playerid){
- new string[128], name[MAX_PLAYERS];
- GetPlayerName(playerid,name,sizeof(name));
- if(IsPlayerInRangeOfPoint(playerid, 1.5, GetPVarFloat(playerid,"X"), GetPVarFloat(playerid,"Y"), GetPVarFloat(playerid,"Z"))){
- KillTimer(Lagging[playerid]);
- KillTimer(Abfrage[playerid]);
- SetPlayerPos(playerid, GetPVarFloat(playerid,"X"), GetPVarFloat(playerid,"Y"), GetPVarFloat(playerid,"Z"));
- SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"Virtual"));
- SetPlayerInterior(playerid, GetPVarInt(playerid,"Interior"));
- SetPlayerArmour(playerid, GetPVarFloat(playerid,"Armour"));
- SetPlayerHealth(playerid, GetPVarFloat(playerid,"Health"));
- SetPlayerSkin(playerid, GetPVarInt(playerid,"Skin"));
- AntiMultiPost = 1;
- format(string,sizeof(string), "AdmCmd: %s wurde vom System gekickt. Grund: ESC/F8 abuse",name);
- SendClientMessageToAll(COLOR_RED, string);
- Wiederholung = 0;
- Kick(playerid);}
- if(!IsPlayerInRangeOfPoint(playerid, 1.5, 1405.80004883,-23.89999962,1000.59997559)){
- KillTimer(Lagging[playerid]);
- KillTimer(Abfrage[playerid]);
- SetPlayerPos(playerid, GetPVarFloat(playerid,"X"), GetPVarFloat(playerid,"Y"), GetPVarFloat(playerid,"Z"));
- SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"Virtual"));
- SetPlayerInterior(playerid, GetPVarInt(playerid,"Interior"));
- SetPlayerArmour(playerid, GetPVarFloat(playerid,"Armour"));
- SetPlayerHealth(playerid, GetPVarFloat(playerid,"Health"));
- SetPlayerSkin(playerid, GetPVarInt(playerid,"Skin"));
- if(AntiMultiPost == 0){
- format(string,sizeof(string), "AdmCmd: %s wurde vom System gekickt. Grund: Lag",name);
- SendClientMessageToAll(COLOR_RED, string);
- Wiederholung = 0;
- Kick(playerid);}
- }
- if(Wiederholung != 8){ //-----------------Da er alle 250 Milisekunden abfragt, wird hier Festgelegt wie lange er Abfragen soll. (2 Wiederholungen = 0,5 Sekunden)-----------------//
- Wiederholung++;}
- if(Wiederholung == 8){ //-----------------Da er alle 250 Milisekunden abfragt, wird hier Festgelegt wie lange er Abfragen soll. (2 Wiederholungen = 0,5 Sekunden)-----------------//
- KillTimer(Lagging[playerid]);}
- return 1;}
- forward GodModeTesting(playerid);
- public GodModeTesting(playerid){
- new string[128], Float:Leben, name[MAX_PLAYERS];
- GetPlayerHealth(playerid, Leben);
- GetPlayerName(playerid,name,sizeof(name));
- if(Leben < 80){
- KillTimer(Lagging[playerid]);
- KillTimer(Abfrage[playerid]);
- SetPlayerPos(playerid, GetPVarFloat(playerid,"X"), GetPVarFloat(playerid,"Y"), GetPVarFloat(playerid,"Z"));
- SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"Virtual"));
- SetPlayerInterior(playerid, GetPVarInt(playerid,"Interior"));
- SetPlayerArmour(playerid, GetPVarFloat(playerid,"Armour"));
- SetPlayerHealth(playerid, GetPVarFloat(playerid,"Health"));
- SetPlayerSkin(playerid, GetPVarInt(playerid,"Skin"));
- TextDrawHideForPlayer(playerid, blackscreen);
- Durchlauf = 0;}
- if(Durchlauf != 45){ //-----------------Da er alle 50 Milisekunden abfragt, wird hier Festgelegt wie lange er Abfragen soll. (10 Durchläufe = 0,5 Sekunden)-----------------//
- Durchlauf++;}
- if(Durchlauf == 45){ //-----------------Da er alle 50 Milisekunden abfragt, wird hier Festgelegt wie lange er Abfragen soll. (10 Durchläufe = 0,5 Sekunden)-----------------//
- KillTimer(Lagging[playerid]);
- KillTimer(Abfrage[playerid]);
- Durchlauf = 0;
- format(string,sizeof(string), "AdmCmd: %s wurde vom System gebannt. Grund: Cheater",name);
- SendClientMessageToAll(COLOR_RED, string);
- Ban(playerid);}
- return 1;}
- stock sscanf(string[], format[], {Float,_}:...)
- {
- #if defined isnull
- if (isnull(string))
- #else
- if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
- #endif
- {
- return format[0];
- }
- #pragma tabsize 4
- new
- formatPos = 0,
- stringPos = 0,
- paramPos = 2,
- paramCount = numargs(),
- delim = ' ';
- while (string[stringPos] && string[stringPos] <= ' ')
- {
- stringPos++;
- }
- while (paramPos < paramCount && string[stringPos])
- {
- switch (format[formatPos++])
- {
- case '\0':
- {
- return 0;
- }
- case 'i', 'd':
- {
- new
- neg = 1,
- num = 0,
- ch = string[stringPos];
- if (ch == '-')
- {
- neg = -1;
- ch = string[++stringPos];
- }
- do
- {
- stringPos++;
- if ('0' <= ch <= '9')
- {
- num = (num * 10) + (ch - '0');
- }
- else
- {
- return -1;
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num * neg);
- }
- case 'h', 'x':
- {
- new
- num = 0,
- ch = string[stringPos];
- do
- {
- stringPos++;
- switch (ch)
- {
- case 'x', 'X':
- {
- num = 0;
- continue;
- }
- case '0' .. '9':
- {
- num = (num << 4) | (ch - '0');
- }
- case 'a' .. 'f':
- {
- num = (num << 4) | (ch - ('a' - 10));
- }
- case 'A' .. 'F':
- {
- num = (num << 4) | (ch - ('A' - 10));
- }
- default:
- {
- return -1;
- }
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num);
- }
- case 'c':
- {
- setarg(paramPos, 0, string[stringPos++]);
- }
- case 'f':
- {
- new changestr[16], changepos = 0, strpos = stringPos;
- while(changepos < 16 && string[strpos] && string[strpos] != delim)
- {
- changestr[changepos++] = string[strpos++];
- }
- changestr[changepos] = '\0';
- setarg(paramPos,0,_:floatstr(changestr));
- }
- case 'p':
- {
- delim = format[formatPos++];
- continue;
- }
- case '\'':
- {
- new
- end = formatPos - 1,
- ch;
- while ((ch = format[++end]) && ch != '\'') {}
- if (!ch)
- {
- return -1;
- }
- format[end] = '\0';
- if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
- {
- if (format[end + 1])
- {
- return -1;
- }
- return 0;
- }
- format[end] = '\'';
- stringPos = ch + (end - formatPos);
- formatPos = end + 1;
- }
- case 'u':
- {
- new
- end = stringPos - 1,
- id = 0,
- bool:num = true,
- ch;
- while ((ch = string[++end]) && ch != delim)
- {
- if (num)
- {
- if ('0' <= ch <= '9')
- {
- id = (id * 10) + (ch - '0');
- }
- else
- {
- num = false;
- }
- }
- }
- if (num && IsPlayerConnected(id))
- {
- setarg(paramPos, 0, id);
- }
- else
- {
- #if !defined foreach
- #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
- #define __SSCANF_FOREACH__
- #endif
- string[end] = '\0';
- num = false;
- new
- name[MAX_PLAYER_NAME];
- id = end - stringPos;
- foreach (Player, playerid)
- {
- GetPlayerName(playerid, name, sizeof (name));
- if (!strcmp(name, string[stringPos], true, id))
- {
- setarg(paramPos, 0, playerid);
- num = true;
- break;
- }
- }
- if (!num)
- {
- setarg(paramPos, 0, INVALID_PLAYER_ID);
- }
- string[end] = ch;
- #if defined __SSCANF_FOREACH__
- #undef foreach
- #undef __SSCANF_FOREACH__
- #endif
- }
- stringPos = end;
- }
- case 's', 'z':
- {
- new
- i = 0,
- ch;
- if (format[formatPos])
- {
- while ((ch = string[stringPos++]) && ch != delim)
- {
- setarg(paramPos, i++, ch);
- }
- if (!i)
- {
- return -1;
- }
- }
- else
- {
- while ((ch = string[stringPos++]))
- {
- setarg(paramPos, i++, ch);
- }
- }
- stringPos--;
- setarg(paramPos, i, '\0');
- }
- default:
- {
- continue;
- }
- }
- while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
- {
- stringPos++;
- }
- while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
- {
- stringPos++;
- }
- paramPos++;
- }
- do
- {
- if ((delim = format[formatPos++]) > ' ')
- {
- if (delim == '\'')
- {
- while ((delim = format[formatPos++]) && delim != '\'') {}
- }
- else if (delim != 'z')
- {
- return delim;
- }
- }
- }
- while (delim > ' ');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement