Share code game bài cào cool

2 bài đăng
10.07.2016 / 09:16
mad
Bài đăng: 2434
Member
Nhào vô cắn tao đi, tao sợ mày à cắn bừa.
TWIG
  1. <script src="/files/1043097/jquery.js"></script>
  2. <script src="/files/1091621/cookies.js"></script>
  3. <script>
  4. $(function(){
  5. var size,game=0,ref='main.php?id=ch_topic_h&uid=225683';
  6. function coinRun(){
  7. coin=parseInt(getCookie('tien'))*1;
  8. $('#MAD_coin').html(coin);
  9. }
  10. coinRun();
  11. var photo='{{api.u.get(api.user_id).profilephotourl}}';
  12. //System game
  13. if(coin==0 || !coin){
  14. setCookie('tien',1500,3600);
  15. coinRun();
  16. }
  17. screenWidth=window.screen.width;
  18. screenHeight=window.screen.height;
  19. $('#MAD_screen').html(screenWidth+' x '+screenHeight);
  20. if(screenWidth<1366 && screenHeight<768){
  21. size='Phone';
  22. if(screenWidth>240 && screenHeight>240){
  23. var returnValue = confirm("Nhấn ok để chuyển sang chế độ vừa màn hình để tránh bị khuất hoặc xoay màn hình thủ công nếu không được");
  24.  
  25. if(returnValue == true)
  26. {
  27. $('html').attr('style','-webkit-transform: rotate(450deg);-moz-transform: rotate(450deg);-ms-transform: rotate(450deg);transform: rotate(450deg);width: 100%;height: 100%;')
  28. }
  29. }
  30. }else{
  31. size='PC';
  32. }
  33.  
  34. //Start Game function
  35. $('body').attr('style','padding:0px;margin:0px;')
  36. if(size=='Phone'){
  37. $('#MAD_html').attr('style','padding:0px; margin:0px; background:#940800;cursor: default; zoom:0.7;position:fixed;top:-100px;left:-100px;right:-100px;bottom:-100px;');
  38. }else{
  39. $('#MAD_html').attr('style','padding:0px; margin:0px; background:#940800;cursor: default;position:fixed;top:-100px;left:-100px;right:-100px;bottom:-100px;');
  40. }
  41. $('#MAD_body').attr('style','background-image:url("files/1043097/bgs.png"); -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;position:fixed;top:0px;left:0px;right:0px;bottom:0px;');
  42. $('#MAD_main').attr('style','max-width:620px;height:100%;margin:auto;');
  43. $('#MAD_exit').attr('style','background-image:url("files/1043097/exits.png");width: 105px;height:40px;border-radius: 5px;box-shadow: 0px 0px 7px 1px #000, 0px 0px 5px 0px #000 inset; cursor: pointer;z-index: 1;position: absolute;top: 10px;');
  44. $('#MAD_table').attr('style','background-image: url("files/1043097/tables.png"); width: 620px;height: 276px; position: absolute; left: 50%; top: 50%; margin-top: -138px; margin-left: -310px;box-shadow: 0px 0px 10px 1px #000,0px 0px 10px 1px #000 inset;border-radius: 10px;');
  45. $('#MAD_robot').attr('style','background-image: url("files/1043097/robots.png"); width: 92px;height: 111px; position: absolute;top: -40px;left: 50%;margin-left: -55px;border-radius: 12px;box-shadow: 0px 0px 5px 0px #000, 0px 0px 10px 0px #000 inset;');
  46. $('#MAD_robota').attr('style','background-image: url("files/1043097/robots.png"); width: 92px;height: 111px; position: absolute;top: 25%;left: 2%;margin-left: -55px;border-radius: 12px;box-shadow: 0px 0px 5px 0px #000, 0px 0px 10px 0px #000 inset;');
  47. $('#MAD_robotb').attr('style','background-image: url("files/1043097/robots.png"); width: 92px;height: 111px; position: absolute;top: 25%;left: 100%;margin-left: -55px;border-radius: 12px;box-shadow: 0px 0px 5px 0px #000, 0px 0px 10px 0px #000 inset;');
  48. $('#MAD_user').attr('style','background-image: url("files/1043097/robots.png"); width: 92px;height: 111px; position: absolute;top: 70%;left: 50%;margin-left: -55px;border-radius: 12px;box-shadow: 0px 0px 5px 0px #000, 0px 0px 10px 0px #000 inset;');
  49. $('#MAD_screen').attr('style','background: rgba(255, 255, 255, 0.5);right:0px;top:0px;position: absolute;color: #000;padding: 2px 5px;font-family: monospace;');
  50. $('#MAD_name_robot,#MAD_name_user,#MAD_name_robota,#MAD_name_robotb').attr('style','margin-top: 95%;color: #FFC107;font-weight: bold;font-family: cursive;text-align: center;text-shadow: 0px 0px 1px #7D7C25;');
  51. $('#MAD_name_nhacai').attr('style','color: red;font-weight: bold;font-family: cursive;position: absolute;text-align: center;left: 15px;text-shadow: 0px 0px 2px #FF1515;');
  52. $('#MAD_card_user').attr('style','margin-top: -90px;margin-left: 100px;color: #FFC107;font-weight: bold;font-family: cursive;text-align: center;text-shadow: 0px 0px 1px #7D7C25;width:140px');
  53. $('#MAD_card_robot').attr('style','margin-top: -90px;margin-left: -150px;color: #FFC107;font-weight: bold;font-family: cursive;text-align: center;text-shadow: 0px 0px 1px #7D7C25;width:140px;');
  54. $('#MAD_card_robot').attr('style','margin-top: -90px;margin-left: -150px;color: #FFC107;font-weight: bold;font-family: cursive;text-align: center;text-shadow: 0px 0px 1px #7D7C25;width:140px;');
  55. $('#MAD_card_robota').attr('style','margin-top: -60px;margin-left: 100px;color: #FFC107;font-weight: bold;font-family: cursive;text-align: center;text-shadow: 0px 0px 1px #7D7C25;width:140px;');
  56. $('#MAD_card_robotb').attr('style','margin-top: -60px;margin-left: -150px;color: #FFC107;font-weight: bold;font-family: cursive;text-align: center;text-shadow: 0px 0px 1px #7D7C25;width:140px;');
  57. $('#MAD_chat_user').attr('style','margin-top: -90px;margin-left: -150px;color: #FFC107;font-weight: bold;font-family: cursive;text-align: center;text-shadow: 0px 0px 1px #7D7C25;width:140px;text-align:right;');
  58. $('#MAD_chat_robot').attr('style','margin-top: -50px;margin-left: 100px;color: #FFC107;font-weight: bold;font-family: cursive;text-align: center;text-shadow: 0px 0px 1px #7D7C25;width:140px;text-align:left;');
  59. $('#MAD_chat_robota').attr('style','margin-top: -100px;margin-left: 100px;color: #FFC107;font-weight: bold;font-family: cursive;text-align: center;text-shadow: 0px 0px 1px #7D7C25;width:140px;text-align:left;');
  60. $('#MAD_chat_robotb').attr('style','margin-top: -100px;margin-left: -120px;color: #FFC107;font-weight: bold;font-family: cursive;text-align: center;text-shadow: 0px 0px 1px #7D7C25;width:140px;text-align:left;');
  61. $('#MAD_start_game').attr('style','position: absolute;left: 50%;top: 50%;width: 220px;margin-left: -110px; margin-top: -20px;');
  62. $('#MAD_lose_game,#MAD_win_game,#MAD_hoa_game').attr('style','position: absolute; left: 50%; top: 50%; width: 220px; margin-left: -110px; margin-top: -20px; text-align: center;font-size: 30px;font-weight: bold;color: #FF5722;background: #fff;border-radius: 30px;display:none;');
  63. $('#MAD_start').attr('style','background: -webkit-linear-gradient(#EDD23C, #CDB000);padding: 8px 20px 6px 20px;font-family: sans-serif;font-weight: bold;color: #533B05;border: 1px solid #55490C;display: inline-block;border-radius: 3px;box-shadow: 0px 1px 0px 0px #FFEE95 inset, 0px 1px 1px 0px #5B4F00;text-shadow: 0px 1px 0px #F5ECC3;cursor: pointer;outline: 0px;text-transform: uppercase;margin: 3px 0px;');
  64. $('#MAD_coin_select').attr('style','width: 120px;background: -webkit-linear-gradient(#EDD23C, #CDB000);padding: 9px 20px 6px 20px;font-family: sans-serif;font-weight: bold;color: #533B05;border: 1px solid #55490C;display: inline-block;border-radius: 3px;box-shadow: 0px 1px 0px 0px #FFEE95 inset, 0px 1px 1px 0px #5B4F00;text-shadow: 0px 1px 0px #F5ECC3;cursor: pointer;outline: 0px;text-transform: uppercase;margin: 3px 2px;');
  65. $('#MAD_coin').attr('style','background: url("files/1067753/money.png") left center no-repeat;position: absolute;font-size: 16px;font-family: monospace;padding: 1px 1px 1px 15px;border-radius: 4px;top:0px;color: #FFED00;font-weight: bold;text-shadow: 0px 0px 1px #956204;');
  66.  
  67. //Program
  68. $('#MAD_name_robot').html('OscarPham');
  69. $('#MAD_name_user').html('[nick]');
  70. $('#MAD_photo_user').attr('style','background: url("'+photo+'");width: 83px;height: 72px;position: absolute;top: 20px;left: 4px;background-size: 100%;box-shadow: 0px 0px 23px 0px #7E877A inset; border-radius: 12px;');
  71.  
  72. //Play
  73. $('#MAD_start').click(function(){
  74. coinVal=parseInt($('#MAD_coin_select').val());
  75. if(coin-coinVal>=0){
  76. $('#MAD_start_game').hide();
  77.  
  78. var names=['A','2','3','4','5','6','7','8','9','10'];
  79. var vars=['C','H','D','S'];
  80. var card1a=Math.floor((Math.random() * 9)+1);
  81. var card2a=Math.floor((Math.random() * 9)+1);
  82. var card3a=Math.floor((Math.random() * 9)+1);
  83. var card1b=Math.floor((Math.random() * 9)+1);
  84. var card2b=Math.floor((Math.random() * 9)+1);
  85. var card3b=Math.floor((Math.random() * 9)+1);
  86. var card1c=Math.floor((Math.random() * 9)+1);
  87. var card2c=Math.floor((Math.random() * 9)+1);
  88. var card3c=Math.floor((Math.random() * 9)+1);
  89. var card1d=Math.floor((Math.random() * 9)+1);
  90. var card2d=Math.floor((Math.random() * 9)+1);
  91. var card3d=Math.floor((Math.random() * 9)+1);
  92. var robotdiem=(10+card1b+card2b+card3b);
  93. var robotadiem=(10+card1c+card2c+card3c);
  94. var robotbdiem=(10+card1d+card2d+card3d);
  95. var userdiem=(10+card1a+card2a+card3a);
  96.  
  97.  
  98. setTimeout(function(){
  99. $('#MAD_card_robot').append('<img src="files/1043097/'+(names[card1b-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  100. setTimeout(function(){
  101. $('#MAD_card_robota').append('<img src="files/1043097/'+(names[card1c-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  102. setTimeout(function(){
  103. $('#MAD_card_user').append('<img src="files/1043097/'+(names[card1a-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  104. setTimeout(function(){
  105. $('#MAD_card_robotb').append('<img src="files/1043097/'+(names[card1d-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  106.  
  107. setTimeout(function(){
  108. $('#MAD_card_robot').append('<img src="files/1043097/'+(names[card2b-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  109. setTimeout(function(){
  110. $('#MAD_card_robota').append('<img src="files/1043097/'+(names[card2c-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  111. setTimeout(function(){
  112. $('#MAD_card_user').append('<img src="files/1043097/'+(names[card2a-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  113. setTimeout(function(){
  114. $('#MAD_card_robotb').append('<img src="files/1043097/'+(names[card2d-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  115.  
  116. setTimeout(function(){
  117. $('#MAD_card_robot').append('<img src="files/1043097/'+(names[card3b-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  118. setTimeout(function(){
  119. $('#MAD_card_robota').append('<img src="files/1043097/'+(names[card3c-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  120. setTimeout(function(){
  121. $('#MAD_card_user').append('<img src="files/1043097/'+(names[card3a-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  122. setTimeout(function(){
  123. $('#MAD_card_robotb').append('<img src="files/1043097/'+(names[card3d-1])+vars[Math.floor((Math.random()*4))]+'.jpg" style="box-shadow: 0px 0px 5px 0px #000;border-radius: 6px;">');
  124.  
  125. //count
  126. setTimeout(function(){
  127. $('#MAD_chat_robot').html((robotdiem+'').substr(1,1)+' điểm');
  128. setTimeout(function(){
  129. $('#MAD_chat_robota').html((robotadiem+'').substr(1,1)+' điểm');
  130. setTimeout(function(){
  131. $('#MAD_chat_user').html((userdiem+'').substr(1,1)+' điểm');
  132. setTimeout(function(){
  133. $('#MAD_chat_robotb').html((robotbdiem+'').substr(1,1)+' điểm');
  134. setTimeout(function(){
  135. $('#MAD_chat_robot').html('');
  136. setTimeout(function(){
  137. $('#MAD_chat_robota').html('');
  138. setTimeout(function(){
  139. $('#MAD_chat_user').html('');
  140. setTimeout(function(){
  141. $('#MAD_chat_robotb').html('');
  142.  
  143. //This Win or Lose
  144. setTimeout(function(){
  145. if((userdiem+'').substr(1,1)>(robotdiem+'').substr(1,1)){
  146. $('#MAD_win_game').show();
  147. setTimeout(function(){
  148. $('#MAD_win_game').hide();
  149. $('#MAD_chat_user').html('Yeah! Lại thêm '+coinVal+' xu nữa!');
  150. setTimeout(function(){
  151. $('#MAD_chat_user').html('');
  152. endgame();
  153. $.post(ref,{text:' Đã thắng trong [a=/main.php?f=3444759&game=baicao]Game bài cào[/a]! (+'+coinVal+' xu)'});
  154. setCookie('tien',parseInt(coin)+parseInt(coinVal),3600);
  155. },1500);
  156. },2000);
  157. }else if((userdiem+'').substr(1,1)<(robotdiem+'').substr(1,1)){
  158. $('#MAD_lose_game').show();
  159. setTimeout(function(){
  160. $('#MAD_lose_game').hide();
  161. $('#MAD_chat_user').html('Huhuhu! Mất '+coinVal+' xu rồi!');
  162. setTimeout(function(){
  163. $('#MAD_chat_user').html('');
  164. endgame();
  165. $.post(ref,{text:'Đã thua trong game bài cào[a=/main.php?f=3444759&game=baicao^]Game bài cào[/a] ! (-'+coinVal+' xu)'});
  166. setCookie('tien',parseInt(coin)-parseInt(coinVal),3600);
  167. },1500);
  168. },2000);
  169. }else{
  170. $('#MAD_hoa_game').show();
  171. setTimeout(function(){
  172. $('#MAD_hoa_game').hide();
  173. $('#MAD_chat_user').html('Hòa rồi!');
  174. setTimeout(function(){
  175. $('#MAD_chat_user').html('');
  176. endgame();
  177. },1500);
  178. },2000);
  179. }
  180.  
  181.  
  182. if((robotadiem+'').substr(1,1)>(robotdiem+'').substr(1,1)){
  183. setTimeout(function(){
  184. $('#MAD_chat_robota').html('Yeah! Lại thêm 5000 xu nữa!');
  185. setTimeout(function(){
  186. $('#MAD_chat_robota').html('');
  187. },1500);
  188. },2000);
  189. }else if((robotadiem+'').substr(1,1)<(robotdiem+'').substr(1,1)){
  190. setTimeout(function(){
  191. $('#MAD_chat_robota').html('Huhuhu! Mất 5000 xu rồi!');
  192. setTimeout(function(){
  193. $('#MAD_chat_robota').html('');
  194. endgame();
  195. },1500);
  196. },2000);
  197. }else{
  198. setTimeout(function(){
  199. $('#MAD_chat_robota').html('Hòa rồi!');
  200. setTimeout(function(){
  201. $('#MAD_chat_robota').html('');
  202. endgame();
  203. },1500);
  204. },1000);
  205. }
  206.  
  207. if((robotbdiem+'').substr(1,1)>(robotdiem+'').substr(1,1)){
  208. setTimeout(function(){
  209. $('#MAD_chat_robotb').html('Yeah! Lại thêm 10000 xu nữa!');
  210. setTimeout(function(){
  211. $('#MAD_chat_robotb').html('');
  212. },1500);
  213. },2000);
  214. }else if((robotbdiem+'').substr(1,1)<(robotdiem+'').substr(1,1)){
  215. setTimeout(function(){
  216. $('#MAD_chat_robotb').html('Huhuhu! Mất 5000 xu rồi!');
  217. setTimeout(function(){
  218. $('#MAD_chat_robotb').html('');
  219. endgame();
  220. },1500);
  221. },2000);
  222. }else{
  223. setTimeout(function(){
  224. $('#MAD_chat_robotb').html('Hòa rồi!');
  225. setTimeout(function(){
  226. $('#MAD_chat_robotb').html('');
  227. endgame();
  228. },1500);
  229. },2000);
  230. }
  231. })
  232.  
  233. },1000);
  234. },1000);
  235. },1000);
  236. },1000);
  237. },1000);
  238. },1000);
  239. },1000);
  240. },1000);
  241.  
  242. },700);
  243. },700);
  244. },700);
  245. },700);
  246. },700);
  247. },700);
  248. },700);
  249. },700);
  250. },700);
  251. },700);
  252. },700);
  253. },700);
  254.  
  255.  
  256.  
  257. }else{
  258. alert('Số dư của bạn không đủ!'+(coin-coinVal));
  259. coinRun();
  260. }
  261. });
  262. function endgame(){
  263. $('#MAD_card_user').html('');
  264. $('#MAD_card_robot').html('');
  265. $('#MAD_card_robota').html('');
  266. $('#MAD_card_robotb').html('');
  267. $('#MAD_start_game').show();
  268. coinRun();
  269. }
  270. $('#MAD_exit').click(function(){
  271. location='main.php?f=3444759';
  272. })
  273. })
  274. </script>
  275. <div id="MAD_html">
  276. <div id="MAD_body">
  277. <div id="MAD_main">
  278. <div id="MAD_exit">
  279. </div>
  280. <div id="MAD_table">
  281. <div id="MAD_robot">
  282. <div id="MAD_name_nhacai">Nhà cái</div>
  283. <div id="MAD_name_robot"></div>
  284. <div id="MAD_card_robot"></div>
  285. <div id="MAD_chat_robot"></div>
  286. </div>
  287. <div id="MAD_robota">
  288. <div id="MAD_name_robota">Bim</div>
  289. <div id="MAD_card_robota"></div>
  290. <div id="MAD_chat_robota">Đánh đi! HEHEHE</div>
  291. </div>
  292. <div id="MAD_robotb">
  293. <div id="MAD_name_robotb">Root</div>
  294. <div id="MAD_card_robotb"></div>
  295. <div id="MAD_chat_robotb">Chơi thêm ván nữa! Haiz</div>
  296. </div>
  297. <div id="MAD_start_game"><select id="MAD_coin_select"><option value="1000">1000</option><option value="2000">2000</option><option value="5000">5000</option><option value="10000">10000</option></select><div id="MAD_start">Start</div></div>
  298. <div id="MAD_lose_game">Thua Rồi</div>
  299. <div id="MAD_hoa_game">Hòa Rồi</div>
  300. <div id="MAD_win_game">Thắng Rồi</div>
  301. <div id="MAD_user">
  302. <div id="MAD_photo_user"></div>
  303. <div id="MAD_name_user"></div>
  304. <div id="MAD_card_user"></div>
  305. <div id="MAD_chat_user"></div>
  306. <div id="MAD_coin"></div>
  307. </div>
  308. </div>
  309. </div>
  310.  
  311. <div id="MAD_screen"></div>
  312. </div>
  313. </div>

Cái này thêm vào twig nhé

Dòng thứ 5 các bạn thay ref='main.php?id=ch_topic_h&uid=225683'; thành shoutbox wap bạn là có thể báo ra trang sb rồi.

cái này sử dụng với 2 game kia(cùng tiền lun nhé).

Share game bầu cua, chuẩn đẹp trai share game nông trại

10.07.2016 / 09:31
Windyluck
Bài đăng: 302
Member

:kul: