Advertisement
Guest User

Untitled

a guest
Apr 25th, 2011
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.44 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <utils>
  4. #define Rot 0xFF0000FF
  5.  
  6. #define DIALOG_ADMINPANEL 0
  7. #define DIALOG_FSLADEN 1
  8. #define DIALOG_FSUNLADEN 2
  9. #define DIALOG_MAP 3
  10. #define DIALOG_HOST 4
  11. #define DIALOG_WEB 5
  12. #define DIALOG_NPC 6
  13. #define DIALOG_VEHICLE 7
  14. #define DIALOG_ADMINLOGIN 8
  15. #define DIALOG_BANKICK 9
  16. new geloggt;
  17. public OnFilterScriptInit()
  18. {
  19. print("\n-------------------------------");
  20. print(" Adminpanel by Kai v 0.5");
  21. print("-------------------------------\n");
  22. return 1;
  23. }
  24.  
  25. public OnFilterScriptExit()
  26. {
  27. print("\n-------------------------------");
  28. print(" Adminpanel by Kai v 0.5");
  29. print(" is shuttung down");
  30. print("-------------------------------\n");
  31. return 1;
  32. }
  33. public OnGameModeInit()
  34. {
  35. return 1;
  36. }
  37.  
  38. public OnGameModeExit()
  39. {
  40. return 1;
  41. }
  42.  
  43. public OnPlayerRequestClass(playerid, classid)
  44. {
  45. return 1;
  46. }
  47.  
  48. public OnPlayerConnect(playerid)
  49. {
  50. geloggt=0;
  51. return 1;
  52. }
  53.  
  54. public OnPlayerDisconnect(playerid, reason)
  55. {
  56. return 1;
  57. }
  58.  
  59. public OnPlayerSpawn(playerid)
  60. {
  61. return 1;
  62. }
  63.  
  64. public OnPlayerDeath(playerid, killerid, reason)
  65. {
  66. return 1;
  67. }
  68.  
  69. public OnVehicleSpawn(vehicleid)
  70. {
  71. return 1;
  72. }
  73.  
  74. public OnVehicleDeath(vehicleid, killerid)
  75. {
  76. return 1;
  77. }
  78.  
  79. public OnPlayerText(playerid, text[])
  80. {
  81. return 1;
  82. }
  83.  
  84. public OnPlayerCommandText(playerid, cmdtext[])
  85. {
  86. if (strcmp("/adminpanel", cmdtext, true, 10) == 0)
  87. {
  88. if(geloggt==0)
  89. {
  90. ShowPlayerDialog(playerid,DIALOG_ADMINLOGIN,DIALOG_STYLE_INPUT,"AdminLogin","Bitte geben Sie das Passwort ein","Weiter","Abbruch");
  91. }
  92. else
  93. {
  94. ShowPlayerDialog(playerid,DIALOG_ADMINPANEL,DIALOG_STYLE_LIST,"Adminpanel","Server Restart\nServer Ausschalten\nFilterscript Laden\nFilterscript unladen\nMapnamen ändern\nHostname ändern\nWeburl ändern\nMaxnpc ändern\nBan/Kick\nVehicle","Weiter","Abbruch");
  95. }
  96. return 1;
  97. }
  98. return 0;
  99. }
  100.  
  101. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  102. {
  103. return 1;
  104. }
  105.  
  106. public OnPlayerExitVehicle(playerid, vehicleid)
  107. {
  108. return 1;
  109. }
  110.  
  111. public OnPlayerStateChange(playerid, newstate, oldstate)
  112. {
  113. return 1;
  114. }
  115.  
  116. public OnPlayerEnterCheckpoint(playerid)
  117. {
  118. return 1;
  119. }
  120.  
  121. public OnPlayerLeaveCheckpoint(playerid)
  122. {
  123. return 1;
  124. }
  125.  
  126. public OnPlayerEnterRaceCheckpoint(playerid)
  127. {
  128. return 1;
  129. }
  130.  
  131. public OnPlayerLeaveRaceCheckpoint(playerid)
  132. {
  133. return 1;
  134. }
  135.  
  136. public OnRconCommand(cmd[])
  137. {
  138. return 1;
  139. }
  140.  
  141. public OnPlayerRequestSpawn(playerid)
  142. {
  143. return 1;
  144. }
  145.  
  146. public OnObjectMoved(objectid)
  147. {
  148. return 1;
  149. }
  150.  
  151. public OnPlayerObjectMoved(playerid, objectid)
  152. {
  153. return 1;
  154. }
  155.  
  156. public OnPlayerPickUpPickup(playerid, pickupid)
  157. {
  158. return 1;
  159. }
  160.  
  161. public OnVehicleMod(playerid, vehicleid, componentid)
  162. {
  163. return 1;
  164. }
  165.  
  166. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  167. {
  168. return 1;
  169. }
  170.  
  171. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  172. {
  173. return 1;
  174. }
  175.  
  176. public OnPlayerSelectedMenuRow(playerid, row)
  177. {
  178. return 1;
  179. }
  180.  
  181. public OnPlayerExitedMenu(playerid)
  182. {
  183. return 1;
  184. }
  185.  
  186. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  187. {
  188. return 1;
  189. }
  190.  
  191. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  192. {
  193. return 1;
  194. }
  195.  
  196. public OnRconLoginAttempt(ip[], password[], success)
  197. {
  198. return 1;
  199. }
  200.  
  201. public OnPlayerUpdate(playerid)
  202. {
  203. return 1;
  204. }
  205.  
  206. public OnPlayerStreamIn(playerid, forplayerid)
  207. {
  208. return 1;
  209. }
  210.  
  211. public OnPlayerStreamOut(playerid, forplayerid)
  212. {
  213. return 1;
  214. }
  215.  
  216. public OnVehicleStreamIn(vehicleid, forplayerid)
  217. {
  218. return 1;
  219. }
  220.  
  221. public OnVehicleStreamOut(vehicleid, forplayerid)
  222. {
  223. return 1;
  224. }
  225.  
  226. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  227. {
  228. if(dialogid==DIALOG_ADMINPANEL)
  229. {
  230. if(response)
  231. {
  232. if(listitem==0)
  233. {
  234. SendClientMessageToAll(Rot,"Guten Tag hier spricht der Server-Leiter");
  235. SendClientMessageToAll(Rot,"es wird nun ein Server-Restart durchgeführt!");
  236. SendRconCommand("gmx");
  237. return 1;
  238. }
  239. if(listitem==1)
  240. {
  241. SendClientMessageToAll(Rot,"Guten Tag hier spricht der Server-Leiter");
  242. SendClientMessageToAll(Rot,"der Server wird heruntergefahren!");
  243. SendRconCommand("exit");
  244. return 1;
  245. }
  246. if(listitem==2)
  247. {
  248. ShowPlayerDialog(playerid,DIALOG_FSLADEN,DIALOG_STYLE_INPUT,"Filterscript laden","Bitte geben sie den Namen des Filterscriptes ein.","Weiter","Zurück");
  249. }
  250. if(listitem==3)
  251. {
  252. ShowPlayerDialog(playerid,DIALOG_FSUNLADEN,DIALOG_STYLE_INPUT,"Filterscript unladen","Bitte geben sie den Namen des Filterscriptes ein.","Weiter","Zurück");
  253. }
  254. if(listitem==4)
  255. {
  256. ShowPlayerDialog(playerid,DIALOG_MAP,DIALOG_STYLE_INPUT,"Mapnamen ändern","Bitte geben sie den Namen der Map ein.","Weiter","Zurück");
  257. }
  258. if(listitem==5)
  259. {
  260. ShowPlayerDialog(playerid,DIALOG_HOST,DIALOG_STYLE_INPUT,"Hostnamen ändern","Bitte geben sie den Namen ein.","Weiter","Zurück");
  261. }
  262. if(listitem==6)
  263. {
  264. ShowPlayerDialog(playerid,DIALOG_WEB,DIALOG_STYLE_INPUT,"Weburl ändern","Bitte geben sie die Weburl ein.","Weiter","Zurück");
  265. }
  266. if(listitem==7)
  267. {
  268. ShowPlayerDialog(playerid,DIALOG_NPC,DIALOG_STYLE_INPUT,"MaxNPC ändern","Bitte geben sie die MaxNPC ein.","Weiter","Zurück");
  269. }
  270. if(listitem==8)
  271. {
  272. ShowPlayerDialog(playerid,DIALOG_BANKICK,DIALOG_STYLE_INPUT,"Ban/Kick","Bitte die ID des Spielers eingeben","Kick","Ban");
  273. }
  274. if(listitem==9)
  275. {
  276. ShowPlayerDialog(playerid,DIALOG_VEHICLE,DIALOG_STYLE_INPUT,"Vehicle","Geben Sie die Vehicle id an","OK","");
  277. }
  278. }
  279. }
  280. if(dialogid==DIALOG_FSLADEN)
  281. {
  282. if(response)
  283. {
  284. new string[128];
  285. format(string,sizeof(string),"loadfs %s",inputtext);
  286. SendRconCommand(string);
  287. }
  288. else
  289. {
  290. ShowPlayerDialog(playerid,DIALOG_ADMINPANEL,DIALOG_STYLE_LIST,"Adminpanel","Server Restart\nServer Ausschalten\nFilterscript Laden\nFilterscript unladen\nMapnamen ändern\nHostname ändern\nWeburl ändern\nMaxnpc ändern\nBan/Kick\nVehicle","Weiter","Abbruch");
  291. }
  292. }
  293. if(dialogid==DIALOG_FSUNLADEN)
  294. {
  295. if(response)
  296. {
  297. new string[128];
  298. format(string,sizeof(string),"unloadfs %s",inputtext);
  299. SendRconCommand(string);
  300. }
  301. else
  302. {
  303. ShowPlayerDialog(playerid,DIALOG_ADMINPANEL,DIALOG_STYLE_LIST,"Adminpanel","Server Restart\nServer Ausschalten\nFilterscript Laden\nFilterscript unladen\nMapnamen ändern\nHostname ändern\nWeburl ändern\nMaxnpc ändern\nBan/Kick\nVehicle","Weiter","Abbruch");
  304. }
  305. }
  306. if(dialogid==DIALOG_MAP)
  307. {
  308. if(response)
  309. {
  310. new string[128];
  311. format(string,sizeof(string),"mapname %s",inputtext);
  312. SendRconCommand(string);
  313. }
  314. else
  315. {
  316. ShowPlayerDialog(playerid,DIALOG_ADMINPANEL,DIALOG_STYLE_LIST,"Adminpanel","Server Restart\nServer Ausschalten\nFilterscript Laden\nFilterscript unladen\nMapnamen ändern\nHostname ändern\nWeburl ändern\nMaxnpc ändern\nBan/Kick\nVehicle","Weiter","Abbruch");
  317. }
  318. }
  319. if(dialogid==DIALOG_HOST)
  320. {
  321. if(response)
  322. {
  323. new string[128];
  324. format(string,sizeof(string),"hostname %s",inputtext);
  325. SendRconCommand(string);
  326. }
  327. else
  328. {
  329. ShowPlayerDialog(playerid,DIALOG_ADMINPANEL,DIALOG_STYLE_LIST,"Adminpanel","Server Restart\nServer Ausschalten\nFilterscript Laden\nFilterscript unladen\nMapnamen ändern\nHostname ändern\nWeburl ändern\nMaxnpc ändern\nBan/Kick\nVehicle","Weiter","Abbruch");
  330. }
  331. }
  332. if(dialogid==DIALOG_WEB)
  333. {
  334. if(response)
  335. {
  336. new string[128];
  337. format(string,sizeof(string),"weburl %s",inputtext);
  338. SendRconCommand(string);
  339. }
  340. else
  341. {
  342. ShowPlayerDialog(playerid,DIALOG_ADMINPANEL,DIALOG_STYLE_LIST,"Adminpanel","Server Restart\nServer Ausschalten\nFilterscript Laden\nFilterscript unladen\nMapnamen ändern\nHostname ändern\nWeburl ändern\nMaxnpc ändern\nBan/Kick\nVehicle","Weiter","Abbruch");
  343. }
  344. }
  345. if(dialogid==DIALOG_NPC)
  346. {
  347. if(response)
  348. {
  349. new string[128];
  350. format(string,sizeof(string),"maxnpc %s",inputtext);
  351. SendRconCommand(string);
  352. }
  353. else
  354. {
  355. ShowPlayerDialog(playerid,DIALOG_ADMINPANEL,DIALOG_STYLE_LIST,"Adminpanel","Server Restart\nServer Ausschalten\nFilterscript Laden\nFilterscript unladen\nMapnamen ändern\nHostname ändern\nWeburl ändern\nMaxnpc ändern\nBan/Kick\nVehicle","Weiter","Abbruch");
  356. }
  357. }
  358. if(dialogid==DIALOG_ADMINLOGIN)
  359. {
  360. if(response)
  361. {
  362. Login(playerid,inputtext);
  363. }
  364. }
  365. if(dialogid==DIALOG_BANKICK)
  366. {
  367. if(response==0)
  368. {
  369. new idx;
  370. new tmp[180];
  371. tmp = strtok(inputtext, idx);
  372. new player;
  373. player = ReturnUser(tmp);
  374. if(player != INVALID_PLAYER_ID)
  375. {
  376. Ban(player);
  377. }
  378. }
  379. if(response==1)
  380. {
  381. new idx;
  382. new tmp[180];
  383. tmp = strtok(inputtext, idx);
  384. new player;
  385. player = ReturnUser(tmp);
  386. if(player != INVALID_PLAYER_ID)
  387. {
  388. Kick(player);
  389. }
  390. }
  391. }
  392. if(dialogid==DIALOG_VEHICLE)
  393. {
  394. if(response)
  395. {
  396. new idx;
  397. idx=strval(inputtext);
  398. new
  399. Float:x,
  400. Float:y,
  401. Float:z,
  402. Float:a;
  403. GetPlayerPos(playerid,x,y,z);
  404. GetPlayerFacingAngle(playerid,a);
  405. CreateVehicle(idx, x, y, z + 2.0, a + 90.0,1,1,0);
  406. }
  407. }
  408. return 1;
  409. }
  410.  
  411. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  412. {
  413. return 1;
  414. }
  415. stock Login(playerid,key[])
  416. {
  417. new Adminpanel[64];
  418. format(Adminpanel,sizeof(Adminpanel),"/Adminpanel.txt");
  419. if(!strcmp(key,dini_Get(Adminpanel,"Passwort"),false))
  420. {
  421. ShowPlayerDialog(playerid,DIALOG_ADMINPANEL,DIALOG_STYLE_LIST,"Adminpanel","Server Restart\nServer Ausschalten\nFilterscript Laden\nFilterscript unladen\nMapnamen ändern\nHostname ändern\nWeburl ändern\nMaxnpc ändern\nBan/Kick\nVehicle","Weiter","Abbruch");
  422. geloggt=1;
  423. return 1;
  424. }
  425. return 0;
  426. }
  427. strtok(const string[], &index)
  428. {
  429. new length = strlen(string);
  430. while ((index < length) && (string[index] <= ' '))
  431. {
  432. index++;
  433. }
  434.  
  435. new offset = index;
  436. new result[20];
  437. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  438. {
  439. result[index - offset] = string[index];
  440. index++;
  441. }
  442. result[index - offset] = EOS;
  443. return result;
  444. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement