Advertisement
Guest User

Untitled

a guest
Jul 31st, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.34 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <ocmd>
  4.  
  5. #define Rot 0xFF0000FF
  6. #define Grün 0x00FF00FF
  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. //OCMD
  89. ocmd:givepremium(playerid,params[])
  90. {
  91. new pID,premium,string[128];
  92. if(!IsPlayerConnected(pID))return SendClientMessage(playerid,Rot,"Der angegebene Spieler ist nicht Onliene.");
  93. if(sscanf(params,"i",pID))return SendClientMessage(playerid,Rot,"Benutze: /givepremium [ID]");
  94. {
  95. SetPVarInt(pID,"Premium",premium);
  96. SpielerSpeichern(playerid);
  97. SpielerSpeichern(pID);
  98. }
  99. return 1;
  100. }
  101.  
  102. public OnPlayerCommandText(playerid, cmdtext[])
  103. {
  104. if (strcmp("/kill", cmdtext, true, 10) == 0)
  105. {
  106. if(Premium[playerid]>1)
  107. {
  108. SetPlayerHealth(playerid,0);
  109. SendClientMessage(playerid,Grün,"Du hast dich umgebracht!");
  110. }
  111. else
  112. {
  113. SendClientMessage(playerid,Rot,"Du hast kein Premiumaccount!");
  114. }
  115. return 1;
  116. }
  117. return 0;
  118. }
  119.  
  120. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  121. {
  122. return 1;
  123. }
  124.  
  125. public OnPlayerExitVehicle(playerid, vehicleid)
  126. {
  127. return 1;
  128. }
  129.  
  130. public OnPlayerStateChange(playerid, newstate, oldstate)
  131. {
  132. return 1;
  133. }
  134.  
  135. public OnPlayerEnterCheckpoint(playerid)
  136. {
  137. return 1;
  138. }
  139.  
  140. public OnPlayerLeaveCheckpoint(playerid)
  141. {
  142. return 1;
  143. }
  144.  
  145. public OnPlayerEnterRaceCheckpoint(playerid)
  146. {
  147. return 1;
  148. }
  149.  
  150. public OnPlayerLeaveRaceCheckpoint(playerid)
  151. {
  152. return 1;
  153. }
  154.  
  155. public OnRconCommand(cmd[])
  156. {
  157. return 1;
  158. }
  159.  
  160. public OnPlayerRequestSpawn(playerid)
  161. {
  162. return 1;
  163. }
  164.  
  165. public OnObjectMoved(objectid)
  166. {
  167. return 1;
  168. }
  169.  
  170. public OnPlayerObjectMoved(playerid, objectid)
  171. {
  172. return 1;
  173. }
  174.  
  175. public OnPlayerPickUpPickup(playerid, pickupid)
  176. {
  177. return 1;
  178. }
  179.  
  180. public OnVehicleMod(playerid, vehicleid, componentid)
  181. {
  182. return 1;
  183. }
  184.  
  185. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  186. {
  187. return 1;
  188. }
  189.  
  190. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  191. {
  192. return 1;
  193. }
  194.  
  195. public OnPlayerSelectedMenuRow(playerid, row)
  196. {
  197. return 1;
  198. }
  199.  
  200. public OnPlayerExitedMenu(playerid)
  201. {
  202. return 1;
  203. }
  204.  
  205. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  206. {
  207. return 1;
  208. }
  209.  
  210. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  211. {
  212. return 1;
  213. }
  214.  
  215. public OnRconLoginAttempt(ip[], password[], success)
  216. {
  217. return 1;
  218. }
  219.  
  220. public OnPlayerUpdate(playerid)
  221. {
  222. return 1;
  223. }
  224.  
  225. public OnPlayerStreamIn(playerid, forplayerid)
  226. {
  227. return 1;
  228. }
  229.  
  230. public OnPlayerStreamOut(playerid, forplayerid)
  231. {
  232. return 1;
  233. }
  234.  
  235. public OnVehicleStreamIn(vehicleid, forplayerid)
  236. {
  237. return 1;
  238. }
  239.  
  240. public OnVehicleStreamOut(vehicleid, forplayerid)
  241. {
  242. return 1;
  243. }
  244.  
  245. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  246. {
  247. return 1;
  248. }
  249.  
  250. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  251. {
  252. return 1;
  253. }
  254.  
  255. stock LoadAccount(playerid)
  256. {
  257. new Spielerdatei[64];
  258. new name[MAX_PLAYER_NAME];
  259. GetPlayerName(playerid,name,sizeof(name));
  260. format(Spielerdatei,sizeof(Spielerdatei),"/Account/%s.txt",name);
  261. Premium[playerid]=dini_Int(Spielerdatei,"Premium");
  262. return 1;
  263. }
  264.  
  265. stock SpielerSpeichern(playerid)
  266. {
  267. new Spielerdatei[64];
  268. new name[MAX_PLAYER_NAME];
  269. GetPlayerName(playerid,name,sizeof(name));
  270. format(Spielerdatei,sizeof(Spielerdatei),"/Account/%s.txt",name);
  271. dini_IntSet(Spielerdatei,"Premium",GetPVarInt(playerid,"Premium"));
  272. return 1;
  273. }
  274.  
  275. stock hatPlayerPremium(playerid,rang)
  276. {
  277. if(GetPVarInt(playerid,"Premium")>=rang)return 1;
  278. return 0;
  279. }
  280.  
  281. //-----------------SSCANF-------------------------
  282. stock sscanf(string[], format[], {Float,_}:...)
  283. {
  284. #if defined isnull
  285. if (isnull(string))
  286. #else
  287. if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  288. #endif
  289. {
  290. return format[0];
  291. }
  292. #pragma tabsize 4
  293. new
  294. formatPos = 0,
  295. stringPos = 0,
  296. paramPos = 2,
  297. paramCount = numargs(),
  298. delim = ' ';
  299. while (string[stringPos] && string[stringPos] <= ' ')
  300. {
  301. stringPos++;
  302. }
  303. while (paramPos < paramCount && string[stringPos])
  304. {
  305. switch (format[formatPos++])
  306. {
  307. case '\0':
  308. {
  309. return 0;
  310. }
  311. case 'i', 'd':
  312. {
  313. new
  314. neg = 1,
  315. num = 0,
  316. ch = string[stringPos];
  317. if (ch == '-')
  318. {
  319. neg = -1;
  320. ch = string[++stringPos];
  321. }
  322. do
  323. {
  324. stringPos++;
  325. if ('0' <= ch <= '9')
  326. {
  327. num = (num * 10) + (ch - '0');
  328. }
  329. else
  330. {
  331. return -1;
  332. }
  333. }
  334. while ((ch = string[stringPos]) > ' ' && ch != delim);
  335. setarg(paramPos, 0, num * neg);
  336. }
  337. case 'h', 'x':
  338. {
  339. new
  340. num = 0,
  341. ch = string[stringPos];
  342. do
  343. {
  344. stringPos++;
  345. switch (ch)
  346. {
  347. case 'x', 'X':
  348. {
  349. num = 0;
  350. continue;
  351. }
  352. case '0' .. '9':
  353. {
  354. num = (num << 4) | (ch - '0');
  355. }
  356. case 'a' .. 'f':
  357. {
  358. num = (num << 4) | (ch - ('a' - 10));
  359. }
  360. case 'A' .. 'F':
  361. {
  362. num = (num << 4) | (ch - ('A' - 10));
  363. }
  364. default:
  365. {
  366. return -1;
  367. }
  368. }
  369. }
  370. while ((ch = string[stringPos]) > ' ' && ch != delim);
  371. setarg(paramPos, 0, num);
  372. }
  373. case 'c':
  374. {
  375. setarg(paramPos, 0, string[stringPos++]);
  376. }
  377. case 'f':
  378. {
  379.  
  380. new changestr[16], changepos = 0, strpos = stringPos;
  381. while(changepos < 16 && string[strpos] && string[strpos] != delim)
  382. {
  383. changestr[changepos++] = string[strpos++];
  384. }
  385. changestr[changepos] = '\0';
  386. setarg(paramPos,0,_:floatstr(changestr));
  387. }
  388. case 'p':
  389. {
  390. delim = format[formatPos++];
  391. continue;
  392. }
  393. case '\'':
  394. {
  395. new
  396. end = formatPos - 1,
  397. ch;
  398. while ((ch = format[++end]) && ch != '\'') {}
  399. if (!ch)
  400. {
  401. return -1;
  402. }
  403. format[end] = '\0';
  404. if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  405. {
  406. if (format[end + 1])
  407. {
  408. return -1;
  409. }
  410. return 0;
  411. }
  412. format[end] = '\'';
  413. stringPos = ch + (end - formatPos);
  414. formatPos = end + 1;
  415. }
  416. case 'u':
  417. {
  418. new
  419. end = stringPos - 1,
  420. id = 0,
  421. bool:num = true,
  422. ch;
  423. while ((ch = string[++end]) && ch != delim)
  424. {
  425. if (num)
  426. {
  427. if ('0' <= ch <= '9')
  428. {
  429. id = (id * 10) + (ch - '0');
  430. }
  431. else
  432. {
  433. num = false;
  434. }
  435. }
  436. }
  437. if (num && IsPlayerConnected(id))
  438. {
  439. setarg(paramPos, 0, id);
  440. }
  441. else
  442. {
  443. #if !defined foreach
  444. #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  445. #define __SSCANF_FOREACH__
  446. #endif
  447. string[end] = '\0';
  448. num = false;
  449. new
  450. name[MAX_PLAYER_NAME];
  451. id = end - stringPos;
  452. foreach (Player, playerid)
  453. {
  454. GetPlayerName(playerid, name, sizeof (name));
  455. if (!strcmp(name, string[stringPos], true, id))
  456. {
  457. setarg(paramPos, 0, playerid);
  458. num = true;
  459. break;
  460. }
  461. }
  462. if (!num)
  463. {
  464. setarg(paramPos, 0, INVALID_PLAYER_ID);
  465. }
  466. string[end] = ch;
  467. #if defined __SSCANF_FOREACH__
  468. #undef foreach
  469. #undef __SSCANF_FOREACH__
  470. #endif
  471. }
  472. stringPos = end;
  473. }
  474. case 's', 'z':
  475. {
  476. new
  477. i = 0,
  478. ch;
  479. if (format[formatPos])
  480. {
  481. while ((ch = string[stringPos++]) && ch != delim)
  482. {
  483. setarg(paramPos, i++, ch);
  484. }
  485. if (!i)
  486. {
  487. return -1;
  488. }
  489. }
  490. else
  491. {
  492. while ((ch = string[stringPos++]))
  493. {
  494. setarg(paramPos, i++, ch);
  495. }
  496. }
  497. stringPos--;
  498. setarg(paramPos, i, '\0');
  499. }
  500. default:
  501. {
  502. continue;
  503. }
  504. }
  505. while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  506. {
  507. stringPos++;
  508. }
  509. while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  510. {
  511. stringPos++;
  512. }
  513. paramPos++;
  514. }
  515. do
  516. {
  517. if ((delim = format[formatPos++]) > ' ')
  518. {
  519. if (delim == '\'')
  520. {
  521. while ((delim = format[formatPos++]) && delim != '\'') {}
  522. }
  523. else if (delim != 'z')
  524. {
  525. return delim;
  526. }
  527. }
  528. }
  529. while (delim > ' ');
  530. return 0;
  531. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement