Advertisement
Guest User

a

a guest
Aug 6th, 2012
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.20 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <ocmd>
  4.  
  5. forward Pruefen(playerid);
  6.  
  7. #define BLAU 0x0087FFFF
  8. #define ROT 0xFF0000FF
  9. #define WEIß 0xFFFFFFFF
  10. #define GRÜN 0x00FF00FF
  11.  
  12. #define DIALOG_TUTORIAL 1
  13. #define DIALOG_REGISTER 2
  14. #define DIALOG_LOGIN 3
  15.  
  16. //Fraktionsnamen
  17. #define fraktname1 "POLICE"
  18. #define fraktname2 "MAFIA"
  19. #define fraktname3 "NORMAL"
  20.  
  21. //Mafia
  22. #define mafiaspawn 2491.1350,2769.8381,10.6701
  23.  
  24. //Police
  25. #define policespawn 2337.7813,2442.9785,6.2993
  26.  
  27. //Normal
  28. #define normalspawn 1520.0,1568.0,1510.0
  29.  
  30. forward testtimer();
  31.  
  32. new policedachenter;
  33. new policedachexit;
  34. new waffenladenenter;
  35. new waffenladenexit;
  36. new bsnenter;
  37. new bsnexit;
  38. new tor[2];
  39. new botauto;
  40. new policecar[31];
  41. new mafiacar[29];//mafiacar[0], mafiacar[1]
  42. new ak_buypoint;
  43. new m4_buypoint;
  44. new rpg_buypoint;
  45. new mp5_buypoint;
  46.  
  47. main()
  48. {
  49. print("\n----------------------------------");
  50. print("AfteeeyyyServer");
  51. print("----------------------------------\n");
  52. }
  53.  
  54.  
  55. public OnGameModeInit()
  56. {
  57. policedachenter=CreatePickup(1559,1,2315.1289,2475.0708,-7.4531);
  58. policedachexit=CreatePickup(1559,1,2296.3000488281,2461.6000976563,38.700000762939);
  59.  
  60. waffenladenenter=CreatePickup(1559,1,2539.5393,2084.0183,10.8203);
  61. waffenladenexit=CreatePickup(1559,1,285.7899,-86.7247,1001.5229);
  62.  
  63. DisableInteriorEnterExits();
  64. ConnectNPC("TutorialBot","tutorialbot");
  65. ConnectNPC("TutorialBot2","tutorialbot2");
  66.  
  67. UsePlayerPedAnims();
  68. bsnexit=CreatePickup(1559,1,362.8524,-75.1179,1001.5078);
  69. bsnenter=CreatePickup(1559,1,1199.2235,-918.1543,43.1233);
  70.  
  71. Create3DTextLabel("BSN\n Eingang",BLAU,1199.2235,-918.1543,43.1233,10,0);
  72.  
  73. DisableInteriorEnterExits();
  74. SetGameModeText("TutorialMode");
  75. AddPlayerClass(0,2047.4270,1336.5569,10.6719,188.9284,25,100,0,0,0,0); // position;
  76.  
  77.  
  78. CreateObject(3629,2498.69995117,2774.00000000,2.59999990,0.00000000,0.00000000,180.00000000); //object(arhang_las) (1)
  79. CreateObject(6976,2576.69995117,2733.50000000,15.10000038,0.00000000,0.00000000,0.00000000); //object(shamheliprt04) (1)
  80. CreateObject(6976,2559.69995117,2733.50000000,5.19999981,0.00000000,0.00000000,0.00000000); //object(shamheliprt04) (2)
  81. CreateObject(6976,2583.39990234,2787.19995117,17.89999962,0.00000000,0.00000000,90.00000000); //object(shamheliprt04) (3)
  82. CreateObject(6976,2583.50000000,2773.69995117,10.60000038,0.00000000,0.00000000,90.00000000); //object(shamheliprt04) (4)
  83. CreateObject(7096,2281.39990234,2461.30004883,44.20000076,0.00000000,0.00000000,270.00000000); //object(vrockstairs) (1)
  84. CreateObject(7096,2274.50000000,2464.69995117,37.20000076,0.00000000,0.00000000,87.99499512); //object(vrockstairs) (2)
  85. CreateObject(1383,2580.89990234,2825.39990234,-8.59999990,0.00000000,0.00000000,0.00000000); //object(twrcrane_m_04) (1)
  86. CreateObject(1383,2309.19995117,2454.39990234,-32.89999962,0.00000000,0.00000000,0.00000000); //object(twrcrane_m_04) (2)
  87. botauto=CreateVehicle(401,1227.1797,-914.0590,42.6812,99.6721,126,126,1);
  88. SetVehicleNumberPlate(botauto,"Auto 1");
  89. AddStaticVehicle(409,1226.2432,-905.7473,42.6997,10.2423,151,151); // auto2
  90.  
  91. //fraktautos
  92.  
  93. mafiacar[28]=AddStaticVehicleEx(425,2610.80004883,2722.60009766,37.40000153,0.00000000,-1,-1,15); //Hunter
  94. mafiacar[27]=AddStaticVehicleEx(425,2622.50000000,2722.60009766,37.40000153,0.00000000,-1,-1,15); //Hunter
  95. mafiacar[26]=AddStaticVehicleEx(520,2609.69995117,2812.50000000,28.70000076,90.00000000,-1,-1,15); //Hydra
  96. mafiacar[25]=AddStaticVehicleEx(520,2609.69995117,2841.00000000,28.70000076,90.00000000,-1,-1,15); //Hydra
  97. mafiacar[24]=AddStaticVehicleEx(513,2610.60009766,2821.89990234,28.60000038,90.00000000,-1,-1,15); //Stunt
  98. mafiacar[23]=AddStaticVehicleEx(513,2610.60009766,2831.39990234,28.60000038,90.00000000,-1,-1,15); //Stunt
  99. mafiacar[22]=AddStaticVehicleEx(520,2595.00000000,2840.89990234,28.70000076,90.00000000,-1,-1,15); //Hydra
  100. mafiacar[21]=AddStaticVehicleEx(520,2546.89990234,2809.00000000,28.70000076,270.00000000,-1,-1,15); //Hydra
  101. mafiacar[20]=AddStaticVehicleEx(520,2547.00000000,2840.89990234,28.70000076,270.00000000,-1,-1,15); //Hydra
  102. mafiacar[19]=AddStaticVehicleEx(520,2593.89990234,2812.39990234,28.70000076,90.00000000,-1,-1,15); //Hydra
  103. mafiacar[18]=AddStaticVehicleEx(451,2533.00000000,2759.19995117,10.60000038,180.00000000,-1,-1,15); //Turismo
  104. mafiacar[17]=AddStaticVehicleEx(451,2537.30004883,2759.19995117,10.60000038,180.00000000,-1,-1,15); //Turismo
  105. mafiacar[16]=AddStaticVehicleEx(451,2528.80004883,2759.19995117,10.60000038,180.00000000,-1,-1,15); //Turismo
  106. mafiacar[15]=AddStaticVehicleEx(451,2524.30004883,2759.19995117,10.60000038,180.00000000,-1,-1,15); //Turismo
  107. mafiacar[14]=AddStaticVehicleEx(451,2541.30004883,2759.19995117,10.60000038,180.00000000,-1,-1,15); //Turismo
  108. mafiacar[13]=AddStaticVehicleEx(541,2524.60009766,2769.89990234,10.50000000,0.00000000,-1,-1,15); //Bullet
  109. mafiacar[12]=AddStaticVehicleEx(541,2528.80004883,2769.80004883,10.50000000,0.00000000,-1,-1,15); //Bullet
  110. mafiacar[11]=AddStaticVehicleEx(541,2533.30004883,2769.69995117,10.50000000,0.00000000,-1,-1,15); //Bullet
  111. mafiacar[10]=AddStaticVehicleEx(541,2537.30004883,2769.60009766,10.50000000,0.00000000,-1,-1,15); //Bullet
  112. mafiacar[9]=AddStaticVehicleEx(541,2541.30004883,2769.50000000,10.50000000,0.00000000,-1,-1,15); //Bullet
  113. mafiacar[8]=AddStaticVehicleEx(461,2541.30004883,2789.39990234,10.50000000,180.00000000,-1,-1,15); //PCJ-600
  114. mafiacar[7]=AddStaticVehicleEx(461,2545.00000000,2789.19995117,10.50000000,180.00000000,-1,-1,15); //PCJ-600
  115. mafiacar[6]=AddStaticVehicleEx(461,2549.69995117,2789.00000000,10.50000000,180.00000000,-1,-1,15); //PCJ-600
  116. mafiacar[5]=AddStaticVehicleEx(461,2553.30004883,2789.10009766,10.50000000,180.00000000,-1,-1,15); //PCJ-600
  117. mafiacar[4]=AddStaticVehicleEx(409,2529.89990234,2747.50000000,10.69999981,90.00000000,-1,-1,15); //Stretch
  118. mafiacar[3]=AddStaticVehicleEx(409,2540.69995117,2747.39990234,10.69999981,90.00000000,-1,-1,15); //Stretch
  119. mafiacar[2]=AddStaticVehicleEx(405,2489.80004883,-1677.09997559,13.30000019,0.00000000,-1,-1,15); //Sentinel
  120. mafiacar[1]=AddStaticVehicle(411,1245.5562,-921.0884,42.5210,100.3385,64,1); // fraktauto 1
  121. mafiacar[0]=AddStaticVehicle(560,1237.1934,-922.9166,42.4760,101.1390,9,39); // fraktauto 3
  122.  
  123. policecar[30]=AddStaticVehicleEx(520,2267.80004883,2439.00000000,47.90000153,270.00000000,-1,-1,15); //Hydra
  124. policecar[29]=AddStaticVehicleEx(520,2267.69995117,2450.80004883,47.90000153,270.00000000,-1,-1,15); //Hydra
  125. policecar[28]=AddStaticVehicleEx(513,2339.69995117,2479.60009766,39.50000000,90.00000000,-1,-1,15); //Stunt
  126. policecar[27]=AddStaticVehicleEx(513,2348.80004883,2480.00000000,39.50000000,90.00000000,-1,-1,15); //Stunt
  127. policecar[26]=AddStaticVehicleEx(513,2329.50000000,2479.30004883,39.50000000,90.00000000,-1,-1,15); //Stunt
  128. policecar[25]=AddStaticVehicleEx(425,2293.60009766,2450.00000000,47.79999924,0.00000000,-1,-1,15); //Hunter
  129. policecar[24]=AddStaticVehicleEx(425,2281.30004883,2449.89990234,47.79999924,0.00000000,-1,-1,15); //Hunter
  130. policecar[23]=AddStaticVehicleEx(598,2299.60009766,2459.89990234,3.09999990,270.00000000,-1,-1,15); //Police Car (LVPD)
  131. policecar[22]=AddStaticVehicleEx(598,2299.69995117,2464.60009766,3.09999990,270.00000000,-1,-1,15); //Police Car (LVPD)
  132. policecar[20]=AddStaticVehicleEx(598,2299.50000000,2451.80004883,3.09999990,270.00000000,-1,-1,15); //Police Car (LVPD)
  133. policecar[19]=AddStaticVehicleEx(598,2299.69995117,2456.00000000,3.09999990,270.00000000,-1,-1,15); //Police Car (LVPD)
  134. policecar[18]=AddStaticVehicleEx(596,2312.19995117,2432.39990234,3.09999990,0.00000000,-1,-1,15); //Police Car (LSPD)
  135. policecar[17]=AddStaticVehicleEx(596,2308.19995117,2432.50000000,3.09999990,0.00000000,-1,-1,15); //Police Car (LSPD)
  136. policecar[16]=AddStaticVehicleEx(596,2303.19995117,2432.69995117,3.09999990,0.00000000,-1,-1,15); //Police Car (LSPD)
  137. policecar[15]=AddStaticVehicleEx(596,2299.00000000,2432.80004883,3.09999990,0.00000000,-1,-1,15); //Police Car (LSPD)
  138. policecar[14]=AddStaticVehicleEx(596,2295.00000000,2432.89990234,3.09999990,0.00000000,-1,-1,15); //Police Car (LSPD)
  139. policecar[13]=AddStaticVehicleEx(596,2316.10009766,2432.19995117,3.09999990,0.00000000,-1,-1,15); //Police Car (LSPD)
  140. policecar[12]=AddStaticVehicleEx(597,2251.00000000,2432.50000000,3.09999990,0.00000000,-1,-1,15); //Police Car (SFPD)
  141. policecar[11]=AddStaticVehicleEx(597,2246.80004883,2432.30004883,3.09999990,0.00000000,-1,-1,15); //Police Car (SFPD)
  142. policecar[10]=AddStaticVehicleEx(597,2241.19995117,2437.50000000,3.09999990,270.00000000,-1,-1,15); //Police Car (SFPD)
  143. policecar[9]=AddStaticVehicleEx(597,2241.30004883,2442.30004883,3.09999990,270.00000000,-1,-1,15); //Police Car (SFPD)
  144. policecar[8]=AddStaticVehicleEx(597,2241.39990234,2447.00000000,3.09999990,270.00000000,-1,-1,15); //Police Car (SFPD)
  145. policecar[7]=AddStaticVehicleEx(597,2241.50000000,2452.00000000,3.09999990,270.00000000,-1,-1,15); //Police Car (SFPD)
  146. policecar[6]=AddStaticVehicleEx(597,2241.60009766,2456.00000000,3.09999990,270.00000000,-1,-1,15); //Police Car (SFPD)
  147. policecar[5]=AddStaticVehicleEx(601,2312.60009766,2500.19995117,-7.50000000,90.00000000,-1,-1,15); //S.W.A.T. Van
  148. policecar[4]=AddStaticVehicleEx(601,2312.69995117,2495.69995117,-7.50000000,90.00000000,-1,-1,15); //S.W.A.T. Van
  149. policecar[3]=AddStaticVehicleEx(601,2312.80004883,2489.89990234,-7.50000000,90.00000000,-1,-1,15); //S.W.A.T. Van
  150. policecar[2]=AddStaticVehicleEx(601,2312.89990234,2485.39990234,-7.50000000,90.00000000,-1,-1,15); //S.W.A.T. Van
  151. policecar[1]=AddStaticVehicleEx(420,2456.69995117,2745.80004883,10.69999981,0.00000000,-1,-1,15); //Taxi
  152. //zäune
  153. CreateObject(987, 1184.3666992188, -949.98992919922, 41.657981872559, 0, 0, 10);
  154. CreateObject(987, 1195.0812988281, -937.03753662109, 41.745170593262, 0, 0, 187.99755859375);
  155. tor[0]=CreateObject(3629, 2498.6999511719, 2774, 2.5999999046326, 0, 0, 180);
  156. tor[1]=CreateObject(971,2335.10009766,2443.50000000,7.09999990,0.00000000,0.00000000,58.00000000); //object(subwaygate) (1)
  157. SetTimer("testtimer",1000*60*10,true);
  158.  
  159. //wafenkauf
  160.  
  161. //AK-47
  162. ak_buypoint=CreatePickup(1559,1,287.9801,-76.5869,1001.5156);
  163. Create3DTextLabel("AK-47 Kauf.\nPreis:{FFFFFF} 8999$",ROT,287.9801,-76.5869,1001.5156,359.6821,0);
  164. //M4
  165. m4_buypoint=CreatePickup(1559,1,288.0056,-74.8985,1001.5156);
  166. Create3DTextLabel("M4 Kauf.\nPreis:{FFFFFF} 8999$",ROT,288.0056,-74.8985,1001.5156,176.6937,0);
  167. //RPG
  168. rpg_buypoint=CreatePickup(1559,1,288.1072,-72.7516,1001.5156);
  169. Create3DTextLabel("RPG Kauf.\nPreis:{FFFFFF} 11999$",ROT,288.1072,-72.7516,1001.5156,2.5021,0);
  170.  
  171. //MP5
  172. mp5_buypoint=CreatePickup(1559,1,288.1670,-71.0682,1001.5156);
  173. Create3DTextLabel("MP5 Kauf.\nPreis:{FFFFFF} 6999$",ROT,288.1670,-71.0682,1001.5156,177.9471,0);
  174.  
  175.  
  176.  
  177. return 1;
  178. }
  179.  
  180. public testtimer()
  181. {
  182. SetTimer("Pruefen",1000,0);
  183. return 1;
  184. }
  185.  
  186. public Pruefen(playerid)
  187. {
  188. if(IsPlayerInRangeOfPoint(playerid, 30.0, -2029.3141,-101.2577,35.1641))
  189. {
  190. new string[80];
  191. new name[MAX_PLAYER_NAME];
  192. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  193. format(string,sizeof(string),"Spieler %s war in der nähe der Mafia Base",name(playerid));
  194. SendClientMessageToAll(ROT,string);
  195. }
  196. return 1;
  197. }
  198. public OnGameModeExit()
  199. {
  200. return 1;
  201. }
  202.  
  203.  
  204. public OnPlayerRequestClass(playerid, classid)
  205. {
  206. if(IsPlayerNPC(playerid))return 1;
  207. SetPlayerPos(playerid,2047.4270,1336.5569,10.6719);
  208. SetPlayerFacingAngle(playerid,188.9284);
  209. SetPlayerCameraPos(playerid,2047.6205,1333.3314,10.6719);
  210. SetPlayerCameraLookAt(playerid,2047.4270,1336.5569,10.6719);
  211. return 1;
  212. }
  213.  
  214. public OnPlayerConnect(playerid)
  215. {
  216. if(IsPlayerNPC(playerid))return 1;
  217. new Spielerdatei[64];
  218. new name[MAX_PLAYER_NAME];
  219. GetPlayerName(playerid,name,sizeof(name));
  220. format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
  221. if(dini_Exists(Spielerdatei))
  222. {
  223. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Dein Account wurde gefunden. Gib bitte das Passwort ein.","Login","Abbrechen");
  224. }
  225. else
  226. {
  227. ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registrieren","Gib bitte das gewünschte Passwort ein:","Register","Abbrechen");
  228. }
  229. return 1;
  230. }
  231.  
  232. public OnPlayerDisconnect(playerid, reason)
  233. {
  234. if(GetPVarInt(playerid,"loggedin")==1)
  235. {
  236. SpielerSpeichern(playerid);
  237. }
  238. return 1;
  239. }
  240.  
  241. public OnPlayerSpawn(playerid)
  242. {
  243. if(!strcmp(SpielerName(playerid),"TutorialBot",true))
  244. {
  245. PutPlayerInVehicle(playerid,botauto,0);
  246. }
  247. if(IsPlayerNPC(playerid))return 1;
  248. switch(GetPVarInt(playerid,"Fraktion"))
  249. {
  250. case 0:{}
  251. case 1:{SetPlayerPos(playerid,policespawn);GivePlayerMoney(playerid,4000);GivePlayerWeapon(playerid,24,100);SetPlayerColor(playerid,BLAU);SetPlayerSkin(playerid,266);SetPlayerArmour(playerid,100.0);}
  252. case 2:{SetPlayerPos(playerid,mafiaspawn);GivePlayerMoney(playerid,4000);GivePlayerWeapon(playerid,24,100);SetPlayerSkin(playerid,107);SetPlayerArmour(playerid,100.0);}
  253. case 3:{SetPlayerPos(playerid,normalspawn);GivePlayerMoney(playerid,4000);GivePlayerWeapon(playerid,24,100);SetPlayerColor(playerid,ROT);SetPlayerSkin(playerid,1);SetPlayerArmour(playerid,100.0);}
  254. }
  255. return 1;
  256. }
  257.  
  258. public OnPlayerDeath(playerid, killerid, reason)
  259. {
  260. if(killerid !=255) // wenn man nicht selber der täter ist
  261. {
  262. GivePlayerMoney(killerid, 5000);
  263. }
  264. return 1;
  265. }
  266.  
  267. public OnVehicleSpawn(vehicleid)
  268. {
  269. return 1;
  270. }
  271.  
  272. public OnVehicleDeath(vehicleid, killerid)
  273. {
  274. return 1;
  275. }
  276.  
  277. public OnPlayerText(playerid, text[])
  278. {
  279. return 1;
  280. }
  281.  
  282. ocmd:f(playerid,params[])
  283. {
  284. new text[128];
  285. if(sscanf(params,"s",text))return SendClientMessage(playerid,ROT,"/f [text]");
  286. format(text,sizeof(text),"Member %s: %s",SpielerName(playerid),text);
  287. for(new i=0; i<GetMaxPlayers(); i++)
  288. {
  289. if(IsPlayerConnected(i))
  290. {
  291. if(isPlayerInFrakt(i,GetPVarInt(playerid,"Fraktion")))
  292. {
  293. SendClientMessage(i,BLAU,text);
  294. }
  295. }
  296. }
  297. return 1;
  298. }
  299.  
  300. ocmd:tban(playerid,params[])
  301. {
  302. if(!isPlayerAnAdmin(playerid,3))return SendClientMessage(playerid,ROT,"Rang zu Niedrig.");
  303. new pID, time, grund[128];
  304. if(sscanf(params,"uis",pID,time,grund))return SendClientMessage(playerid,BLAU,"/tban [playerid] [zeit] [grund]");
  305. if(IsPlayerConnected(pID))
  306. {
  307. if(time>0&&time<1000)
  308. {
  309. new string[128];
  310. format(string,sizeof(string),"AdmCdm: %s wurde von %s für %i Minuten gebannt. Grund: %s",SpielerName(pID),SpielerName(playerid),time,grund);
  311. SendClientMessageToAll(ROT,string);
  312. new wert;
  313.  
  314. wert=gettime()+(60*time);
  315.  
  316. SetPVarInt(pID,"timeban",wert);
  317.  
  318. Kick(pID);
  319. return 1;
  320. }
  321. SendClientMessage(playerid,ROT,"Ungültige Zeit.");
  322. return 1;
  323. }
  324. SendClientMessage(playerid,ROT,"Spieler ist nicht online.");
  325. return 1;
  326. }
  327.  
  328. ocmd:makeleader(playerid,params[])
  329. {
  330. if(!isPlayerAnAdmin(playerid,3))return SendClientMessage(playerid,ROT,"Rang zu Niedrig.");
  331. new pID,fID;
  332. if(sscanf(params,"ui",pID,fID))return SendClientMessage(playerid,BLAU,"/makeleader [playerid] [fraktionsid]");
  333. SetPVarInt(pID,"Fraktion",fID);
  334. SendClientMessage(playerid,BLAU,"Erfolgreich.");
  335. return 1;
  336. }
  337. ocmd:stealmoneyfrompolice(playerid,params[])
  338. {
  339. if(!IsPlayerInRangeOfPoint(playerid,100,2309.19995117,2454.39990234,-8.89999962)) return SendClientMessage(playerid,ROT,"Du bist nicht in der nähe von der Polizei Station´s Säule.");
  340. {
  341. if(isPlayerInFrakt(playerid,2))
  342. {
  343. GivePlayerMoney(playerid,350);
  344. return 1;
  345. }
  346. return 1;
  347. }
  348. }
  349. ocmd:stealmoneyfrommafia(playerid,params[])
  350. {
  351. if(!IsPlayerInRangeOfPoint(playerid,100,2580.89990234,2825.39990234,0.59999990)) return SendClientMessage(playerid,ROT,"Du bist nicht in der nähe von der Säule.");
  352. {
  353. if(isPlayerInFrakt(playerid,1))
  354. {
  355. GivePlayerMoney(playerid,350);
  356. return 1;
  357. }
  358. return 1;
  359. }
  360. }
  361. ocmd:aufmafia(playerid,params[])
  362. {
  363. if(!IsPlayerInRangeOfPoint(playerid,50,2498.6999511719, 2774, 2.5999999046326)) return SendClientMessage(playerid,ROT,"Du bist nicht in der nähe vom Tor.");
  364. {
  365. if(isPlayerInFrakt(playerid,2))
  366. {
  367. MoveObject(tor[0],2498.6999511719, 2774, 15.89999961853,5);
  368. return 1;
  369. }
  370. return SendClientMessage(playerid,ROT,"Du bist nicht in der Mafia.");
  371. }
  372. }
  373. ocmd:aufpolice(playerid,params[])
  374. {
  375. if(!IsPlayerInRangeOfPoint(playerid,50,2337.7813,2442.9785,6.2993)) return SendClientMessage(playerid,ROT,"Du bist nicht in der nähe vom Tor.");
  376. {
  377. if(isPlayerInFrakt(playerid,1))
  378. {
  379. MoveObject(tor[1],2335.10009766,2443.50000000,7.09999990-10,5);
  380. return 1;
  381. }
  382. return SendClientMessage(playerid,ROT,"Du bist nicht bei der Polizei.");
  383. }
  384.  
  385.  
  386. }
  387. ocmd:zupolice(playerid,params[])
  388. {
  389. if(!IsPlayerInRangeOfPoint(playerid,50,2337.7813,2442.9785,6.2993)) return SendClientMessage(playerid,ROT,"Du bist nicht in der nähe vom Tor.");
  390. {
  391. if(isPlayerInFrakt(playerid,1))
  392. {
  393. MoveObject(tor[1],2335.10009766,2443.50000000,7.09999990,5);
  394. return 1;
  395. }
  396. return SendClientMessage(playerid,ROT,"Du bist nicht bei der Polizei.");
  397. }
  398.  
  399. }
  400. ocmd:zumafia(playerid,params[])
  401. {
  402. if(!IsPlayerInRangeOfPoint(playerid,50,2498.6999511719, 2774, 2.5999999046326)) return SendClientMessage(playerid,ROT,"Du bist nicht in der nähe vom Tor.");
  403. {
  404. if(isPlayerInFrakt(playerid,2))
  405. {
  406. MoveObject(tor[0],2498.6999511719, 2774, 2.5999999046326,5);
  407. return 1;
  408. }
  409. return SendClientMessage(playerid,ROT,"Du bist nicht in der Mafia.");
  410. }
  411. }
  412. ocmd:setadmin(playerid,params[])
  413. {
  414. if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"Du bist kein Admin.");
  415. new pID, rank;
  416. if(sscanf(params,"ui",pID,rank))return SendClientMessage(playerid,ROT,"/setadmin [spieler] [level]");
  417. if(rank<1||rank>5)return SendClientMessage(playerid,ROT,"Bitte gültigen Rang angeben.");
  418. SetPVarInt(pID,"Adminlevel",rank);
  419. SpielerSpeichern(pID);
  420. SendClientMessageToAll(BLAU,"Es wurde jemand zu Admin gemacht.");
  421. return 1;
  422. }
  423. ocmd:ban(playerid,params[])
  424. {
  425. if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"Du bist kein Admin.");
  426. new pID, reason[128],string[128];
  427. if(sscanf(params,"us",pID,reason))return SendClientMessage(playerid,BLAU,"/ban [id] [grund]");
  428. format(string,sizeof(string),"AdmCmd: %s wurde von %s gebannt. Grund: %s",SpielerName(pID),SpielerName(playerid),reason);
  429. SendClientMessageToAll(ROT,string);
  430. SetPVarInt(pID,"Baned",1);
  431. Kick(pID);
  432. return 1;
  433. }
  434. ocmd:kick(playerid,params[])
  435. {
  436. if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"Du bist kein Admin.");
  437. new pID, reason[128],string[128];
  438. if(sscanf(params,"us",pID,reason))return SendClientMessage(playerid,BLAU,"/kick [id] [grund]");
  439. format(string,sizeof(string),"AdmCmd: %s wurde von %s gekickt. Grund: %s",SpielerName(pID),SpielerName(playerid),reason);
  440. SendClientMessageToAll(ROT,string);
  441. Kick(pID);
  442. return 1;
  443. }
  444.  
  445. public OnPlayerCommandText(playerid, cmdtext[])
  446. {
  447.  
  448. if(strcmp(cmdtext,"/mafia",true)==0)
  449. {
  450. SetPlayerPos(playerid,2491.1350,2769.8381,10.6701);
  451. }
  452. if(strcmp(cmdtext,"/police",true)==0)
  453. {
  454. SetPlayerPos(playerid,2337.7813,2442.9785,6.2993);
  455. }
  456. if(strcmp(cmdtext,"/waffenladen",true)==0)
  457. {
  458. SetPlayerPos(playerid,2535.6316,2083.7988,10.8203);
  459. }
  460. if(strcmp(cmdtext,"/bsn",true)==0)
  461. {
  462. if(isPlayerAnAdmin(playerid,3))
  463. {
  464. ShowPlayerDialog(playerid,DIALOG_TUTORIAL,DIALOG_STYLE_MSGBOX,"BSN","Möchten sie wirklich zum BSN?","JA","NEIN");
  465. return 1;
  466. }
  467. SendClientMessage(playerid,BLAU,"Du bist kein Admin.");
  468. return 1;
  469. }
  470. if(strcmp(cmdtext,"/kill",true)==0)
  471. {
  472. SetPlayerHealth(playerid,0);
  473. return 1;
  474. }
  475. if(strcmp(cmdtext,"/restart",true)==0)
  476. {
  477. if(isPlayerAnAdmin(playerid,5))
  478. {
  479. SendRconCommand("gmx");
  480. return 1;
  481. }
  482. SendClientMessage(playerid,BLAU,"Du bist kein Admin.");
  483. return 1;
  484. }
  485. if(strcmp(cmdtext,"/stats",true)==0)
  486. {
  487. new string[128];
  488. new fraktname[64];
  489. switch(GetPVarInt(playerid,"Fraktion"))
  490. {
  491. case 0:{fraktname="Keine";}
  492. case 1:{fraktname=fraktname1;}
  493. case 2:{fraktname=fraktname2;}
  494. case 3:{fraktname=fraktname3;}
  495. }
  496. //1 reihe
  497. format(string,sizeof(string),"[Name: %s] [Level: %i] [Adminlevel: %i] [Fraktion: %s]",SpielerName(playerid),GetPlayerScore(playerid),GetPVarInt(playerid,"Adminlevel"),fraktname);
  498. SendClientMessage(playerid,BLAU,string);
  499. //2 reihe
  500. return 1;
  501. }
  502. if(strcmp(cmdtext,"/nschild",true)==0)
  503. {
  504. if(IsPlayerInAnyVehicle(playerid))
  505. {
  506. new vehicleid;
  507. vehicleid=GetPlayerVehicleID(playerid);
  508. SetVehicleNumberPlate(vehicleid,"Test");
  509. SetVehicleToRespawn(vehicleid);
  510. PutPlayerInVehicle(playerid,vehicleid,0);
  511. }
  512. return 1;
  513. }
  514. return 0;
  515. }
  516.  
  517. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  518. {
  519. return 1;
  520. }
  521.  
  522. public OnPlayerExitVehicle(playerid, vehicleid)
  523. {
  524. return 1;
  525. }
  526.  
  527. public OnPlayerStateChange(playerid, newstate, oldstate)
  528. {
  529. if(newstate==PLAYER_STATE_DRIVER)
  530. {
  531. for(new i=0; i<sizeof(policecar); i++)
  532. {
  533. if(GetPlayerVehicleID(playerid)==policecar[i])
  534. {
  535. if(GetPVarInt(playerid,"Fraktion")!=1)
  536. {
  537. RemovePlayerFromVehicle(playerid);
  538. SendClientMessage(playerid,ROT,"Du darfst dieses Fahrzeug nicht fahren.");
  539. }
  540. }
  541. }
  542. }
  543. if(newstate==PLAYER_STATE_DRIVER)
  544. {
  545. for(new i=0; i<sizeof(mafiacar); i++)
  546. {
  547. if(GetPlayerVehicleID(playerid)==mafiacar[i])
  548. {
  549. if(GetPVarInt(playerid,"Fraktion")!=2)
  550. {
  551. RemovePlayerFromVehicle(playerid);
  552. SendClientMessage(playerid,ROT,"Du darfst dieses Fahrzeug nicht fahren.");
  553. }
  554. }
  555. }
  556. }
  557. return 1;
  558. }
  559.  
  560. public OnPlayerEnterCheckpoint(playerid)
  561. {
  562. if(!IsPlayerInRangeOfPoint(playerid,100,2580.89990234,2825.39990234,0.59998990))
  563. {
  564. SendClientMessageToAll(ROT,"Jemand stiehlt Geld von der Mafia!!!");
  565. }
  566.  
  567. return 1;
  568. }
  569.  
  570. public OnPlayerLeaveCheckpoint(playerid)
  571. {
  572. return 1;
  573. }
  574.  
  575. public OnPlayerEnterRaceCheckpoint(playerid)
  576. {
  577. return 1;
  578. }
  579.  
  580. public OnPlayerLeaveRaceCheckpoint(playerid)
  581. {
  582. return 1;
  583. }
  584.  
  585. public OnRconCommand(cmd[])
  586. {
  587. return 1;
  588. }
  589.  
  590. public OnPlayerRequestSpawn(playerid)
  591. {
  592. return 1;
  593. }
  594.  
  595. public OnObjectMoved(objectid)
  596. {
  597. return 1;
  598. }
  599.  
  600. public OnPlayerObjectMoved(playerid, objectid)
  601. {
  602. return 1;
  603. }
  604.  
  605. public OnPlayerPickUpPickup(playerid, pickupid)
  606. {
  607. if(pickupid==policedachenter)
  608. {
  609. SetPlayerPos(playerid,2296.3000488281,2466.3999023438,38.700000762939);
  610. SetPlayerInterior(playerid,0);
  611. }
  612. if(pickupid==policedachexit)
  613. {
  614. SetPlayerPos(playerid,2310.3596,2474.6931,-7.4531);
  615. SetPlayerInterior(playerid,0);
  616. }
  617. if(pickupid==waffenladenenter)
  618. {
  619. SetPlayerPos(playerid,286.800994,-82.547599,1001.515625);
  620. SetPlayerInterior(playerid,4);
  621. }
  622. if(pickupid==waffenladenexit)
  623. {
  624. SetPlayerPos(playerid,2535.6316,2083.7988,10.8203);
  625. SetPlayerFacingAngle(playerid,91.4661);
  626. SetCameraBehindPlayer(playerid);
  627. SetPlayerInterior(playerid,0);
  628. }
  629.  
  630. if(pickupid==bsnenter)
  631. {
  632. SetPlayerPos(playerid,375.962463,-65.816848,1001.507812);
  633. SetPlayerInterior(playerid,10);
  634. GameTextForPlayer(playerid,"~w~Du ~r~hast ~b~den ~n~~g~BSN betreten.",3000,3);
  635. }
  636.  
  637. if(pickupid==bsnexit)
  638. {
  639. SetPlayerPos(playerid,1199.4618,-920.8215,43.1059);
  640. SetPlayerFacingAngle(playerid,185.7090);
  641. SetCameraBehindPlayer(playerid);
  642. SetPlayerInterior(playerid,0);
  643. }
  644. if(pickupid==rpg_buypoint)
  645. {
  646. if(GetPlayerMoney(playerid)>11999)
  647. {
  648. GivePlayerMoney(playerid,-11999);
  649. SendClientMessage(playerid,GRÜN,"Danke für ihren Einkauf! (gekauft: RPG)");
  650. GivePlayerWeapon(playerid,35,25);
  651. }
  652. else
  653. {
  654. SendClientMessage(playerid,ROT,"Du hast nicht genug Geld!");
  655. }
  656. }
  657. if(pickupid==mp5_buypoint)
  658. {
  659. if(GetPlayerMoney(playerid)>6999)
  660. {
  661. GivePlayerMoney(playerid,-6999);
  662. SendClientMessage(playerid,GRÜN,"Danke für ihren Einkauf! (gekauft: MP5)");
  663. GivePlayerWeapon(playerid,29,150);
  664. }
  665. else
  666. {
  667. SendClientMessage(playerid,ROT,"Du hast nicht genug Geld!");
  668. }
  669. }
  670. if(pickupid==m4_buypoint)
  671. {
  672. if(GetPlayerMoney(playerid)>8999)
  673. {
  674. GivePlayerMoney(playerid,-8999);
  675. SendClientMessage(playerid,GRÜN,"Danke für ihren Einkauf! (gekauft: AK M4)");
  676. GivePlayerWeapon(playerid,31,150);
  677. }
  678. else
  679. {
  680. SendClientMessage(playerid,ROT,"Du hast nicht genug Geld!");
  681. }
  682. }
  683. if(pickupid==ak_buypoint)
  684. {
  685. if(GetPlayerMoney(playerid)>8999)
  686. {
  687. GivePlayerMoney(playerid,-9000);
  688. SendClientMessage(playerid,GRÜN,"Danke für ihren Einkauf! (gekauft: AK 47)");
  689. GivePlayerWeapon(playerid,30,150);
  690. }
  691. else
  692. {
  693. SendClientMessage(playerid,ROT,"Du hast nicht genug Geld!");
  694. }
  695. }
  696.  
  697. return 1;
  698. }
  699.  
  700. public OnVehicleMod(playerid, vehicleid, componentid)
  701. {
  702. return 1;
  703. }
  704.  
  705. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  706. {
  707. return 1;
  708. }
  709.  
  710. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  711. {
  712. return 1;
  713. }
  714.  
  715. public OnPlayerSelectedMenuRow(playerid, row)
  716. {
  717. return 1;
  718. }
  719.  
  720. public OnPlayerExitedMenu(playerid)
  721. {
  722. return 1;
  723. }
  724.  
  725. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  726. {
  727. return 1;
  728. }
  729.  
  730. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  731. {
  732. return 1;
  733. }
  734.  
  735. public OnRconLoginAttempt(ip[], password[], success)
  736. {
  737. return 1;
  738. }
  739.  
  740. public OnPlayerUpdate(playerid)
  741. {
  742. return 1;
  743. }
  744.  
  745. public OnPlayerStreamIn(playerid, forplayerid)
  746. {
  747. return 1;
  748. }
  749.  
  750. public OnPlayerStreamOut(playerid, forplayerid)
  751. {
  752. return 1;
  753. }
  754.  
  755. public OnVehicleStreamIn(vehicleid, forplayerid)
  756. {
  757. return 1;
  758. }
  759.  
  760. public OnVehicleStreamOut(vehicleid, forplayerid)
  761. {
  762. return 1;
  763. }
  764.  
  765. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  766. {
  767. if(dialogid==DIALOG_LOGIN)
  768. {
  769. if(response==0)
  770. {
  771. SendClientMessage(playerid,BLAU,"Du hast den Vorgang abgebrochen.");
  772. Kick(playerid);
  773. return 1;
  774. }
  775. if(response==1)
  776. {
  777. if(!strlen(inputtext))
  778. {
  779. SendClientMessage(playerid,BLAU,"Das Passwort war nicht lang genug.");
  780. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Dein Account wurde gefunden. Gib bitte das Passwort ein.","Login","Abbrechen");
  781. return 1;
  782. }
  783. else
  784. {
  785. Login(playerid,inputtext);
  786. return 1;
  787. }
  788. }
  789. }
  790. if(dialogid==DIALOG_REGISTER)
  791. {
  792. if(response==0)
  793. {
  794. SendClientMessage(playerid,BLAU,"Du hast den Vorgang abgebrochen.");
  795. Kick(playerid);
  796. return 1;
  797. }
  798. if(response==1)
  799. {
  800. if(!strlen(inputtext))
  801. {
  802. SendClientMessage(playerid,BLAU,"Das Passwort war nicht lang genug.");
  803. ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registrieren","Gib bitte das gewünschte Passwort ein:","Register","Abbrechen");
  804. return 1;
  805. }
  806. else
  807. {
  808. Register(playerid,inputtext);
  809. return 1;
  810. }
  811. }
  812. }
  813. if(dialogid==DIALOG_TUTORIAL)
  814. {
  815. if(response==1)
  816. {
  817. SetPlayerPos(playerid,1227.1797,-914.0590,42.6812);
  818. SendClientMessage(playerid,0xFFFF00FF,"Du wurdest Teleportiert");
  819. }
  820. if(response==0)
  821. {
  822. SendClientMessage(playerid,BLAU,"Ok dann halt nicht...");
  823. }
  824. }
  825. return 1;
  826. }
  827.  
  828. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  829. {
  830. return 1;
  831. }
  832.  
  833. stock SpielerName(playerid)
  834. {
  835. new name[MAX_PLAYER_NAME];
  836. GetPlayerName(playerid,name,sizeof(name));
  837. return name;
  838. }
  839.  
  840. stock Register(playerid,key[])
  841. {
  842. new Spielerdatei[64];
  843. new name[MAX_PLAYER_NAME];
  844. GetPlayerName(playerid,name,sizeof(name));
  845. format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
  846. dini_Create(Spielerdatei);
  847. dini_Set(Spielerdatei,"Passwort",key);
  848. SendClientMessage(playerid,BLAU,"Erfolgreich registriert.");
  849. SetPlayerScore(playerid,0);
  850. SetPVarInt(playerid,"loggedin",1);
  851. return 1;
  852. }
  853.  
  854. stock Login(playerid,key[])
  855. {
  856. new Spielerdatei[64];
  857. new name[MAX_PLAYER_NAME];
  858. GetPlayerName(playerid,name,sizeof(name));
  859. format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
  860.  
  861. if(gettime()<dini_Int(Spielerdatei,"timeban"))
  862. {
  863. SendClientMessage(playerid,ROT,"Du bist noch gebannt. Komm später wieder.");
  864. Kick(playerid);
  865. return 1;
  866. }
  867.  
  868. if(!strcmp(key,dini_Get(Spielerdatei,"Passwort"),false))
  869. {
  870. LoadAccount(playerid);
  871. SendClientMessage(playerid,BLAU,"Erfolgreich eingeloggt.");
  872. return 1;
  873. }
  874. else
  875. {
  876. SendClientMessage(playerid,BLAU,"Falsches Passwort.");
  877. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Dein Account wurde gefunden. Gib bitte das Passwort ein.","Login","Abbrechen");
  878. return 1;
  879. }
  880. }
  881.  
  882. stock LoadAccount(playerid)
  883. {
  884. new Spielerdatei[64];
  885. new name[MAX_PLAYER_NAME];
  886. GetPlayerName(playerid,name,sizeof(name));
  887. format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
  888. SetPlayerScore(playerid,dini_Int(Spielerdatei,"Level"));
  889. GivePlayerMoney(playerid,dini_Int(Spielerdatei,"Geld"));
  890. SetPVarInt(playerid,"Adminlevel",dini_Int(Spielerdatei,"Adminlevel"));
  891. SetPVarInt(playerid,"Fraktion",dini_Int(Spielerdatei,"Fraktion"));
  892. SetPVarInt(playerid,"Baned",dini_Int(Spielerdatei,"Baned"));
  893. if(GetPVarInt(playerid,"Baned")==1)
  894. {
  895. SendClientMessage(playerid,ROT,"Du bist vom Server gebannt.");
  896. Kick(playerid);
  897. }
  898. SetPVarInt(playerid,"loggedin",1);
  899. return 1;
  900. }
  901.  
  902. stock SpielerSpeichern(playerid)
  903. {
  904. if(GetPVarInt(playerid,"loggedin")==1)
  905. {
  906. new Spielerdatei[64];
  907. new name[MAX_PLAYER_NAME];
  908. GetPlayerName(playerid,name,sizeof(name));
  909. format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
  910. dini_IntSet(Spielerdatei,"Level",GetPlayerScore(playerid));
  911. dini_IntSet(Spielerdatei,"Geld",GetPlayerMoney(playerid));
  912. dini_IntSet(Spielerdatei,"Adminlevel",GetPVarInt(playerid,"Adminlevel"));
  913. dini_IntSet(Spielerdatei,"Fraktion",GetPVarInt(playerid,"Fraktion"));
  914. dini_IntSet(Spielerdatei,"Baned",GetPVarInt(playerid,"Baned"));
  915. dini_IntSet(Spielerdatei,"timeban",GetPVarInt(playerid,"timeban"));
  916. }
  917. return 1;
  918. }
  919.  
  920. stock isPlayerInFrakt(playerid,fraktid)
  921. {
  922. if(GetPVarInt(playerid,"Fraktion")==fraktid)return 1;
  923. return 0;
  924. }
  925.  
  926. stock isPlayerAnAdmin(playerid,rang)
  927. {
  928. if(GetPVarInt(playerid,"Adminlevel")>=rang)return 1;
  929. return 0;
  930. }
  931.  
  932. stock sscanf(sstring[], format[], {Float,_}:...)
  933. {
  934. #if defined isnull
  935. if (isnull(sstring))
  936. #else
  937. if (sstring[0] == 0 || (sstring[0] == 1 && sstring[1] == 0))
  938. #endif
  939. {
  940. return format[0];
  941. }
  942. #pragma tabsize 4
  943. new
  944. formatPos = 0,
  945. sstringPos = 0,
  946. paramPos = 2,
  947. paramCount = numargs(),
  948. delim = ' ';
  949. while (sstring[sstringPos] && sstring[sstringPos] <= ' ')
  950. {
  951. sstringPos++;
  952. }
  953. while (paramPos < paramCount && sstring[sstringPos])
  954. {
  955. switch (format[formatPos++])
  956. {
  957. case '\0':
  958. {
  959. return 0;
  960. }
  961. case 'i', 'd':
  962. {
  963. new
  964. neg = 1,
  965. num = 0,
  966. ch = sstring[sstringPos];
  967. if (ch == '-')
  968. {
  969. neg = -1;
  970. ch = sstring[++sstringPos];
  971. }
  972. do
  973. {
  974. sstringPos++;
  975. if ('0' <= ch <= '9')
  976. {
  977. num = (num * 10) + (ch - '0');
  978. }
  979. else
  980. {
  981. return -1;
  982. }
  983. }
  984. while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
  985. setarg(paramPos, 0, num * neg);
  986. }
  987. case 'h', 'x':
  988. {
  989. new
  990. num = 0,
  991. ch = sstring[sstringPos];
  992. do
  993. {
  994. sstringPos++;
  995. switch (ch)
  996. {
  997. case 'x', 'X':
  998. {
  999. num = 0;
  1000. continue;
  1001. }
  1002. case '0' .. '9':
  1003. {
  1004. num = (num << 4) | (ch - '0');
  1005. }
  1006. case 'a' .. 'f':
  1007. {
  1008. num = (num << 4) | (ch - ('a' - 10));
  1009. }
  1010. case 'A' .. 'F':
  1011. {
  1012. num = (num << 4) | (ch - ('A' - 10));
  1013. }
  1014. default:
  1015. {
  1016. return -1;
  1017. }
  1018. }
  1019. }
  1020. while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
  1021. setarg(paramPos, 0, num);
  1022. }
  1023. case 'c':
  1024. {
  1025. setarg(paramPos, 0, sstring[sstringPos++]);
  1026. }
  1027. case 'f':
  1028. {
  1029.  
  1030. new changestr[16], changepos = 0, strpos = sstringPos;
  1031. while(changepos < 16 && sstring[strpos] && sstring[strpos] != delim)
  1032. {
  1033. changestr[changepos++] = sstring[strpos++];
  1034. }
  1035. changestr[changepos] = '\0';
  1036. setarg(paramPos,0,_:floatstr(changestr));
  1037. }
  1038. case 'p':
  1039. {
  1040. delim = format[formatPos++];
  1041. continue;
  1042. }
  1043. case '\'':
  1044. {
  1045. new
  1046. end = formatPos - 1,
  1047. ch;
  1048. while ((ch = format[++end]) && ch != '\'') {}
  1049. if (!ch)
  1050. {
  1051. return -1;
  1052. }
  1053. format[end] = '\0';
  1054. if ((ch = strfind(sstring, format[formatPos], false, sstringPos)) == -1)
  1055. {
  1056. if (format[end + 1])
  1057. {
  1058. return -1;
  1059. }
  1060. return 0;
  1061. }
  1062. format[end] = '\'';
  1063. sstringPos = ch + (end - formatPos);
  1064. formatPos = end + 1;
  1065. }
  1066. case 'u':
  1067. {
  1068. new
  1069. end = sstringPos - 1,
  1070. id = 0,
  1071. bool:num = true,
  1072. ch;
  1073. while ((ch = sstring[++end]) && ch != delim)
  1074. {
  1075. if (num)
  1076. {
  1077. if ('0' <= ch <= '9')
  1078. {
  1079. id = (id * 10) + (ch - '0');
  1080. }
  1081. else
  1082. {
  1083. num = false;
  1084. }
  1085. }
  1086. }
  1087. if (num && IsPlayerConnected(id))
  1088. {
  1089. setarg(paramPos, 0, id);
  1090. }
  1091. else
  1092. {
  1093. #if !defined foreach
  1094. #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  1095. #define __SSCANF_FOREACH__
  1096. #endif
  1097. sstring[end] = '\0';
  1098. num = false;
  1099. new
  1100. name[MAX_PLAYER_NAME];
  1101. id = end - sstringPos;
  1102. foreach (Player, playerid)
  1103. {
  1104. GetPlayerName(playerid, name, sizeof (name));
  1105. if (!strcmp(name, sstring[sstringPos], true, id))
  1106. {
  1107. setarg(paramPos, 0, playerid);
  1108. num = true;
  1109. break;
  1110. }
  1111. }
  1112. if (!num)
  1113. {
  1114. setarg(paramPos, 0, INVALID_PLAYER_ID);
  1115. }
  1116. sstring[end] = ch;
  1117. #if defined __SSCANF_FOREACH__
  1118. #undef foreach
  1119. #undef __SSCANF_FOREACH__
  1120. #endif
  1121. }
  1122. sstringPos = end;
  1123. }
  1124. case 's', 'z':
  1125. {
  1126. new
  1127. i = 0,
  1128. ch;
  1129. if (format[formatPos])
  1130. {
  1131. while ((ch = sstring[sstringPos++]) && ch != delim)
  1132. {
  1133. setarg(paramPos, i++, ch);
  1134. }
  1135. if (!i)
  1136. {
  1137. return -1;
  1138. }
  1139. }
  1140. else
  1141. {
  1142. while ((ch = sstring[sstringPos++]))
  1143. {
  1144. setarg(paramPos, i++, ch);
  1145. }
  1146. }
  1147. sstringPos--;
  1148. setarg(paramPos, i, '\0');
  1149. }
  1150. default:
  1151. {
  1152. continue;
  1153. }
  1154. }
  1155. while (sstring[sstringPos] && sstring[sstringPos] != delim && sstring[sstringPos] > ' ')
  1156. {
  1157. sstringPos++;
  1158. }
  1159. while (sstring[sstringPos] && (sstring[sstringPos] == delim || sstring[sstringPos] <= ' '))
  1160. {
  1161. sstringPos++;
  1162. }
  1163. paramPos++;
  1164. }
  1165. do
  1166. {
  1167. if ((delim = format[formatPos++]) > ' ')
  1168. {
  1169. if (delim == '\'')
  1170. {
  1171. while ((delim = format[formatPos++]) && delim != '\'') {}
  1172. }
  1173. else if (delim != 'z')
  1174. {
  1175. return delim;
  1176. }
  1177. }
  1178. }
  1179. while (delim > ' ');
  1180. return 0;
  1181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement