Spielie

Untitled

Feb 2nd, 2013
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.34 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define dcmd(%1,%2,%3) if(!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  4.  
  5. #define COLOR_GREY 0xAFAFAFAA
  6.  
  7. new Float:pX[MAX_PLAYERS], Float:pY[MAX_PLAYERS], Float:pZ[MAX_PLAYERS];
  8.  
  9. public OnPlayerCommandText(playerid, cmdtext[])
  10. {
  11. dcmd(aimbottest, 10, cmdtext);
  12. return 0;
  13. }
  14.  
  15. dcmd_aimbottest(playerid,params[])
  16. {
  17. new pID;
  18. if(sscanf(params, "u", pID))
  19. {
  20. SendClientMessage(playerid, 0xffffffff, "Benutzung: /aimbottest [SpielerID]");
  21. return 1;
  22. }
  23. new Float:x, Float:y, Float:z;
  24. GetPlayerCameraPos(pID, x, y, z);
  25.  
  26. new Float:posX, Float:posY, Float:posZ;
  27. GetPlayerCameraPos(playerid, posX, posY, posZ);
  28.  
  29. GetPlayerPos(playerid, pX[playerid], pY[playerid], pZ[playerid]);
  30.  
  31. SetPlayerPos(playerid, x, y, z-1.0);
  32. TogglePlayerControllable(playerid,0);
  33. SetPlayerCameraPos(playerid, posX, posY, posZ);
  34. SetPlayerCameraLookAt(playerid, x, y, z);
  35.  
  36. SetTimerEx("AimbotTimerC", 1000, false, "d", playerid);
  37.  
  38. new str[256];
  39. /*Falls einer genauere Daten braucht :)
  40. format(str, sizeof(str), "Seine Cam-Pos: %f %f %f", x, y, z);
  41. SendClientMessage(playerid, COLOR_GREY, str);
  42. format(str, sizeof(str), "Deine Cam-Pos: %f %f %f", posX, posY, posZ);
  43. SendClientMessage(playerid, COLOR_GREY, str);
  44. format(str, sizeof(str), "Deine Pos: %f %f %f", pX[playerid], pY[playerid], pZ[playerid]);
  45. SendClientMessage(playerid, COLOR_GREY, str);*/
  46. return 1;
  47. }
  48.  
  49. forward AimbotTimerC(playerid, x, y, z);
  50. public AimbotTimerC(playerid, x, y, z)
  51. {
  52. SetPlayerPos(playerid, pX[playerid], pY[playerid], pZ[playerid]);
  53. TogglePlayerControllable(playerid,1);
  54. SetCameraBehindPlayer(playerid);
  55. return 1;
  56. }
  57.  
  58. stock sscanf(string[], format[], {Float,_}:...)
  59. {
  60. #if defined isnull
  61. if(isnull(string))
  62. #else
  63. if(string[0] == 0 || (string[0] == 1 && string[1] == 0))
  64. #endif
  65. {
  66. return format[0];
  67. }
  68. #pragma tabsize 4
  69. new
  70. formatPos = 0,
  71. stringPos = 0,
  72. paramPos = 2,
  73. paramCount = numargs(),
  74. delim = ' ';
  75. while (string[stringPos] && string[stringPos] <= ' ')
  76. {
  77. stringPos++;
  78. }
  79. while (paramPos < paramCount && string[stringPos])
  80. {
  81. switch (format[formatPos++])
  82. {
  83. case '\0':
  84. {
  85. return 0;
  86. }
  87. case 'i', 'd':
  88. {
  89. new
  90. neg = 1,
  91. num = 0,
  92. ch = string[stringPos];
  93. if(ch == '-')
  94. {
  95. neg = -1;
  96. ch = string[++stringPos];
  97. }
  98. do
  99. {
  100. stringPos++;
  101. if('0' <= ch <= '9')
  102. {
  103. num = (num * 10) + (ch - '0');
  104. }
  105. else
  106. {
  107. return -1;
  108. }
  109. }
  110. while ((ch = string[stringPos]) > ' ' && ch != delim);
  111. setarg(paramPos, 0, num * neg);
  112. }
  113. case 'h', 'x':
  114. {
  115. new
  116. num = 0,
  117. ch = string[stringPos];
  118. do
  119. {
  120. stringPos++;
  121. switch (ch)
  122. {
  123. case 'x', 'X':
  124. {
  125. num = 0;
  126. continue;
  127. }
  128. case '0' .. '9':
  129. {
  130. num = (num << 4) | (ch - '0');
  131. }
  132. case 'a' .. 'f':
  133. {
  134. num = (num << 4) | (ch - ('a' - 10));
  135. }
  136. case 'A' .. 'F':
  137. {
  138. num = (num << 4) | (ch - ('A' - 10));
  139. }
  140. default:
  141. {
  142. return -1;
  143. }
  144. }
  145. }
  146. while ((ch = string[stringPos]) > ' ' && ch != delim);
  147. setarg(paramPos, 0, num);
  148. }
  149. case 'c':
  150. {
  151. setarg(paramPos, 0, string[stringPos++]);
  152. }
  153. case 'f':
  154. {
  155.  
  156. new changestr[16], changepos = 0, strpos = stringPos;
  157. while(changepos < 16 && string[strpos] && string[strpos] != delim)
  158. {
  159. changestr[changepos++] = string[strpos++];
  160. }
  161. changestr[changepos] = '\0';
  162. setarg(paramPos,0,_:floatstr(changestr));
  163. }
  164. case 'p':
  165. {
  166. delim = format[formatPos++];
  167. continue;
  168. }
  169. case '\'':
  170. {
  171. new
  172. end = formatPos - 1,
  173. ch;
  174. while ((ch = format[++end]) && ch != '\'') {}
  175. if(!ch)
  176. {
  177. return -1;
  178. }
  179. format[end] = '\0';
  180. if((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  181. {
  182. if(format[end + 1])
  183. {
  184. return -1;
  185. }
  186. return 0;
  187. }
  188. format[end] = '\'';
  189. stringPos = ch + (end - formatPos);
  190. formatPos = end + 1;
  191. }
  192. case 'u':
  193. {
  194. new
  195. end = stringPos - 1,
  196. id = 0,
  197. bool:num = true,
  198. ch;
  199. while ((ch = string[++end]) && ch != delim)
  200. {
  201. if(num)
  202. {
  203. if('0' <= ch <= '9')
  204. {
  205. id = (id * 10) + (ch - '0');
  206. }
  207. else
  208. {
  209. num = false;
  210. }
  211. }
  212. }
  213. if(num && IsPlayerConnected(id))
  214. {
  215. setarg(paramPos, 0, id);
  216. }
  217. else
  218. {
  219. #if !defined foreach
  220. #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if(IsPlayerConnected(%2))
  221. #define __SSCANF_FOREACH__
  222. #endif
  223. string[end] = '\0';
  224. num = false;
  225. new
  226. name[MAX_PLAYER_NAME];
  227. id = end - stringPos;
  228. foreach (Player, playerid)
  229. {
  230. GetPlayerName(playerid, name, sizeof (name));
  231. if(!strcmp(name, string[stringPos], true, id))
  232. {
  233. setarg(paramPos, 0, playerid);
  234. num = true;
  235. break;
  236. }
  237. }
  238. if(!num)
  239. {
  240. setarg(paramPos, 0, INVALID_PLAYER_ID);
  241. }
  242. string[end] = ch;
  243. #if defined __SSCANF_FOREACH__
  244. #undef foreach
  245. #undef __SSCANF_FOREACH__
  246. #endif
  247. }
  248. stringPos = end;
  249. }
  250. case 's', 'z':
  251. {
  252. new
  253. i = 0,
  254. ch;
  255. if(format[formatPos])
  256. {
  257. while ((ch = string[stringPos++]) && ch != delim)
  258. {
  259. setarg(paramPos, i++, ch);
  260. }
  261. if(!i)
  262. {
  263. return -1;
  264. }
  265. }
  266. else
  267. {
  268. while ((ch = string[stringPos++]))
  269. {
  270. setarg(paramPos, i++, ch);
  271. }
  272. }
  273. stringPos--;
  274. setarg(paramPos, i, '\0');
  275. }
  276. default:
  277. {
  278. continue;
  279. }
  280. }
  281. while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  282. {
  283. stringPos++;
  284. }
  285. while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  286. {
  287. stringPos++;
  288. }
  289. paramPos++;
  290. }
  291. do
  292. {
  293. if((delim = format[formatPos++]) > ' ')
  294. {
  295. if(delim == '\'')
  296. {
  297. while ((delim = format[formatPos++]) && delim != '\'') {}
  298. }
  299. else if(delim != 'z')
  300. {
  301. return delim;
  302. }
  303. }
  304. }
  305. while (delim > ' ');
  306. return 0;
  307. }
Advertisement
Add Comment
Please, Sign In to add comment