Advertisement
Guest User

Untitled

a guest
Aug 7th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.24 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <ocmd>
  4.  
  5. #define Rot 0xBB0000FF
  6. #define Grün 0x00BB00FF
  7.  
  8. #if defined FILTERSCRIPT
  9.  
  10. public OnFilterScriptInit()
  11. {
  12. print("\n--------------------------------------");
  13. print(" Blank Filterscript by your name here");
  14. print("--------------------------------------\n");
  15. return 1;
  16. }
  17.  
  18. public OnFilterScriptExit()
  19. {
  20. return 1;
  21. }
  22.  
  23. #else
  24.  
  25. main()
  26. {
  27. print("\n----------------------------------");
  28. print(" Blank Gamemode by your name here");
  29. print("----------------------------------\n");
  30. }
  31.  
  32. #endif
  33.  
  34. public OnGameModeInit()
  35. {
  36. SetGameModeText("Blank Script");
  37. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  38. return 1;
  39. }
  40.  
  41. public OnGameModeExit()
  42. {
  43. return 1;
  44. }
  45.  
  46. public OnPlayerRequestClass(playerid, classid)
  47. {
  48. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  49. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  50. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  51. return 1;
  52. }
  53.  
  54. public OnPlayerConnect(playerid)
  55. {
  56. return 1;
  57. }
  58.  
  59. public OnPlayerDisconnect(playerid, reason)
  60. {
  61. return 1;
  62. }
  63.  
  64. public OnPlayerSpawn(playerid)
  65. {
  66. return 1;
  67. }
  68.  
  69. public OnPlayerDeath(playerid, killerid, reason)
  70. {
  71. return 1;
  72. }
  73.  
  74. public OnVehicleSpawn(vehicleid)
  75. {
  76. return 1;
  77. }
  78.  
  79. public OnVehicleDeath(vehicleid, killerid)
  80. {
  81. return 1;
  82. }
  83.  
  84. public OnPlayerText(playerid, text[])
  85. {
  86. return 1;
  87. }
  88.  
  89. //OCMD-Befehle
  90. ocmd:invite(playerid,params[])
  91. {
  92. new pID;
  93. if(sscanf(params,"i",pID))return SendClientMessage(playerid,Grün,"Benutze: /invite [ID]");
  94. SetPlayerColor(playerid,Rot);
  95. SetPlayerPos(playerid,1546.3073,-1675.5354,13.5621,89.4451);
  96. return 1;
  97. }
  98.  
  99. public OnPlayerCommandText(playerid, cmdtext[])
  100. {
  101. return 0;
  102. }
  103.  
  104. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  105. {
  106. return 1;
  107. }
  108.  
  109. public OnPlayerExitVehicle(playerid, vehicleid)
  110. {
  111. return 1;
  112. }
  113.  
  114. public OnPlayerStateChange(playerid, newstate, oldstate)
  115. {
  116. return 1;
  117. }
  118.  
  119. public OnPlayerEnterCheckpoint(playerid)
  120. {
  121. return 1;
  122. }
  123.  
  124. public OnPlayerLeaveCheckpoint(playerid)
  125. {
  126. return 1;
  127. }
  128.  
  129. public OnPlayerEnterRaceCheckpoint(playerid)
  130. {
  131. return 1;
  132. }
  133.  
  134. public OnPlayerLeaveRaceCheckpoint(playerid)
  135. {
  136. return 1;
  137. }
  138.  
  139. public OnRconCommand(cmd[])
  140. {
  141. return 1;
  142. }
  143.  
  144. public OnPlayerRequestSpawn(playerid)
  145. {
  146. return 1;
  147. }
  148.  
  149. public OnObjectMoved(objectid)
  150. {
  151. return 1;
  152. }
  153.  
  154. public OnPlayerObjectMoved(playerid, objectid)
  155. {
  156. return 1;
  157. }
  158.  
  159. public OnPlayerPickUpPickup(playerid, pickupid)
  160. {
  161. return 1;
  162. }
  163.  
  164. public OnVehicleMod(playerid, vehicleid, componentid)
  165. {
  166. return 1;
  167. }
  168.  
  169. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  170. {
  171. return 1;
  172. }
  173.  
  174. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  175. {
  176. return 1;
  177. }
  178.  
  179. public OnPlayerSelectedMenuRow(playerid, row)
  180. {
  181. return 1;
  182. }
  183.  
  184. public OnPlayerExitedMenu(playerid)
  185. {
  186. return 1;
  187. }
  188.  
  189. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  190. {
  191. return 1;
  192. }
  193.  
  194. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  195. {
  196. return 1;
  197. }
  198.  
  199. public OnRconLoginAttempt(ip[], password[], success)
  200. {
  201. return 1;
  202. }
  203.  
  204. public OnPlayerUpdate(playerid)
  205. {
  206. return 1;
  207. }
  208.  
  209. public OnPlayerStreamIn(playerid, forplayerid)
  210. {
  211. return 1;
  212. }
  213.  
  214. public OnPlayerStreamOut(playerid, forplayerid)
  215. {
  216. return 1;
  217. }
  218.  
  219. public OnVehicleStreamIn(vehicleid, forplayerid)
  220. {
  221. return 1;
  222. }
  223.  
  224. public OnVehicleStreamOut(vehicleid, forplayerid)
  225. {
  226. return 1;
  227. }
  228.  
  229. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  230. {
  231. return 1;
  232. }
  233.  
  234. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  235. {
  236. return 1;
  237. }
  238.  
  239. //-----------------SSCANF-------------------------
  240. stock sscanf(string[], format[], {Float,_}:...)
  241. {
  242. #if defined isnull
  243. if (isnull(string))
  244. #else
  245. if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  246. #endif
  247. {
  248. return format[0];
  249. }
  250. #pragma tabsize 4
  251. new
  252. formatPos = 0,
  253. stringPos = 0,
  254. paramPos = 2,
  255. paramCount = numargs(),
  256. delim = ' ';
  257. while (string[stringPos] && string[stringPos] <= ' ')
  258. {
  259. stringPos++;
  260. }
  261. while (paramPos < paramCount && string[stringPos])
  262. {
  263. switch (format[formatPos++])
  264. {
  265. case '\0':
  266. {
  267. return 0;
  268. }
  269. case 'i', 'd':
  270. {
  271. new
  272. neg = 1,
  273. num = 0,
  274. ch = string[stringPos];
  275. if (ch == '-')
  276. {
  277. neg = -1;
  278. ch = string[++stringPos];
  279. }
  280. do
  281. {
  282. stringPos++;
  283. if ('0' <= ch <= '9')
  284. {
  285. num = (num * 10) + (ch - '0');
  286. }
  287. else
  288. {
  289. return -1;
  290. }
  291. }
  292. while ((ch = string[stringPos]) > ' ' && ch != delim);
  293. setarg(paramPos, 0, num * neg);
  294. }
  295. case 'h', 'x':
  296. {
  297. new
  298. num = 0,
  299. ch = string[stringPos];
  300. do
  301. {
  302. stringPos++;
  303. switch (ch)
  304. {
  305. case 'x', 'X':
  306. {
  307. num = 0;
  308. continue;
  309. }
  310. case '0' .. '9':
  311. {
  312. num = (num << 4) | (ch - '0');
  313. }
  314. case 'a' .. 'f':
  315. {
  316. num = (num << 4) | (ch - ('a' - 10));
  317. }
  318. case 'A' .. 'F':
  319. {
  320. num = (num << 4) | (ch - ('A' - 10));
  321. }
  322. default:
  323. {
  324. return -1;
  325. }
  326. }
  327. }
  328. while ((ch = string[stringPos]) > ' ' && ch != delim);
  329. setarg(paramPos, 0, num);
  330. }
  331. case 'c':
  332. {
  333. setarg(paramPos, 0, string[stringPos++]);
  334. }
  335. case 'f':
  336. {
  337.  
  338. new changestr[16], changepos = 0, strpos = stringPos;
  339. while(changepos < 16 && string[strpos] && string[strpos] != delim)
  340. {
  341. changestr[changepos++] = string[strpos++];
  342. }
  343. changestr[changepos] = '\0';
  344. setarg(paramPos,0,_:floatstr(changestr));
  345. }
  346. case 'p':
  347. {
  348. delim = format[formatPos++];
  349. continue;
  350. }
  351. case '\'':
  352. {
  353. new
  354. end = formatPos - 1,
  355. ch;
  356. while ((ch = format[++end]) && ch != '\'') {}
  357. if (!ch)
  358. {
  359. return -1;
  360. }
  361. format[end] = '\0';
  362. if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  363. {
  364. if (format[end + 1])
  365. {
  366. return -1;
  367. }
  368. return 0;
  369. }
  370. format[end] = '\'';
  371. stringPos = ch + (end - formatPos);
  372. formatPos = end + 1;
  373. }
  374. case 'u':
  375. {
  376. new
  377. end = stringPos - 1,
  378. id = 0,
  379. bool:num = true,
  380. ch;
  381. while ((ch = string[++end]) && ch != delim)
  382. {
  383. if (num)
  384. {
  385. if ('0' <= ch <= '9')
  386. {
  387. id = (id * 10) + (ch - '0');
  388. }
  389. else
  390. {
  391. num = false;
  392. }
  393. }
  394. }
  395. if (num && IsPlayerConnected(id))
  396. {
  397. setarg(paramPos, 0, id);
  398. }
  399. else
  400. {
  401. #if !defined foreach
  402. #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  403. #define __SSCANF_FOREACH__
  404. #endif
  405. string[end] = '\0';
  406. num = false;
  407. new
  408. name[MAX_PLAYER_NAME];
  409. id = end - stringPos;
  410. foreach (Player, playerid)
  411. {
  412. GetPlayerName(playerid, name, sizeof (name));
  413. if (!strcmp(name, string[stringPos], true, id))
  414. {
  415. setarg(paramPos, 0, playerid);
  416. num = true;
  417. break;
  418. }
  419. }
  420. if (!num)
  421. {
  422. setarg(paramPos, 0, INVALID_PLAYER_ID);
  423. }
  424. string[end] = ch;
  425. #if defined __SSCANF_FOREACH__
  426. #undef foreach
  427. #undef __SSCANF_FOREACH__
  428. #endif
  429. }
  430. stringPos = end;
  431. }
  432. case 's', 'z':
  433. {
  434. new
  435. i = 0,
  436. ch;
  437. if (format[formatPos])
  438. {
  439. while ((ch = string[stringPos++]) && ch != delim)
  440. {
  441. setarg(paramPos, i++, ch);
  442. }
  443. if (!i)
  444. {
  445. return -1;
  446. }
  447. }
  448. else
  449. {
  450. while ((ch = string[stringPos++]))
  451. {
  452. setarg(paramPos, i++, ch);
  453. }
  454. }
  455. stringPos--;
  456. setarg(paramPos, i, '\0');
  457. }
  458. default:
  459. {
  460. continue;
  461. }
  462. }
  463. while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  464. {
  465. stringPos++;
  466. }
  467. while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  468. {
  469. stringPos++;
  470. }
  471. paramPos++;
  472. }
  473. do
  474. {
  475. if ((delim = format[formatPos++]) > ' ')
  476. {
  477. if (delim == '\'')
  478. {
  479. while ((delim = format[formatPos++]) && delim != '\'') {}
  480. }
  481. else if (delim != 'z')
  482. {
  483. return delim;
  484. }
  485. }
  486. }
  487. while (delim > ' ');
  488. return 0;
  489. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement