Advertisement
Guest User

Filterscript .pwn Datei

a guest
Sep 19th, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.59 KB | None | 0 0
  1. #include <a_samp>
  2. #include <a_npc>
  3. #include <ocmd>
  4.  
  5. #pragma tabsize 0
  6.  
  7. #define COLOR_RED 0xFF0000FF
  8. #define COLOR_BLACK 0x000000FF
  9.  
  10. new destroy[10], Text:blackscreen, Abfrage[MAX_PLAYERS], Lagging[MAX_PLAYERS], AntiMultiPost = 0, Durchlauf = 0, Wiederholung = 0;
  11.  
  12.  
  13. public OnFilterScriptInit(){
  14. print("\n--------------------------------------");
  15. print(" GodModeTester geladen...");
  16. print("--------------------------------------\n");
  17.  
  18. destroy[0] = CreateObject(974,1396.09997559,-23.00000000,1002.70001221,0.00000000,0.00000000,0.00000000);
  19. destroy[1] = CreateObject(974,1402.80004883,-24.50000000,1002.70001221,0.00000000,0.00000000,0.00000000);
  20. destroy[2] = CreateObject(974,1402.79980469,-23.00000000,1002.70001221,0.00000000,0.00000000,0.00000000);
  21. destroy[3] = CreateObject(974,1396.09960938,-24.50000000,1002.70001221,0.00000000,0.00000000,0.00000000);
  22. destroy[4] = CreateObject(985,1406.19995117,-24.29999924,1001.20001221,0.00000000,0.00000000,270.00000000);
  23. destroy[5] = CreateObject(985,1392.69921875,-24.09960938,1001.20001221,0.00000000,0.00000000,89.99499512);
  24. destroy[6] = CreateObject(985,1402.00000000,-24.50000000,1005.40002441,90.00000000,180.00000000,270.00000000);
  25. destroy[7] = CreateObject(985,1398.59997559,-24.39999962,1005.40002441,90.00000000,180.00549316,89.98400879);
  26. destroy[8] = CreateObject(1412,1405.40002441,-25.10000038,1001.20001221,0.00000000,0.00000000,90.00000000);
  27. destroy[9] = CreateObject(1412,1405.40002441,-25.20000076,1003.20001221,0.00000000,0.00000000,90.00000000);
  28.  
  29. blackscreen = TextDrawCreate(642.000000, 2.000000, "~n~");
  30. TextDrawBackgroundColor(blackscreen, 255);
  31. TextDrawFont(blackscreen, 1);
  32. TextDrawLetterSize(blackscreen, 0.500000, 49.299957);
  33. TextDrawColor(blackscreen, -1);
  34. TextDrawSetOutline(blackscreen, 0);
  35. TextDrawSetProportional(blackscreen, 1);
  36. TextDrawSetShadow(blackscreen, 1);
  37. TextDrawUseBox(blackscreen, 1);
  38. TextDrawBoxColor(blackscreen, 255);
  39. TextDrawTextSize(blackscreen, -2.000000, 0.000000);
  40.  
  41. ConnectNPC("GodModeTester","GodModeTester");
  42. return 1;}
  43.  
  44.  
  45. public OnFilterScriptExit(){
  46. print("\n--------------------------------------");
  47. print(" GodModeTester entladen...");
  48. print("--------------------------------------\n");
  49.  
  50. DestroyObject(destroy[0]);
  51. DestroyObject(destroy[1]);
  52. DestroyObject(destroy[2]);
  53. DestroyObject(destroy[3]);
  54. DestroyObject(destroy[4]);
  55. DestroyObject(destroy[5]);
  56. DestroyObject(destroy[6]);
  57. DestroyObject(destroy[7]);
  58. DestroyObject(destroy[8]);
  59. DestroyObject(destroy[9]);
  60.  
  61. TextDrawDestroy(blackscreen);
  62. return 1;}
  63.  
  64.  
  65. public OnPlayerConnect(playerid){
  66. if(IsPlayerNPC(playerid)){
  67. new botname[MAX_PLAYER_NAME];
  68. GetPlayerName(playerid, botname, sizeof(botname));
  69. if(!strcmp(botname, "GodModeTester", true)){
  70. print("GodModeTester connectet.");}
  71. return 1;}
  72. return 1;}
  73.  
  74.  
  75. public OnPlayerDisconnect(playerid, reason){
  76. if(IsPlayerNPC(playerid)){
  77. new botname[MAX_PLAYER_NAME];
  78. GetPlayerName(playerid, botname, sizeof(botname));
  79. if(!strcmp(botname, "GodModeTester", true)){
  80. print("GodModeTester disconnectet.");}
  81. return 1;}
  82. return 1;}
  83.  
  84.  
  85. public OnPlayerSpawn(playerid){
  86. if(IsPlayerNPC(playerid)){
  87. new botname[MAX_PLAYER_NAME];
  88. GetPlayerName(playerid, botname, sizeof(botname));
  89. if(!strcmp(botname, "GodModeTester", true)){
  90. SetPlayerSkin(playerid, 217);
  91. GivePlayerWeapon(playerid, 38, 999999999);
  92. SetPlayerPos(playerid, 1390.40002441,-23.79999924,1000.59997559);
  93. SetPlayerVirtualWorld(playerid, 100);
  94. SetPlayerInterior(playerid, 1);
  95. SetPlayerColor(playerid, 0xFFFFFF00);}
  96. return 1;}
  97. return 1;}
  98.  
  99.  
  100. ocmd:gm(playerid,params[]){
  101. new pID, name[MAX_PLAYERS], name1[MAX_PLAYERS], string[124];
  102. if(Abfrage[pID] >= 1) return SendClientMessage(playerid,COLOR_RED,"Es befindet sich grade jemand in der GodModeAbfrage!");
  103. if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,COLOR_RED,"Du darfst diesen Befehl nicht nutzen!"); //-------------Sollte dem Adminsystem angepasst werden-------------//
  104. if(sscanf(params,"u",pID))return SendClientMessage(playerid, COLOR_RED, "Benutze: /gm [Spieler]");
  105. if(!IsPlayerConnected(pID))return SendClientMessage(playerid, COLOR_RED, "Der Spieler ist nicht eingeloggt!");
  106. new Float:X,Float:Y,Float:Z, Interior=GetPlayerInterior(pID),Skin=GetPlayerSkin(pID), Virtual=GetPlayerVirtualWorld(pID), Float:Health, Float:Armour;
  107. GetPlayerPos(pID,X,Y,Z);
  108. GetPlayerHealth(pID, Health);
  109. GetPlayerArmour(pID, Armour);
  110. GetPlayerName(playerid,name,sizeof(name));
  111. GetPlayerName(pID,name1,sizeof(name1));
  112. format(string,sizeof(string), "%s lässt %s auf GodMode überprüfen.",name, name1);
  113. printf(string);
  114. SetPVarFloat(pID,"X",X);
  115. SetPVarFloat(pID,"Y",Y);
  116. SetPVarFloat(pID,"Z",Z);
  117. SetPVarInt(pID,"Interior",Interior);
  118. SetPVarInt(pID,"Virtual",Virtual);
  119. SetPVarInt(pID,"Skin",Skin);
  120. SetPVarFloat(pID,"Armour",Armour);
  121. SetPVarFloat(pID,"Health",Health);
  122. TextDrawShowForPlayer(pID, blackscreen);
  123. for(new i = 0; i < 9; i++){
  124. SendClientMessage(pID, COLOR_BLACK,"");}
  125. SendClientMessage(pID, COLOR_RED, "Du wirst auf GodMode überprüft.");
  126. SetPlayerVirtualWorld(pID, 100);
  127. SetPlayerInterior(pID, 1);
  128. SetPlayerPos(pID, 1405.80004883,-23.89999962,1000.59997559);
  129. ClearAnimations(pID);
  130. GivePlayerWeapon(pID, 0,0);
  131. SetPlayerSkin(pID, 0);
  132. TogglePlayerControllable(pID, 1);
  133. SetPlayerFacingAngle(pID, 90);
  134. SetPlayerArmour(pID, 0);
  135. SetPlayerHealth(pID, 100);
  136. AntiMultiPost = 0;
  137. Abfrage[pID] = SetTimerEx("GodModeTesting", 50, 1, "i", pID);
  138. Lagging[pID] = SetTimerEx("LaggingTesting", 250, 1, "i", pID);
  139. return 1;}
  140.  
  141.  
  142. forward LaggingTesting(playerid);
  143. public LaggingTesting(playerid){
  144. new string[128], name[MAX_PLAYERS];
  145. GetPlayerName(playerid,name,sizeof(name));
  146.  
  147. if(IsPlayerInRangeOfPoint(playerid, 1.5, GetPVarFloat(playerid,"X"), GetPVarFloat(playerid,"Y"), GetPVarFloat(playerid,"Z"))){
  148. KillTimer(Lagging[playerid]);
  149. KillTimer(Abfrage[playerid]);
  150. SetPlayerPos(playerid, GetPVarFloat(playerid,"X"), GetPVarFloat(playerid,"Y"), GetPVarFloat(playerid,"Z"));
  151. SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"Virtual"));
  152. SetPlayerInterior(playerid, GetPVarInt(playerid,"Interior"));
  153. SetPlayerArmour(playerid, GetPVarFloat(playerid,"Armour"));
  154. SetPlayerHealth(playerid, GetPVarFloat(playerid,"Health"));
  155. SetPlayerSkin(playerid, GetPVarInt(playerid,"Skin"));
  156. AntiMultiPost = 1;
  157. format(string,sizeof(string), "AdmCmd: %s wurde vom System gekickt. Grund: ESC/F8 abuse",name);
  158. SendClientMessageToAll(COLOR_RED, string);
  159. Wiederholung = 0;
  160. Kick(playerid);}
  161.  
  162. if(!IsPlayerInRangeOfPoint(playerid, 1.5, 1405.80004883,-23.89999962,1000.59997559)){
  163. KillTimer(Lagging[playerid]);
  164. KillTimer(Abfrage[playerid]);
  165. SetPlayerPos(playerid, GetPVarFloat(playerid,"X"), GetPVarFloat(playerid,"Y"), GetPVarFloat(playerid,"Z"));
  166. SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"Virtual"));
  167. SetPlayerInterior(playerid, GetPVarInt(playerid,"Interior"));
  168. SetPlayerArmour(playerid, GetPVarFloat(playerid,"Armour"));
  169. SetPlayerHealth(playerid, GetPVarFloat(playerid,"Health"));
  170. SetPlayerSkin(playerid, GetPVarInt(playerid,"Skin"));
  171. if(AntiMultiPost == 0){
  172. format(string,sizeof(string), "AdmCmd: %s wurde vom System gekickt. Grund: Lag",name);
  173. SendClientMessageToAll(COLOR_RED, string);
  174. Wiederholung = 0;
  175. Kick(playerid);}
  176. }
  177.  
  178. if(Wiederholung != 8){ //-----------------Da er alle 250 Milisekunden abfragt, wird hier Festgelegt wie lange er Abfragen soll. (2 Wiederholungen = 0,5 Sekunden)-----------------//
  179. Wiederholung++;}
  180.  
  181. if(Wiederholung == 8){ //-----------------Da er alle 250 Milisekunden abfragt, wird hier Festgelegt wie lange er Abfragen soll. (2 Wiederholungen = 0,5 Sekunden)-----------------//
  182. KillTimer(Lagging[playerid]);}
  183. return 1;}
  184.  
  185.  
  186. forward GodModeTesting(playerid);
  187. public GodModeTesting(playerid){
  188. new string[128], Float:Leben, name[MAX_PLAYERS];
  189. GetPlayerHealth(playerid, Leben);
  190. GetPlayerName(playerid,name,sizeof(name));
  191.  
  192. if(Leben < 80){
  193. KillTimer(Lagging[playerid]);
  194. KillTimer(Abfrage[playerid]);
  195. SetPlayerPos(playerid, GetPVarFloat(playerid,"X"), GetPVarFloat(playerid,"Y"), GetPVarFloat(playerid,"Z"));
  196. SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"Virtual"));
  197. SetPlayerInterior(playerid, GetPVarInt(playerid,"Interior"));
  198. SetPlayerArmour(playerid, GetPVarFloat(playerid,"Armour"));
  199. SetPlayerHealth(playerid, GetPVarFloat(playerid,"Health"));
  200. SetPlayerSkin(playerid, GetPVarInt(playerid,"Skin"));
  201. TextDrawHideForPlayer(playerid, blackscreen);
  202. Durchlauf = 0;}
  203.  
  204. if(Durchlauf != 45){ //-----------------Da er alle 50 Milisekunden abfragt, wird hier Festgelegt wie lange er Abfragen soll. (10 Durchläufe = 0,5 Sekunden)-----------------//
  205. Durchlauf++;}
  206.  
  207. if(Durchlauf == 45){ //-----------------Da er alle 50 Milisekunden abfragt, wird hier Festgelegt wie lange er Abfragen soll. (10 Durchläufe = 0,5 Sekunden)-----------------//
  208. KillTimer(Lagging[playerid]);
  209. KillTimer(Abfrage[playerid]);
  210. Durchlauf = 0;
  211. format(string,sizeof(string), "AdmCmd: %s wurde vom System gebannt. Grund: Cheater",name);
  212. SendClientMessageToAll(COLOR_RED, string);
  213. Ban(playerid);}
  214. return 1;}
  215.  
  216. stock sscanf(string[], format[], {Float,_}:...)
  217. {
  218. #if defined isnull
  219. if (isnull(string))
  220. #else
  221. if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  222. #endif
  223. {
  224. return format[0];
  225. }
  226. #pragma tabsize 4
  227. new
  228. formatPos = 0,
  229. stringPos = 0,
  230. paramPos = 2,
  231. paramCount = numargs(),
  232. delim = ' ';
  233. while (string[stringPos] && string[stringPos] <= ' ')
  234. {
  235. stringPos++;
  236. }
  237. while (paramPos < paramCount && string[stringPos])
  238. {
  239. switch (format[formatPos++])
  240. {
  241. case '\0':
  242. {
  243. return 0;
  244. }
  245. case 'i', 'd':
  246. {
  247. new
  248. neg = 1,
  249. num = 0,
  250. ch = string[stringPos];
  251. if (ch == '-')
  252. {
  253. neg = -1;
  254. ch = string[++stringPos];
  255. }
  256. do
  257. {
  258. stringPos++;
  259. if ('0' <= ch <= '9')
  260. {
  261. num = (num * 10) + (ch - '0');
  262. }
  263. else
  264. {
  265. return -1;
  266. }
  267. }
  268. while ((ch = string[stringPos]) > ' ' && ch != delim);
  269. setarg(paramPos, 0, num * neg);
  270. }
  271. case 'h', 'x':
  272. {
  273. new
  274. num = 0,
  275. ch = string[stringPos];
  276. do
  277. {
  278. stringPos++;
  279. switch (ch)
  280. {
  281. case 'x', 'X':
  282. {
  283. num = 0;
  284. continue;
  285. }
  286. case '0' .. '9':
  287. {
  288. num = (num << 4) | (ch - '0');
  289. }
  290. case 'a' .. 'f':
  291. {
  292. num = (num << 4) | (ch - ('a' - 10));
  293. }
  294. case 'A' .. 'F':
  295. {
  296. num = (num << 4) | (ch - ('A' - 10));
  297. }
  298. default:
  299. {
  300. return -1;
  301. }
  302. }
  303. }
  304. while ((ch = string[stringPos]) > ' ' && ch != delim);
  305. setarg(paramPos, 0, num);
  306. }
  307. case 'c':
  308. {
  309. setarg(paramPos, 0, string[stringPos++]);
  310. }
  311. case 'f':
  312. {
  313.  
  314. new changestr[16], changepos = 0, strpos = stringPos;
  315. while(changepos < 16 && string[strpos] && string[strpos] != delim)
  316. {
  317. changestr[changepos++] = string[strpos++];
  318. }
  319. changestr[changepos] = '\0';
  320. setarg(paramPos,0,_:floatstr(changestr));
  321. }
  322. case 'p':
  323. {
  324. delim = format[formatPos++];
  325. continue;
  326. }
  327. case '\'':
  328. {
  329. new
  330. end = formatPos - 1,
  331. ch;
  332. while ((ch = format[++end]) && ch != '\'') {}
  333. if (!ch)
  334. {
  335. return -1;
  336. }
  337. format[end] = '\0';
  338. if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  339. {
  340. if (format[end + 1])
  341. {
  342. return -1;
  343. }
  344. return 0;
  345. }
  346. format[end] = '\'';
  347. stringPos = ch + (end - formatPos);
  348. formatPos = end + 1;
  349. }
  350. case 'u':
  351. {
  352. new
  353. end = stringPos - 1,
  354. id = 0,
  355. bool:num = true,
  356. ch;
  357. while ((ch = string[++end]) && ch != delim)
  358. {
  359. if (num)
  360. {
  361. if ('0' <= ch <= '9')
  362. {
  363. id = (id * 10) + (ch - '0');
  364. }
  365. else
  366. {
  367. num = false;
  368. }
  369. }
  370. }
  371. if (num && IsPlayerConnected(id))
  372. {
  373. setarg(paramPos, 0, id);
  374. }
  375. else
  376. {
  377. #if !defined foreach
  378. #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  379. #define __SSCANF_FOREACH__
  380. #endif
  381. string[end] = '\0';
  382. num = false;
  383. new
  384. name[MAX_PLAYER_NAME];
  385. id = end - stringPos;
  386. foreach (Player, playerid)
  387. {
  388. GetPlayerName(playerid, name, sizeof (name));
  389. if (!strcmp(name, string[stringPos], true, id))
  390. {
  391. setarg(paramPos, 0, playerid);
  392. num = true;
  393. break;
  394. }
  395. }
  396. if (!num)
  397. {
  398. setarg(paramPos, 0, INVALID_PLAYER_ID);
  399. }
  400. string[end] = ch;
  401. #if defined __SSCANF_FOREACH__
  402. #undef foreach
  403. #undef __SSCANF_FOREACH__
  404. #endif
  405. }
  406. stringPos = end;
  407. }
  408. case 's', 'z':
  409. {
  410. new
  411. i = 0,
  412. ch;
  413. if (format[formatPos])
  414. {
  415. while ((ch = string[stringPos++]) && ch != delim)
  416. {
  417. setarg(paramPos, i++, ch);
  418. }
  419. if (!i)
  420. {
  421. return -1;
  422. }
  423. }
  424. else
  425. {
  426. while ((ch = string[stringPos++]))
  427. {
  428. setarg(paramPos, i++, ch);
  429. }
  430. }
  431. stringPos--;
  432. setarg(paramPos, i, '\0');
  433. }
  434. default:
  435. {
  436. continue;
  437. }
  438. }
  439. while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  440. {
  441. stringPos++;
  442. }
  443. while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  444. {
  445. stringPos++;
  446. }
  447. paramPos++;
  448. }
  449. do
  450. {
  451. if ((delim = format[formatPos++]) > ' ')
  452. {
  453. if (delim == '\'')
  454. {
  455. while ((delim = format[formatPos++]) && delim != '\'') {}
  456. }
  457. else if (delim != 'z')
  458. {
  459. return delim;
  460. }
  461. }
  462. }
  463. while (delim > ' ');
  464. return 0;
  465. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement