Advertisement
Guest User

Hilfreiche_Befehle

a guest
Jul 16th, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.89 KB | None | 0 0
  1. /*
  2.  
  3. Hilfreiche Admin Befehle by Lukas aka DreamYy
  4. Copyrigth darf entfernt werden.
  5.  
  6. 22:30
  7.  
  8. */
  9. #define FILTERSCRIPT
  10.  
  11. #define ROT 0xE10000FF
  12.  
  13. #include <a_samp>
  14. #include <dini>
  15. #include <ocmd>
  16.  
  17. #if defined FILTERSCRIPT
  18.  
  19. public OnFilterScriptInit()
  20. {
  21. print("\n--------------------------------------");
  22. print(" Hilfreiche Befehle by DreamYy ");
  23. print("--------------------------------------\n");
  24. return 1;
  25. }
  26.  
  27. public OnFilterScriptExit()
  28. {
  29. return 1;
  30. }
  31.  
  32. #else
  33.  
  34. main()
  35. {
  36. print("\n----------------------------------");
  37. print(" ");
  38. print("----------------------------------\n");
  39. }
  40.  
  41. #endif
  42.  
  43.  
  44.  
  45. ///////////////// Befehle //////////////////
  46.  
  47. // 1. /veh
  48.  
  49. ocmd:veh(playerid,params[])
  50. {
  51. new AutoID, farbe[2],Float:VehPos[4], vehicleid;
  52. if(GetPlayerState(playerid)!=PLAYER_STATE_ONFOOT) return SendClientMessage(playerid,0xB0AFB0FF,"Du bist vereits in einem Auto!");
  53. if(sscanf(params, "ddd",AutoID,farbe[0],farbe[1])) return SendClientMessage(playerid,0xB0AFB0FF, "/veh [AutoID] [Farbe1] [Farbe2]");
  54. if(AutoID < 400 || AutoID > 611) return SendClientMessage(playerid,0xB0AFB0FF, "Diese Auto ID existiert nicht.");
  55. if(farbe[0] < 0 || farbe[0] > 126 || farbe[1] < 0 || farbe[1] > 126) return SendClientMessage(playerid,0xB0AFB0FF, "Wähle eine Farbe zwischen 0 und 126.");
  56. //ADMIN ABFRAGE
  57. GetPlayerPos(playerid, VehPos[0],VehPos[1],VehPos[2]);
  58. GetPlayerFacingAngle(playerid, VehPos[3]);
  59. vehicleid = CreateVehicle(AutoID,VehPos[0],VehPos[1],VehPos[2],VehPos[3],farbe[0],farbe[1],-1);
  60. LinkVehicleToInterior(vehicleid,GetPlayerInterior(playerid));
  61. SetVehicleVirtualWorld(vehicleid,GetPlayerVirtualWorld(playerid));
  62. PutPlayerInVehicle(playerid, vehicleid, 0);
  63. return 1;
  64. }
  65.  
  66. // 2. /kick
  67.  
  68. ocmd:kick(playerid,params[])
  69. {
  70. new SpielerID, Grund[128],string[128];
  71. //Admin Abfrage
  72. if(sscanf(params,"us",SpielerID,Grund))return SendClientMessage(playerid,ROT,"Benutze: /kick [id] [grund]");
  73. format(string,sizeof(string),"AdmCmd: %s wurde von %s gekickt. Grund: %s",SpielerName(SpielerID),SpielerName(playerid),Grund);
  74. SendClientMessageToAll(ROT,string);
  75. Kick(SpielerID);
  76. return 1;
  77. }
  78.  
  79. // 3. /goto
  80.  
  81. ocmd:goto(playerid,params[])
  82. {
  83. new SpielerID, Float: X, Float: Y, Float: Z, Float: Angle;
  84. new string[64];
  85. if(sscanf(params,"d",SpielerID))return SendClientMessage(playerid,ROT,"Benutze: /goto [playerid]");
  86. GetPlayerPos(SpielerID,X,Y,Z);
  87. GetPlayerFacingAngle(SpielerID,Angle);
  88. SetPlayerPos(playerid,X,Y,Z);
  89. SetPlayerFacingAngle(playerid,Angle);
  90. format(string,sizeof(string),"Der Administrator %s hat sich zu dir geportet!",SpielerName(playerid));
  91. SendClientMessage(SpielerID,ROT,string);
  92. return 1;
  93. }
  94.  
  95. // 4. /gethere
  96.  
  97. ocmd:gethere(playerid,params[])
  98. {
  99. new SpielerID, Float: X, Float: Y, Float: Z, Float: Angle;
  100. new string[64];
  101. if(sscanf(params,"d",SpielerID))return SendClientMessage(playerid,ROT,"/gethere [playerid]");
  102. GetPlayerPos(playerid,X,Y,Z);
  103. GetPlayerFacingAngle(playerid,Angle);
  104. SetPlayerPos(SpielerID,X,Y,Z);
  105. SetPlayerFacingAngle(SpielerID,Angle);
  106. format(string,sizeof(string),"Der Administrator %s hat dich zu ihm geportet!",SpielerName(playerid));
  107. SendClientMessage(SpielerID,ROT,string);
  108. return 1;
  109. }
  110.  
  111. // 5. /afreeze
  112.  
  113. ocmd:afreeze(playerid,params[])
  114. {
  115. new SpielerID, str[64];
  116. if(sscanf(params,"uz",SpielerID,str)) return SendClientMessage(playerid,ROT,"Benutze: /afreeze [playerid][Grund]");
  117. new Player[MAX_PLAYER_NAME] , str2[128];
  118. GetPlayerName(SpielerID,Player,sizeof(Player));
  119. format(str2,sizeof(str2),"%s wurde vom Admin %s gefreezed Grund : %s",Player,SpielerName(playerid),str);
  120. SendClientMessageToAll(ROT,str2);
  121. TogglePlayerControllable(SpielerID, 0);
  122.  
  123. return 1;
  124. }
  125.  
  126. // 6. /aunfreeze
  127.  
  128. ocmd:aunfreeze(playerid,params[])
  129. {
  130. new SpielerID, str[64];
  131. if(sscanf(params,"u",SpielerID,str)) return SendClientMessage(playerid,ROT,"Benutze: /aunfreeze [Spieler ID]");
  132. new Player[MAX_PLAYER_NAME] , str2[128];
  133. GetPlayerName(SpielerID,Player,sizeof(Player));
  134. format(str2,sizeof(str2),"%s wurde entfreezed.",Player);
  135. SendClientMessageToAll(ROT,str2);
  136. TogglePlayerControllable(SpielerID, 1);
  137. return 1;
  138. }
  139.  
  140.  
  141.  
  142. stock SpielerName(playerid)
  143. {
  144. new name[MAX_PLAYER_NAME];
  145. GetPlayerName(playerid,name,sizeof(name));
  146. return name;
  147. }
  148.  
  149. stock sscanf(sstring[], format[], {Float,_}:...)
  150. {
  151. #if defined isnull
  152. if (isnull(sstring))
  153. #else
  154. if (sstring[0] == 0 || (sstring[0] == 1 && sstring[1] == 0))
  155. #endif
  156. {
  157. return format[0];
  158. }
  159. #pragma tabsize 4
  160. new
  161. formatPos = 0,
  162. sstringPos = 0,
  163. paramPos = 2,
  164. paramCount = numargs(),
  165. delim = ' ';
  166. while (sstring[sstringPos] && sstring[sstringPos] <= ' ')
  167. {
  168. sstringPos++;
  169. }
  170. while (paramPos < paramCount && sstring[sstringPos])
  171. {
  172. switch (format[formatPos++])
  173. {
  174. case '\0':
  175. {
  176. return 0;
  177. }
  178. case 'i', 'd':
  179. {
  180. new
  181. neg = 1,
  182. num = 0,
  183. ch = sstring[sstringPos];
  184. if (ch == '-')
  185. {
  186. neg = -1;
  187. ch = sstring[++sstringPos];
  188. }
  189. do
  190. {
  191. sstringPos++;
  192. if ('0' <= ch <= '9')
  193. {
  194. num = (num * 10) + (ch - '0');
  195. }
  196. else
  197. {
  198. return -1;
  199. }
  200. }
  201. while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
  202. setarg(paramPos, 0, num * neg);
  203. }
  204. case 'h', 'x':
  205. {
  206. new
  207. num = 0,
  208. ch = sstring[sstringPos];
  209. do
  210. {
  211. sstringPos++;
  212. switch (ch)
  213. {
  214. case 'x', 'X':
  215. {
  216. num = 0;
  217. continue;
  218. }
  219. case '0' .. '9':
  220. {
  221. num = (num << 4) | (ch - '0');
  222. }
  223. case 'a' .. 'f':
  224. {
  225. num = (num << 4) | (ch - ('a' - 10));
  226. }
  227. case 'A' .. 'F':
  228. {
  229. num = (num << 4) | (ch - ('A' - 10));
  230. }
  231. default:
  232. {
  233. return -1;
  234. }
  235. }
  236. }
  237. while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
  238. setarg(paramPos, 0, num);
  239. }
  240. case 'c':
  241. {
  242. setarg(paramPos, 0, sstring[sstringPos++]);
  243. }
  244. case 'f':
  245. {
  246.  
  247. new changestr[16], changepos = 0, strpos = sstringPos;
  248. while(changepos < 16 && sstring[strpos] && sstring[strpos] != delim)
  249. {
  250. changestr[changepos++] = sstring[strpos++];
  251. }
  252. changestr[changepos] = '\0';
  253. setarg(paramPos,0,_:floatstr(changestr));
  254. }
  255. case 'p':
  256. {
  257. delim = format[formatPos++];
  258. continue;
  259. }
  260. case '\'':
  261. {
  262. new
  263. end = formatPos - 1,
  264. ch;
  265. while ((ch = format[++end]) && ch != '\'') {}
  266. if (!ch)
  267. {
  268. return -1;
  269. }
  270. format[end] = '\0';
  271. if ((ch = strfind(sstring, format[formatPos], false, sstringPos)) == -1)
  272. {
  273. if (format[end + 1])
  274. {
  275. return -1;
  276. }
  277. return 0;
  278. }
  279. format[end] = '\'';
  280. sstringPos = ch + (end - formatPos);
  281. formatPos = end + 1;
  282. }
  283. case 'u':
  284. {
  285. new
  286. end = sstringPos - 1,
  287. id = 0,
  288. bool:num = true,
  289. ch;
  290. while ((ch = sstring[++end]) && ch != delim)
  291. {
  292. if (num)
  293. {
  294. if ('0' <= ch <= '9')
  295. {
  296. id = (id * 10) + (ch - '0');
  297. }
  298. else
  299. {
  300. num = false;
  301. }
  302. }
  303. }
  304. if (num && IsPlayerConnected(id))
  305. {
  306. setarg(paramPos, 0, id);
  307. }
  308. else
  309. {
  310. #if !defined foreach
  311. #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  312. #define __SSCANF_FOREACH__
  313. #endif
  314. sstring[end] = '\0';
  315. num = false;
  316. new
  317. name[MAX_PLAYER_NAME];
  318. id = end - sstringPos;
  319. foreach (Player, playerid)
  320. {
  321. GetPlayerName(playerid, name, sizeof (name));
  322. if (!strcmp(name, sstring[sstringPos], true, id))
  323. {
  324. setarg(paramPos, 0, playerid);
  325. num = true;
  326. break;
  327. }
  328. }
  329. if (!num)
  330. {
  331. setarg(paramPos, 0, INVALID_PLAYER_ID);
  332. }
  333. sstring[end] = ch;
  334. #if defined __SSCANF_FOREACH__
  335. #undef foreach
  336. #undef __SSCANF_FOREACH__
  337. #endif
  338. }
  339. sstringPos = end;
  340. }
  341. case 's', 'z':
  342. {
  343. new
  344. i = 0,
  345. ch;
  346. if (format[formatPos])
  347. {
  348. while ((ch = sstring[sstringPos++]) && ch != delim)
  349. {
  350. setarg(paramPos, i++, ch);
  351. }
  352. if (!i)
  353. {
  354. return -1;
  355. }
  356. }
  357. else
  358. {
  359. while ((ch = sstring[sstringPos++]))
  360. {
  361. setarg(paramPos, i++, ch);
  362. }
  363. }
  364. sstringPos--;
  365. setarg(paramPos, i, '\0');
  366. }
  367. default:
  368. {
  369. continue;
  370. }
  371. }
  372. while (sstring[sstringPos] && sstring[sstringPos] != delim && sstring[sstringPos] > ' ')
  373. {
  374. sstringPos++;
  375. }
  376. while (sstring[sstringPos] && (sstring[sstringPos] == delim || sstring[sstringPos] <= ' '))
  377. {
  378. sstringPos++;
  379. }
  380. paramPos++;
  381. }
  382. do
  383. {
  384. if ((delim = format[formatPos++]) > ' ')
  385. {
  386. if (delim == '\'')
  387. {
  388. while ((delim = format[formatPos++]) && delim != '\'') {}
  389. }
  390. else if (delim != 'z')
  391. {
  392. return delim;
  393. }
  394. }
  395. }
  396. while (delim > ' ');
  397. return 0;
  398. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement