Добро пожаловать на Pro Pawn - Портал о PAWN-скриптинге.
Показано с 1 по 3 из 3
  1. #1
    Аватар для SteveStage
    Пользователь

    Статус
    Оффлайн
    Регистрация
    05.10.2019
    Адрес
    Планета Земля
    Сообщений
    318
    Репутация:
    7 ±

    Краш компилятора.

    1. case DLG_ID_INVENT_TAKE_PATRONS:
    2. {
    3. if(!strlen(inputtext))
    4. {
    5. SCM(playerid, COLOR_RED, !"[SERVER] Вы ничего не ввели!");
    6. return DialogTakePatrons(playerid);
    7. }
    8. new
    9. val = strval(inputtext);
    10. if(val <= 0)
    11. {
    12. SCM(playerid, COLOR_RED, !"[SERVER] Вы не можете загрузить меньше, чем 1 патрон!");
    13. return DialogTakePatrons(playerid);
    14. }
    15. if(val > inv[playerid][select_slot{playerid}][i_amount])
    16. {
    17. SCM(playerid, COLOR_RED, !"[SERVER] Вы не можете загрузить больше патрон, чем имеете в инвентаре!");
    18. return DialogTakePatrons(playerid);
    19. }
    20. new
    21. string[128+1],
    22. weaponid = 0,
    23. ammo = 0;
    24. switch(inv[playerid][select_slot{playerid}][i_item])
    25. {
    26. case INVENT_WEAPON_DEAGLE:
    27. {
    28. GetPlayerWeaponData(playerid, 2, weaponid, ammo);
    29. switch(weaponid)
    30. {
    31. case WEAPON_DEAGLE:
    32. {
    33. GivePlayerWeapon(playerid, WEAPON_DEAGLE, ammo+val);
    34. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из кобуры Desert Eagle и взяли его в руки.");
    35. //PC_EmulateCommand(playerid, "/me достал из кобуры Desert Eagle и взял его в руки.");
    36. switch(inv[playerid][select_slot{playerid}][i_amount])
    37. {
    38. case 0:
    39. {
    40. for(new i = select_slot{playerid}; i < inv_slots{playerid}; i++)
    41. {
    42. inv[playerid][i][i_item] = inv[playerid][i+1][i_item];
    43. inv[playerid][i][i_amount] = inv[playerid][i+1][i_amount];
    44. format(string, sizeof(string),
    45. "UPDATE `inventory` SET `itemid` = '%d' AND `amountid` = '%d' WHERE `ownertableid` = '%d' AND\
    46. `slotid` = '%d'", inv[playerid][i][i_item], inv[playerid][i][i_amount],
    47. player[playerid][p_tableid], i);
    48. mysql_function_query(connect_mysql, string, false, "", "");
    49. inv_slots{playerid}--;
    50. }
    51. return true;
    52. }
    53. default:
    54. {
    55. format(string, sizeof(string),
    56. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    57. inv[playerid][select_slot{playerid}][i_amount], player[playerid][p_tableid], select_slot{playerid});
    58. mysql_function_query(connect_mysql, string, false, "", "");
    59. return true;
    60. }
    61. }
    62. }
    63. case WEAPON_SILENCED:
    64. {
    65. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    66. {
    67. // throw
    68. return true;
    69. }
    70. new
    71. __check = 0;
    72. for(new i = 0; i < inv_slots{playerid}; i++)
    73. {
    74. if(inv[playerid][i][i_item] == INVENT_WEAPON_SILENCED_COLT45)
    75. {
    76. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    77. format(string, sizeof(string),
    78. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    79. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    80. __check = 1;
    81. }
    82. }
    83. if(__check == 0)
    84. {
    85. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_SILENCED_COLT45;
    86. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    87. format(string, sizeof(string),
    88. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    89. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    90. player[playerid][p_tableid], inv_slots{playerid}+1);
    91. }
    92. }
    93. case WEAPON_COLT45:
    94. {
    95. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    96. {
    97. // throw
    98. return true;
    99. }
    100. new
    101. __check = 0;
    102. for(new i = 0; i < inv_slots{playerid}; i++)
    103. {
    104. if(inv[playerid][i][i_item] == INVENT_WEAPON_COLT45)
    105. {
    106. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    107. format(string, sizeof(string),
    108. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    109. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    110. __check = 1;
    111. }
    112. }
    113. if(__check == 0)
    114. {
    115. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_COLT45;
    116. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    117. format(string, sizeof(string),
    118. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    119. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    120. player[playerid][p_tableid], inv_slots{playerid}+1);
    121. }
    122. }
    123. }
    124. GivePlayerWeapon(playerid, WEAPON_DEAGLE, val);
    125. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из кобуры Desert Eagle и взяли его в руки.");
    126. //PC_EmulateCommand(playerid, "/me достал из кобуры Desert Eagle и взял его в руки.");
    127. return true;
    128. }
    129. case INVENT_WEAPON_SHOTGUN:
    130. {
    131. GetPlayerWeaponData(playerid, 3, weaponid, ammo);
    132. switch(weaponid)
    133. {
    134. case WEAPON_SHOTGUN:
    135. {
    136. GivePlayerWeapon(playerid, WEAPON_SHOTGUN, ammo+val);
    137. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из чехла дробовик и взяли его в руки.");
    138. //PC_EmulateCommand(playerid, "/me достал из чехла дробовик и взял его в руки.");
    139. switch(inv[playerid][select_slot{playerid}][i_amount])
    140. {
    141. case 0:
    142. {
    143. for(new i = select_slot{playerid}; i < inv_slots{playerid}; i++)
    144. {
    145. inv[playerid][i][i_item] = inv[playerid][i+1][i_item];
    146. inv[playerid][i][i_amount] = inv[playerid][i+1][i_amount];
    147. format(string, sizeof(string),
    148. "UPDATE `inventory` SET `itemid` = '%d' AND `amountid` = '%d' WHERE `ownertableid` = '%d' AND\
    149. `slotid` = '%d'", inv[playerid][i][i_item], inv[playerid][i][i_amount],
    150. player[playerid][p_tableid], i);
    151. mysql_function_query(connect_mysql, string, false, "", "");
    152. inv_slots{playerid}--;
    153. }
    154. return true;
    155. }
    156. default:
    157. {
    158. format(string, sizeof(string),
    159. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    160. inv[playerid][select_slot{playerid}][i_amount], player[playerid][p_tableid], select_slot{playerid});
    161. mysql_function_query(connect_mysql, string, false, "", "");
    162. return true;
    163. }
    164. }
    165. }
    166. case WEAPON_SHOTGSPA:
    167. {
    168. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    169. {
    170. // throw
    171. return true;
    172. }
    173. new
    174. __check = 0;
    175. for(new i = 0; i < inv_slots{playerid}; i++)
    176. {
    177. if(inv[playerid][i][i_item] == INVENT_WEAPON_SPAS12)
    178. {
    179. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    180. format(string, sizeof(string),
    181. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    182. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    183. __check = 1;
    184. }
    185. }
    186. if(__check == 0)
    187. {
    188. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_SPAS12;
    189. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    190. format(string, sizeof(string),
    191. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    192. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    193. player[playerid][p_tableid], inv_slots{playerid}+1);
    194. }
    195. }
    196. }
    197. GivePlayerWeapon(playerid, WEAPON_SHOTGUN, val);
    198. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из чехла дробовик и взяли его в руки.");
    199. //PC_EmulateCommand(playerid, "/me достал из чехла дробовик и взял его в руки.");
    200. return true;
    201. }
    202. case INVENT_WEAPON_M4A1:
    203. {
    204. GetPlayerWeaponData(playerid, 5, weaponid, ammo);
    205. switch(weaponid)
    206. {
    207. case WEAPON_M4:
    208. {
    209. GivePlayerWeapon(playerid, WEAPON_M4, ammo+val);
    210. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из чехла M4A1 и взяли его в руки.");
    211. //PC_EmulateCommand(playerid, "/me достал из чехла M4A1 и взял его в руки.");
    212. switch(inv[playerid][select_slot{playerid}][i_amount])
    213. {
    214. case 0:
    215. {
    216. for(new i = select_slot{playerid}; i < inv_slots{playerid}; i++)
    217. {
    218. inv[playerid][i][i_item] = inv[playerid][i+1][i_item];
    219. inv[playerid][i][i_amount] = inv[playerid][i+1][i_amount];
    220. format(string, sizeof(string),
    221. "UPDATE `inventory` SET `itemid` = '%d' AND `amountid` = '%d' WHERE `ownertableid` = '%d' AND\
    222. `slotid` = '%d'", inv[playerid][i][i_item], inv[playerid][i][i_amount],
    223. player[playerid][p_tableid], i);
    224. mysql_function_query(connect_mysql, string, false, "", "");
    225. inv_slots{playerid}--;
    226. }
    227. return true;
    228. }
    229. default:
    230. {
    231. format(string, sizeof(string),
    232. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    233. inv[playerid][select_slot{playerid}][i_amount], player[playerid][p_tableid], select_slot{playerid});
    234. mysql_function_query(connect_mysql, string, false, "", "");
    235. return true;
    236. }
    237. }
    238. return true;
    239. }
    240. case WEAPON_AK47:
    241. {
    242. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    243. {
    244. // throw
    245. return true;
    246. }
    247. new
    248. __check = 0;
    249. for(new i = 0; i < inv_slots{playerid}; i++)
    250. {
    251. if(inv[playerid][i][i_item] == INVENT_WEAPON_AK47)
    252. {
    253. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    254. format(string, sizeof(string),
    255. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    256. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    257. __check = 1;
    258. }
    259. }
    260. if(__check == 0)
    261. {
    262. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_AK47;
    263. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    264. format(string, sizeof(string),
    265. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    266. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    267. player[playerid][p_tableid], inv_slots{playerid}+1);
    268. }
    269. }
    270. }
    271. GivePlayerWeapon(playerid, WEAPON_M4, val);
    272. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из чехла M4A1 и взяли его в руки.");
    273. //PC_EmulateCommand(playerid, "/me достал из чехла M4A1 и взял его в руки.");
    274. return true;
    275. }
    276. case INVENT_WEAPON_AK47:
    277. {
    278. GetPlayerWeaponData(playerid, 5, weaponid, ammo);
    279. switch(weaponid)
    280. {
    281. case WEAPON_AK47:
    282. {
    283. GivePlayerWeapon(playerid, WEAPON_AK47, ammo+val);
    284. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из чехла AK-47 и взяли его в руки.");
    285. //PC_EmulateCommand(playerid, "/me достал из чехла AK-47 и взял его в руки.");switch(inv[playerid][select_slot{playerid}][i_amount])
    286. {
    287. case 0:
    288. {
    289. for(new i = select_slot{playerid}; i < inv_slots{playerid}; i++)
    290. {
    291. inv[playerid][i][i_item] = inv[playerid][i+1][i_item];
    292. inv[playerid][i][i_amount] = inv[playerid][i+1][i_amount];
    293. format(string, sizeof(string),
    294. "UPDATE `inventory` SET `itemid` = '%d' AND `amountid` = '%d' WHERE `ownertableid` = '%d' AND\
    295. `slotid` = '%d'", inv[playerid][i][i_item], inv[playerid][i][i_amount],
    296. player[playerid][p_tableid], i);
    297. mysql_function_query(connect_mysql, string, false, "", "");
    298. inv_slots{playerid}--;
    299. }
    300. return true;
    301. }
    302. default:
    303. {
    304. format(string, sizeof(string),
    305. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    306. inv[playerid][select_slot{playerid}][i_amount], player[playerid][p_tableid], select_slot{playerid});
    307. mysql_function_query(connect_mysql, string, false, "", "");
    308. return true;
    309. }
    310. }
    311. }
    312. case WEAPON_M4:
    313. {
    314. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    315. {
    316. // throw
    317. return true;
    318. }
    319. new
    320. __check = 0;
    321. for(new i = 0; i < inv_slots{playerid}; i++)
    322. {
    323. if(inv[playerid][i][i_item] == INVENT_WEAPON_M4A1)
    324. {
    325. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    326. format(string, sizeof(string),
    327. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    328. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    329. __check = 1;
    330. }
    331. }
    332. if(__check == 0)
    333. {
    334. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_M4A1;
    335. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    336. format(string, sizeof(string),
    337. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    338. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    339. player[playerid][p_tableid], inv_slots{playerid}+1);
    340. }
    341. }
    342. }
    343. GivePlayerWeapon(playerid, WEAPON_AK47, val);
    344. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из чехла AK-47 и взяли его в руки.");
    345. //PC_EmulateCommand(playerid, "/me достал из чехла AK-47 и взял его в руки.");
    346. return true;
    347. }
    348. case INVENT_WEAPON_COLT45:
    349. {
    350. GetPlayerWeaponData(playerid, 2, weaponid, ammo);
    351. switch(weaponid)
    352. {
    353. case WEAPON_COLT45:
    354. {
    355. GivePlayerWeapon(playerid, WEAPON_COLT45, ammo+val);
    356. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из кобуры Colt45 и взяли его в руки.");
    357. //PC_EmulateCommand(playerid, "/me достал из кобуры Colt45 и взял его в руки.");
    358. switch(inv[playerid][select_slot{playerid}][i_amount])
    359. {
    360. case 0:
    361. {
    362. for(new i = select_slot{playerid}; i < inv_slots{playerid}; i++)
    363. {
    364. inv[playerid][i][i_item] = inv[playerid][i+1][i_item];
    365. inv[playerid][i][i_amount] = inv[playerid][i+1][i_amount];
    366. format(string, sizeof(string),
    367. "UPDATE `inventory` SET `itemid` = '%d' AND `amountid` = '%d' WHERE `ownertableid` = '%d' AND\
    368. `slotid` = '%d'", inv[playerid][i][i_item], inv[playerid][i][i_amount],
    369. player[playerid][p_tableid], i);
    370. mysql_function_query(connect_mysql, string, false, "", "");
    371. inv_slots{playerid}--;
    372. }
    373. return true;
    374. }
    375. default:
    376. {
    377. format(string, sizeof(string),
    378. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    379. inv[playerid][select_slot{playerid}][i_amount], player[playerid][p_tableid], select_slot{playerid});
    380. mysql_function_query(connect_mysql, string, false, "", "");
    381. return true;
    382. }
    383. }
    384. }
    385. case WEAPON_DEAGLE:
    386. {
    387. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    388. {
    389. // throw
    390. return true;
    391. }
    392. new
    393. __check = 0;
    394. for(new i = 0; i < inv_slots{playerid}; i++)
    395. {
    396. if(inv[playerid][i][i_item] == INVENT_WEAPON_DEAGLE)
    397. {
    398. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    399. format(string, sizeof(string),
    400. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    401. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    402. __check = 1;
    403. }
    404. }
    405. if(__check == 0)
    406. {
    407. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_DEAGLE;
    408. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    409. format(string, sizeof(string),
    410. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    411. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    412. player[playerid][p_tableid], inv_slots{playerid}+1);
    413. }
    414. }
    415. case WEAPON_SILENCED:
    416. {
    417. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    418. {
    419. // throw
    420. return true;
    421. }
    422. new
    423. __check = 0;
    424. for(new i = 0; i < inv_slots{playerid}; i++)
    425. {
    426. if(inv[playerid][i][i_item] == INVENT_WEAPON_SILENCED_COLT45)
    427. {
    428. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    429. format(string, sizeof(string),
    430. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    431. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    432. __check = 1;
    433. }
    434. }
    435. if(__check == 0)
    436. {
    437. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_SILENCED_COLT45;
    438. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    439. format(string, sizeof(string),
    440. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    441. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    442. player[playerid][p_tableid], inv_slots{playerid}+1);
    443. }
    444. }
    445. }
    446. }
    447. GivePlayerWeapon(playerid, WEAPON_COLT45, val);
    448. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из кобуры Colt45 и взяли его в руки.");
    449. //PC_EmulateCommand(playerid, "/me достал из кобуры Colt45 и взял его в руки.");
    450. return true;
    451. }
    452. case INVENT_WEAPON_SPAS12:
    453. {
    454. GetPlayerWeaponData(playerid, 3, weaponid, ammo);
    455. switch(weaponid)
    456. {
    457. case WEAPON_SHOTGSPA:
    458. {
    459. GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, ammo+val);
    460. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из чехла Spas12 и взяли его в руки.");
    461. //PC_EmulateCommand(playerid, "/me достал из чехла Spas12 и взял его в руки.");
    462. switch(inv[playerid][select_slot{playerid}][i_amount])
    463. {
    464. case 0:
    465. {
    466. for(new i = select_slot{playerid}; i < inv_slots{playerid}; i++)
    467. {
    468. inv[playerid][i][i_item] = inv[playerid][i+1][i_item];
    469. inv[playerid][i][i_amount] = inv[playerid][i+1][i_amount];
    470. format(string, sizeof(string),
    471. "UPDATE `inventory` SET `itemid` = '%d' AND `amountid` = '%d' WHERE `ownertableid` = '%d' AND\
    472. `slotid` = '%d'", inv[playerid][i][i_item], inv[playerid][i][i_amount],
    473. player[playerid][p_tableid], i);
    474. mysql_function_query(connect_mysql, string, false, "", "");
    475. inv_slots{playerid}--;
    476. }
    477. return true;
    478. }
    479. default:
    480. {
    481. format(string, sizeof(string),
    482. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    483. inv[playerid][select_slot{playerid}][i_amount], player[playerid][p_tableid], select_slot{playerid});
    484. mysql_function_query(connect_mysql, string, false, "", "");
    485. return true;
    486. }
    487. }
    488. }
    489. case WEAPON_SHOTGUN:
    490. {
    491. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    492. {
    493. // throw
    494. return true;
    495. }
    496. new
    497. __check = 0;
    498. for(new i = 0; i < inv_slots{playerid}; i++)
    499. {
    500. if(inv[playerid][i][i_item] == INVENT_WEAPON_SHOTGUN)
    501. {
    502. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    503. format(string, sizeof(string),
    504. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    505. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    506. __check = 1;
    507. }
    508. }
    509. if(__check == 0)
    510. {
    511. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_SHOTGUN;
    512. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    513. format(string, sizeof(string),
    514. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    515. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    516. player[playerid][p_tableid], inv_slots{playerid}+1);
    517. }
    518. }
    519. }
    520. GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, val);
    521. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из чехла Spas12 и взяли его в руки.");
    522. //PC_EmulateCommand(playerid, "/me достал из чехла Spas12 и взял его в руки.");
    523. return true;
    524. }
    525. case INVENT_WEAPON_SILENCED_COLT45:
    526. {
    527. GetPlayerWeaponData(playerid, 2, weaponid, ammo);
    528. switch(weaponid)
    529. {
    530. case WEAPON_SILENCED:
    531. {
    532. GivePlayerWeapon(playerid, WEAPON_SILENCED, ammo+val);
    533. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из кобуры Colt45 и взяли его в руки.");
    534. //PC_EmulateCommand(playerid, "/me достал из кобуры Colt45 и взял его в руки.");
    535. switch(inv[playerid][select_slot{playerid}][i_amount])
    536. {
    537. case 0:
    538. {
    539. for(new i = select_slot{playerid}; i < inv_slots{playerid}; i++)
    540. {
    541. inv[playerid][i][i_item] = inv[playerid][i+1][i_item];
    542. inv[playerid][i][i_amount] = inv[playerid][i+1][i_amount];
    543. format(string, sizeof(string),
    544. "UPDATE `inventory` SET `itemid` = '%d' AND `amountid` = '%d' WHERE `ownertableid` = '%d' AND\
    545. `slotid` = '%d'", inv[playerid][i][i_item], inv[playerid][i][i_amount],
    546. player[playerid][p_tableid], i);
    547. mysql_function_query(connect_mysql, string, false, "", "");
    548. inv_slots{playerid}--;
    549. }
    550. return true;
    551. }
    552. default:
    553. {
    554. format(string, sizeof(string),
    555. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    556. inv[playerid][select_slot{playerid}][i_amount], player[playerid][p_tableid], select_slot{playerid});
    557. mysql_function_query(connect_mysql, string, false, "", "");
    558. return true;
    559. }
    560. }
    561. }
    562. case WEAPON_DEAGLE:
    563. {
    564. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    565. {
    566. // throw
    567. return true;
    568. }
    569. new
    570. __check = 0;
    571. for(new i = 0; i < inv_slots{playerid}; i++)
    572. {
    573. if(inv[playerid][i][i_item] == INVENT_WEAPON_DEAGLE)
    574. {
    575. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    576. format(string, sizeof(string),
    577. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    578. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    579. __check = 1;
    580. }
    581. }
    582. if(__check == 0)
    583. {
    584. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_DEAGLE;
    585. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    586. format(string, sizeof(string),
    587. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    588. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    589. player[playerid][p_tableid], inv_slots{playerid}+1);
    590. }
    591. }
    592. case WEAPON_COLT45:
    593. {
    594. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    595. {
    596. // throw
    597. return true;
    598. }
    599. new
    600. __check = 0;
    601. for(new i = 0; i < inv_slots{playerid}; i++)
    602. {
    603. if(inv[playerid][i][i_item] == INVENT_WEAPON_COLT45)
    604. {
    605. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    606. format(string, sizeof(string),
    607. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    608. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    609. __check = 1;
    610. }
    611. }
    612. if(__check == 0)
    613. {
    614. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_COLT45;
    615. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    616. format(string, sizeof(string),
    617. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    618. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    619. player[playerid][p_tableid], inv_slots{playerid}+1);
    620. }
    621. }
    622. }
    623. GivePlayerWeapon(playerid, WEAPON_COLT45, val);
    624. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из кобуры Silenced Colt45 и взяли его в руки.");
    625. //PC_EmulateCommand(playerid, "/me достал из кобуры Silenced Colt45 и взял его в руки.");
    626. return true;
    627. }
    628. case INVENT_WEAPON_GRENADE:
    629. {
    630. return true;
    631. }
    632. case INVENT_WEAPON_MOLOTOV:
    633. {
    634. return true;
    635. }
    636. case INVENT_WEAPON_TEC9:
    637. {
    638. return true;
    639. }
    640. case INVENT_WEAPON_UZI:
    641. {
    642. return true;
    643. }
    644. case INVENT_WEAPON_MP5:
    645. {
    646. return true;
    647. }
    648. case INVENT_WEAPON_RIFLE:
    649. {
    650. return true;
    651. }
    652. case INVENT_WEAPON_SNIPER:
    653. {
    654. return true;
    655. }
    656. }
    657. switch(inv[playerid][i][i_amount])
    658. {
    659. case 0:
    660. {
    661. for(new i = select_slot{playerid}; i < inv_slots{playerid}; i++)
    662. {
    663. inv[playerid][i][i_item] = inv[playerid][i+1][i_item];
    664. inv[playerid][i][i_amount] = inv[playerid][i+1][i_amount];
    665. format(string, sizeof(string),
    666. "UPDATE `inventory` SET `itemid` = '%d' AND `amountid` = '%d' WHERE `ownertableid` = '%d' AND\
    667. `slotid` = '%d'", inv[playerid][i][i_item], inv[playerid][i][i_amount],
    668. player[playerid][p_tableid], i);
    669. mysql_function_query(connect_mysql, string, false, "", "");
    670. inv_slots{playerid}--;
    671. }
    672. }
    673. default:
    674. {
    675. inv[playerid][select_slot{playerid}][i_amount]-=val;
    676. format(string, sizeof(string),
    677. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    678. inv[playerid][select_slot{playerid}][i_amount], player[playerid][p_tableid],
    679. select_slot{playerid});
    680. mysql_function_query(connect_mysql, string, false, "", "");
    681. }
    682. }
    683. return true;
    684. }


    Путем нехитрых действий (комментирование) я выяснил, что из-за этого куска кода при компиляции возникает ошибка:

    Could not run pawncc: Unknown error (3221225477)

    Стандартный pawno.exe просто крашится.

  2. #2
    Аватар для Daniel_Cortez
    "Это не хак, это фича"

    Статус
    Оффлайн
    Регистрация
    06.04.2013
    Адрес
    Novokuznetsk, Russia
    Сообщений
    2,192
    Репутация:
    2590 ±
    А поконкретнее можно? Например, какая именно из этих 600+ строк приводит к падению?
    Или хотя бы такой отрывок кода, который можно было бы скомпилировать самостоятельно (т.е. без привязки к моду, без ошибок из-за необъявленных переменных/констант/функций в "вырезанном" коде, и т.п.)? Мне нужен минималный пример, чтобы разобраться, из-за чего именно происходит краш.
    Индивидуально в ЛС по скриптингу не помогаю. Задавайте все свои вопросы здесь (click).

  3. #3
    Аватар для SteveStage
    Пользователь

    Статус
    Оффлайн
    Регистрация
    05.10.2019
    Адрес
    Планета Земля
    Сообщений
    318
    Репутация:
    7 ±
    Цитата Сообщение от Daniel_Cortez Посмотреть сообщение
    А поконкретнее можно? Например, какая именно из этих 600+ строк приводит к падению?
    Или хотя бы такой отрывок кода, который можно было бы скомпилировать самостоятельно (т.е. без привязки к моду, без ошибок из-за необъявленных переменных/констант/функций в "вырезанном" коде, и т.п.)? Мне нужен минималный пример, чтобы разобраться, из-за чего именно происходит краш.
    Вот кейс, при комментировании которого ошибка компилятора пропадает:

    1. case INVENT_WEAPON_COLT45:
    2. {
    3. GetPlayerWeaponData(playerid, 2, weaponid, ammo);
    4. switch(weaponid)
    5. {
    6. case WEAPON_COLT45:
    7. {
    8. GivePlayerWeapon(playerid, WEAPON_COLT45, ammo+val);
    9. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из кобуры Colt45 и взяли его в руки.");
    10. //PC_EmulateCommand(playerid, "/me достал из кобуры Colt45 и взял его в руки.");
    11. switch(inv[playerid][select_slot{playerid}][i_amount])
    12. {
    13. case 0:
    14. {
    15. for(new i = select_slot{playerid}; i < inv_slots{playerid}; i++)
    16. {
    17. inv[playerid][i][i_item] = inv[playerid][i+1][i_item];
    18. inv[playerid][i][i_amount] = inv[playerid][i+1][i_amount];
    19. format(string, sizeof(string),
    20. "UPDATE `inventory` SET `itemid` = '%d' AND `amountid` = '%d' WHERE `ownertableid` = '%d' AND\
    21. `slotid` = '%d'", inv[playerid][i][i_item], inv[playerid][i][i_amount],
    22. player[playerid][p_tableid], i);
    23. mysql_function_query(connect_mysql, string, false, "", "");
    24. inv_slots{playerid}--;
    25. }
    26. return true;
    27. }
    28. default:
    29. {
    30. format(string, sizeof(string),
    31. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    32. inv[playerid][select_slot{playerid}][i_amount], player[playerid][p_tableid], select_slot{playerid});
    33. mysql_function_query(connect_mysql, string, false, "", "");
    34. return true;
    35. }
    36. }
    37. }
    38. case WEAPON_DEAGLE:
    39. {
    40. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    41. {
    42. // throw
    43. return true;
    44. }
    45. new
    46. __check = 0;
    47. for(new i = 0; i < inv_slots{playerid}; i++)
    48. {
    49. if(inv[playerid][i][i_item] == INVENT_WEAPON_DEAGLE)
    50. {
    51. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    52. format(string, sizeof(string),
    53. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    54. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    55. __check = 1;
    56. }
    57. }
    58. if(__check == 0)
    59. {
    60. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_DEAGLE;
    61. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    62. format(string, sizeof(string),
    63. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    64. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    65. player[playerid][p_tableid], inv_slots{playerid}+1);
    66. }
    67. }
    68. case WEAPON_SILENCED:
    69. {
    70. if(inv_slots{playerid}+1 >= MAX_INVENT_SLOTS)
    71. {
    72. // throw
    73. return true;
    74. }
    75. new
    76. __check = 0;
    77. for(new i = 0; i < inv_slots{playerid}; i++)
    78. {
    79. if(inv[playerid][i][i_item] == INVENT_WEAPON_SILENCED_COLT45)
    80. {
    81. inv[playerid][i][i_amount] += inv[playerid][inv_slots{playerid}][i_amount];
    82. format(string, sizeof(string),
    83. "UPDATE `inventory` SET `amountid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    84. inv[playerid][i][i_amount], player[playerid][p_tableid], i);
    85. __check = 1;
    86. }
    87. }
    88. if(__check == 0)
    89. {
    90. inv[playerid][inv_slots{playerid}+1][i_item] = INVENT_WEAPON_SILENCED_COLT45;
    91. inv[playerid][inv_slots{playerid}+1][i_amount] = ammo;
    92. format(string, sizeof(string),
    93. "UPDATE `inventory` SET `amountid` = '%d' AND `itemid` = '%d' WHERE `ownertableid` = '%d' AND `slotid` = '%d'",
    94. inv[playerid][inv_slots{playerid}+1][i_amount], inv[playerid][inv_slots{playerid}+1][i_item],
    95. player[playerid][p_tableid], inv_slots{playerid}+1);
    96. }
    97. }
    98. }
    99. }
    100. GivePlayerWeapon(playerid, WEAPON_COLT45, val);
    101. SCM(playerid, COLOR_YELLOW, !"[SERVER] Вы достали из кобуры Colt45 и взяли его в руки.");
    102. //PC_EmulateCommand(playerid, "/me достал из кобуры Colt45 и взял его в руки.");
    103. return true;
    104. }


    И вот все используемые в этом кейсе переменные и массивы:

     ЛОКАЛЬНО

    1. new
    2. string[128+1],
    3. weaponid = 0,
    4. ammo = 0;


    1. new
    2. val = strval(inputtext);


     ГЛОБАЛЬНО

    1. enum
    2. {
    3. INVENT_ITEM_NONE = 0, INVENT_ITEM_BURGER = 1, INVENT_ITEM_PEPSI = 2, INVENT_WEAPON_DEAGLE, INVENT_WEAPON_SHOTGUN, INVENT_WEAPON_M4A1, INVENT_WEAPON_AK47,
    4. INVENT_WEAPON_BAT, INVENT_WEAPON_COLT45, INVENT_WEAPON_SPAS12, INVENT_WEAPON_SILENCED_COLT45, INVENT_WEAPON_GOLFCLUB, INVENT_WEAPON_NITESTICK,
    5. INVENT_WEAPON_KNIFE, INVENT_WEAPON_CHAINSAW, INVENT_WEAPON_FLOWER, INVENT_WEAPON_CANE, INVENT_WEAPON_GRENADE, INVENT_WEAPON_MOLOTOV, INVENT_WEAPON_TEC9,
    6. INVENT_WEAPON_UZI, INVENT_WEAPON_MP5, INVENT_WEAPON_RIFLE, INVENT_WEAPON_SNIPER
    7. };


    1. enum e_INVENTORY_DATA
    2. {
    3. i_item, i_amount
    4. }
    5. new
    6. inv[MAX_PLAYERS][MAX_INVENT_SLOTS][e_INVENTORY_DATA];


    1. new
    2. inv_slots[MAX_PLAYERS char],
    3. select_slot[MAX_PLAYERS char];


    1. #define MAX_INVENT_SLOTS 7


    UPD: я нашел причину, и вы не угадаете, в чем она заключается=)

    Ответ:

    }
    }
    GivePlayerWeapon(playerid, WEAPON_COLT45, val);
    Да да, такие тупые ошибки НА 1 СИМВОЛ способны крашнуть компилятор.
    И я не 1 раз замечаю такое, вот например: https://vk.cc/atkxqC

    Извините за невнимательность.

    И я все таки хотел бы узнать причину, по которой вместо ерроров и варнингов компилятор крашит.
    Последний раз редактировалось SteveStage; 27.04.2020 в 21:29.

 

 

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •