Advertisement
Guest User

OmerT simple script

a guest
Dec 1st, 2011
583
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.52 KB | None | 0 0
  1. /*
  2. OmerT(Omer_Tabib or Rodrigez_Lopez) Simple Dini account and vehicle system with cmd to create a vehicle, -> for begginers <-
  3. Created: 12/02/2011 (Or 02/12/2011)
  4. dd/mm/yyyy
  5. The script is using sscanf2 and zcmd.
  6.  
  7. Have fun!
  8. */
  9. #include <a_samp>
  10. #include <dini>
  11. #include <dudb>
  12. #include <float>
  13. #include <zcmd>
  14. #include <sscanf2>
  15.  
  16.  
  17. #if defined FILTERSCRIPT
  18.  
  19. public OnFilterScriptInit()
  20. {
  21. print("\n--------------------------------------");
  22. print(" Blank Filterscript by your name here");
  23. print("--------------------------------------\n");
  24. return 1;
  25. }
  26.  
  27. public OnFilterScriptExit()
  28. {
  29. return 1;
  30. }
  31.  
  32. #else
  33.  
  34. #define MAX_CARS 200
  35.  
  36. enum pInfo {
  37. pw,
  38. Level,
  39. Admin,
  40. Money,
  41. }
  42. new PlayerInfo[MAX_PLAYERS][pInfo];
  43. enum vInfo {
  44. Model,
  45. Float:X,
  46. Float:Y,
  47. Float:Z,
  48. Float:R,
  49. Color1,
  50. Color2,
  51. }
  52. new VehicleInfo[MAX_CARS][vInfo];
  53.  
  54.  
  55. stock LoadVehicles()
  56. {
  57. new vfile[255];
  58. for(new vid = 1; vid < MAX_CARS; vid++) //Counting the vehicles files
  59. {
  60. format(vfile, sizeof(vfile), "Vehicles/%d.ini", vid); //The file name
  61. if(dini_Exists(vfile)) // Checks if the file exists, if he is so he will spawn IG
  62. {
  63. VehicleInfo[vid][Model] = dini_Int(vfile, "Model");
  64. VehicleInfo[vid][X] = dini_Int(vfile, "X");
  65. VehicleInfo[vid][Y] = dini_Int(vfile, "Y");
  66. VehicleInfo[vid][Z] = dini_Int(vfile, "Z");
  67. VehicleInfo[vid][R] = dini_Int(vfile, "R");
  68. VehicleInfo[vid][Color1] = dini_Int(vfile, "Color1");
  69. VehicleInfo[vid][Color2] = dini_Int(vfile, "Color2");
  70. CreateVehicle(VehicleInfo[vid][Model], VehicleInfo[vid][X], VehicleInfo[vid][Y], VehicleInfo[vid][Z], VehicleInfo[vid][R], VehicleInfo[vid][Color1], VehicleInfo[vid][Color2], 1);
  71. }
  72. }
  73.  
  74. }
  75. main()
  76. {
  77. print("\n-----------------------------------------------");
  78. print(" Omer_Tabib Blank GM with Vehicles and Accounts");
  79. print("-------------------------------------------------\n");
  80. }
  81.  
  82. #endif
  83.  
  84. public OnGameModeInit()
  85. {
  86. LoadVehicles(); //The stock we created..
  87. SetGameModeText("Blank Script");
  88. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  89. return 1;
  90. }
  91.  
  92. public OnGameModeExit()
  93. {
  94. return 1;
  95. }
  96.  
  97. public OnPlayerRequestClass(playerid, classid)
  98. {
  99. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  100. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  101. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  102. return 1;
  103. }
  104.  
  105. public OnPlayerConnect(playerid)
  106. {
  107. new file[255];
  108. new pname[255];
  109. GetPlayerName(playerid, pname, sizeof(pname));
  110. format(file, sizeof(file), "Users/%s.ini", pname);
  111. if(dini_Exists(file))
  112. {
  113. PlayerInfo[playerid][Level] = dini_Int(file, "Level");
  114. PlayerInfo[playerid][pw] = dini_Int(file, "pw");
  115. PlayerInfo[playerid][Admin] = dini_Int(file, "Admin");
  116. PlayerInfo[playerid][Money] = dini_Int(file, "Money");
  117. ShowPlayerDialog(playerid, 1001, DIALOG_STYLE_INPUT, "Login", "Type in your password", "Confirm", "Exit");
  118. }
  119. else if(dini_Create(file)){
  120. ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_INPUT, "Register", "Set your password", "Confirm", "Exit");
  121. SendClientMessage(playerid, 0xFFFFFF, "Welcome to (Change me at 118) Please Register!");
  122. }
  123. return 1;
  124. }
  125.  
  126. public OnPlayerDisconnect(playerid, reason)
  127. {
  128. new file[255];
  129. new pname[255];
  130. new score = GetPlayerScore(playerid);
  131. new money = GetPlayerMoney(playerid);
  132. GetPlayerName(playerid, pname, sizeof(pname));
  133. format(file, sizeof(file), "Users/%s.ini", pname);
  134. if(dini_Exists(file))
  135. {
  136. dini_IntSet(file, "Level", score);
  137. dini_IntSet(file, "Money", money);
  138. dini_IntSet(file, "Admin", PlayerInfo[playerid][Admin]);
  139. }
  140. return 1;
  141. }
  142.  
  143. public OnPlayerSpawn(playerid)
  144. {
  145. GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
  146. return 1;
  147. }
  148.  
  149. public OnPlayerDeath(playerid, killerid, reason)
  150. {
  151. return 1;
  152. }
  153.  
  154. public OnVehicleSpawn(vehicleid)
  155. {
  156. return 1;
  157. }
  158.  
  159. public OnVehicleDeath(vehicleid, killerid)
  160. {
  161. return 1;
  162. }
  163.  
  164. public OnPlayerText(playerid, text[])
  165. {
  166. return 1;
  167. }
  168.  
  169. public OnPlayerCommandText(playerid, cmdtext[])
  170. {
  171. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  172. {
  173. // Do something here
  174. return 1;
  175. }
  176. return 0;
  177. }
  178.  
  179. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  180. {
  181. return 1;
  182. }
  183.  
  184. public OnPlayerExitVehicle(playerid, vehicleid)
  185. {
  186. return 1;
  187. }
  188.  
  189. public OnPlayerStateChange(playerid, newstate, oldstate)
  190. {
  191. return 1;
  192. }
  193.  
  194. public OnPlayerEnterCheckpoint(playerid)
  195. {
  196. return 1;
  197. }
  198.  
  199. public OnPlayerLeaveCheckpoint(playerid)
  200. {
  201. return 1;
  202. }
  203.  
  204. public OnPlayerEnterRaceCheckpoint(playerid)
  205. {
  206. return 1;
  207. }
  208.  
  209. public OnPlayerLeaveRaceCheckpoint(playerid)
  210. {
  211. return 1;
  212. }
  213.  
  214. public OnRconCommand(cmd[])
  215. {
  216. return 1;
  217. }
  218.  
  219. public OnPlayerRequestSpawn(playerid)
  220. {
  221. return 1;
  222. }
  223.  
  224. public OnObjectMoved(objectid)
  225. {
  226. return 1;
  227. }
  228.  
  229. public OnPlayerObjectMoved(playerid, objectid)
  230. {
  231. return 1;
  232. }
  233.  
  234. public OnPlayerPickUpPickup(playerid, pickupid)
  235. {
  236. return 1;
  237. }
  238.  
  239. public OnVehicleMod(playerid, vehicleid, componentid)
  240. {
  241. return 1;
  242. }
  243.  
  244. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  245. {
  246. return 1;
  247. }
  248.  
  249. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  250. {
  251. return 1;
  252. }
  253.  
  254. public OnPlayerSelectedMenuRow(playerid, row)
  255. {
  256. return 1;
  257. }
  258.  
  259. public OnPlayerExitedMenu(playerid)
  260. {
  261. return 1;
  262. }
  263.  
  264. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  265. {
  266. return 1;
  267. }
  268.  
  269. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  270. {
  271. return 1;
  272. }
  273.  
  274. public OnRconLoginAttempt(ip[], password[], success)
  275. {
  276. return 1;
  277. }
  278.  
  279. public OnPlayerUpdate(playerid)
  280. {
  281. return 1;
  282. }
  283.  
  284. public OnPlayerStreamIn(playerid, forplayerid)
  285. {
  286. return 1;
  287. }
  288.  
  289. public OnPlayerStreamOut(playerid, forplayerid)
  290. {
  291. return 1;
  292. }
  293.  
  294. public OnVehicleStreamIn(vehicleid, forplayerid)
  295. {
  296. return 1;
  297. }
  298.  
  299. public OnVehicleStreamOut(vehicleid, forplayerid)
  300. {
  301. return 1;
  302. }
  303.  
  304. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  305. {
  306. switch(dialogid)
  307. {
  308. case 1000:
  309. {
  310. if(response == 1)
  311. {
  312. new file[255];
  313. new pname[255];
  314. GetPlayerName(playerid, pname, sizeof(pname));
  315. format(file, sizeof(file), "Users/%s.ini", pname);
  316. if(dini_Exists(file))
  317. {
  318. dini_IntSet(file, "pw", num_hash(inputtext));
  319. dini_IntSet(file, "Level", 0);
  320. dini_IntSet(file, "Admin", 0);
  321. dini_IntSet(file, "Money", 500);
  322. GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
  323. }
  324. }
  325. else {
  326. Kick(playerid);
  327. }
  328. }
  329. case 1001:
  330. {
  331. if(response == 1)
  332. {
  333. if(num_hash(inputtext) == PlayerInfo[playerid][pw])
  334. {
  335. SendClientMessage(playerid, 0xFFFFFF, "Connected!");
  336. SetPlayerScore(playerid, PlayerInfo[playerid][Level]);
  337. SetPlayerMoney(playerid, PlayerInfo[playerid][Money]);
  338. }
  339. else {
  340. SendClientMessage(playerid, 0xFFFFFF, "Wrong Password!");
  341. ShowPlayerDialog(playerid, 1001, DIALOG_STYLE_INPUT, "Login", "Type in your password", "Confirm", "Exit");
  342. }
  343. }
  344. else {
  345. Kick(playerid);
  346. }
  347. }
  348. }
  349. return 1;
  350. }
  351.  
  352. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  353. {
  354. return 1;
  355. }
  356.  
  357. CMD:createcar(playerid, params[])
  358. {
  359. new mid;
  360. new vfile[225];
  361. if(sscanf(params, "i", mid)) return SendClientMessage(playerid, 0xFFFFFF, "/createcar [ModelID]");
  362. else if(mid > 600 || mid < 400) return SendClientMessage(playerid, 0xFFFFF, "/createcar [ModelID 400-600]");
  363. else {
  364. for(new vid = 0; vid < MAX_CARS; vid++)
  365. {
  366. format(vfile, sizeof(vfile), "Vehicles/%d.ini", vid);
  367. if(dini_Exists(vfile)) //Checks if the file exists
  368. {
  369. vid++; //if it does so the counting will continue
  370.  
  371. }
  372. else if(dini_Create(vfile)) //when the count got to an open slot he can create a new file now :)
  373. {
  374. new Float:x,Float:y,Float:z;
  375. new Float:a;
  376. new color1 = random(126);
  377. new color2 = random(126);
  378. GetPlayerPos(playerid,x,y,z);
  379. GetPlayerFacingAngle(playerid, a);
  380. dini_IntSet(vfile, "Model" , mid);
  381. dini_FloatSet(vfile, "X", x);
  382. dini_FloatSet(vfile, "Y", y);
  383. dini_FloatSet(vfile, "Z", z);
  384. dini_FloatSet(vfile, "R", a);
  385. dini_IntSet(vfile, "Color1", color1);
  386. dini_IntSet(vfile, "Color2", color2);
  387. CreateVehicle(mid, x, y, z, a, color1, color2, 1);
  388. SetPlayerPos(playerid, x,y,z+0.5);
  389. return 1; // DONT REPLACE THIS LINE!
  390. }
  391. }
  392. }
  393. return 1;
  394. }
  395.  
  396. CMD:gmx(playerid, params[])
  397. {
  398. SendRconCommand("gmx");
  399. }
  400.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement