Advertisement
alwinto

tes

Jun 18th, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.02 KB | None | 0 0
  1. public OnPlayerSpawn(playerid)
  2. {
  3. CheckPlayerFlood(playerid, true, MAX_FLOOD_RATE, 500, FLOOD_RATE_KICK);
  4. killer_id[playerid] = INVALID_PLAYER_ID;
  5. pDialog [ playerid ] = false ;
  6.  
  7. if(PlayerInfo[playerid][pSkin] == -1) return SkinChar(playerid);
  8.  
  9. if(PlayerInfo[playerid][pLogin] != 1) return KickD(playerid, "Anda harus masuk untuk memulai permainan!");
  10.  
  11. loop_animacija[playerid] = 0;
  12. isAnimating[playerid] = 0;
  13. if(gPlayerUsingLoopingAnim[playerid])
  14. {
  15. gPlayerUsingLoopingAnim[playerid] = 0;
  16. }
  17.  
  18. TogglePlayerControllable(playerid, false);
  19. SetTimerEx("ClearFreeze", 4000, false, "d", playerid);
  20.  
  21.  
  22. if(player_bag[playerid])
  23. {
  24. player_bag[playerid] = false;
  25. TextDrawHideForPlayer(playerid, black_display[playerid]);
  26. }
  27.  
  28. player_gag[playerid] = false;
  29.  
  30. if(player_tie[playerid])
  31. {
  32. TogglePlayerControllable(playerid, true);
  33. player_tie[playerid] = false;
  34. }
  35.  
  36. SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
  37.  
  38.  
  39. SafeSetPlayerHealth(playerid, 100);
  40.  
  41.  
  42. if(GetPVarInt(playerid, "LoginOgran") != -1) SetPVarInt(playerid, "LoginOgran", -1);
  43. LevelUpdate(playerid);
  44.  
  45.  
  46. SetPlayerToTeamColor(playerid);
  47. if(pTemp[playerid][pWork]) pTemp[playerid][pWork] = 0;
  48.  
  49. // 2. PERBAIKAN UTAMA: Ganti array lokal besar dengan buffer kecil
  50. if(PlayerInfo[playerid][pToggleJoinS] == 1)
  51. {
  52. // Format pesan
  53. new message[128];
  54. format(message, sizeof(message), ""COL_CLIENT"SERVER: "W"[%s] %s(%d) telah mendarat di kota",
  55. TimeStampp(), GetPlayerNameEx(playerid), playerid);
  56.  
  57. SendClientMessageToAll(-1, message);
  58.  
  59. }
  60.  
  61. if(PlayerInfo[playerid][pSpawnPertama] == 1)
  62. {
  63. ResetPlayerWeapons(playerid);
  64.  
  65. PlayerInfo[playerid][pPaydayTime] = 300;
  66.  
  67. // 1. Optimasi pembuatan satiety bar
  68. if(PlayerInfo[playerid][pToggleHBE] == 0)
  69. createSatiety(playerid);
  70. else if(PlayerInfo[playerid][pToggleHBE] == 1)
  71. createSatietyvDua(playerid);
  72.  
  73. SafeSetPlayerHealth(playerid, PlayerInfo[playerid][pHP]);
  74. SafeSetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
  75.  
  76.  
  77. // 3. Optimasi skin setting
  78. if(PlayerInfo[playerid][pMember] && PlayerInfo[playerid][pFrSkin])
  79. {
  80. SetPlayerSkinEx(playerid, PlayerInfo[playerid][pFrSkin]);
  81. form_fraction[playerid] = PlayerInfo[playerid][pMember];
  82. }
  83. else
  84. {
  85. SetPlayerSkinEx(playerid, PlayerInfo[playerid][pSkin]);
  86. form_fraction[playerid] = 0;
  87. }
  88.  
  89. if(PlayerInfo[playerid][pToggleFPS] == 0)
  90. {
  91. for(new i = 0; i < 5; i++)
  92. {
  93. TextDrawShowForPlayer(playerid, SHOWFPS[i]);
  94. }
  95.  
  96. for(new x = 0; x < 3; x++)
  97. {
  98. PlayerTextDrawShow(playerid, SHOWFPSDISPLAY[playerid][x]);
  99. }
  100. }
  101.  
  102. if(PlayerInfo[playerid][pAStaterpack] == 0)
  103. {
  104. for(new g; g < 5; g++) PlayerTextDrawShow(playerid, wargablmSP[playerid][g]);
  105. }
  106.  
  107. for(new z = 0; z < 3; z++)
  108. {
  109. PlayerTextDrawShow(playerid, PaydaytimeTD[playerid][z]);
  110. }
  111.  
  112. PlayerInfo[playerid][pHouseKey] = GetPlayerHouse(playerid);
  113.  
  114.  
  115. PlayerInfo[playerid][pSpawnPertama] = 0;
  116.  
  117. }
  118.  
  119. SetPlayerSpawn(playerid);
  120.  
  121. return 1;
  122. }
  123. stock SetPlayerSpawn(playerid)
  124. {
  125. if(GetPVarInt(playerid, "spawn_after_duel"))
  126. {
  127. SafeSetPlayerHealth(playerid, 100.0);
  128.  
  129. SetPPosEx(playerid, 2405.4067,-1470.8069,23.9574, 0.0, GetPlayerInterior(playerid), 0, false);
  130.  
  131. DeletePVar(playerid, "spawn_after_duel");
  132.  
  133. return 1;
  134. }
  135.  
  136. Iter_Add(SpectatePlayers, playerid);
  137.  
  138. foreach (new i : Player) {
  139. if (playerSpectateID[i] == playerid) {
  140. StartSpectateEx(i, playerid);
  141. }
  142. }
  143.  
  144. if(PlayerInfo[playerid][pPrison] > 0)
  145. {
  146. SetPPosEx(playerid, 277.6999,1410.9288,10.4308,88.5235, 0, 0, true);
  147. SetCameraBehindPlayer(playerid), ResetWeapons(playerid);
  148.  
  149.  
  150. for(new txd; txd < 31; txd++) {
  151. if(IsValidDynamicPlayerTextDraw(playerid, alwSpawnTD[playerid][txd])) {
  152. PlayerTextDrawDestroy(playerid, alwSpawnTD[playerid][txd]);
  153. }
  154. }
  155.  
  156. CancelSelectTextDraw(playerid);
  157. PlayerTextDrawShow(playerid, JAILTD[playerid][0]);
  158. return 1;
  159. }
  160.  
  161. if(PlayerInfo[playerid][pWanted] >= 1) SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pWanted]);
  162.  
  163. /*
  164. if(GetPVarInt(playerid, "player_leave_as"))
  165. {
  166. new shop_id = GetPVarInt(playerid, "player_leave_as") - 1;
  167.  
  168. SetPPos(playerid, as_exit_pos[shop_id][0], as_exit_pos[shop_id][1], as_exit_pos[shop_id][2], as_exit_pos[shop_id][3], 0, 0, true);
  169.  
  170. DeletePVar(playerid, "player_leave_as");
  171.  
  172. return 1;
  173. }
  174. */
  175.  
  176. if(PlayerInfo[playerid][pBugDeath] > 2)
  177. {
  178. TogglePlayerControllable(playerid, false);
  179. Showdeathtd(playerid, false);
  180. SafeSetPlayerHealth(playerid, 100.0);
  181. PlayerInfo[playerid][pDeathTime] = 0;
  182. PlayerInfo[playerid][pBugDeath] = 0;
  183. PlayerInfo[playerid][pBolnica] = 1;
  184.  
  185. SendInfoTD(playerid, "Anda tidak tersadar dan dibawa ke Rumah Sakit untuk perawatan");
  186.  
  187. SetPPosEx(playerid, 1155.3021, -1319.2183, 14.5067, 180.0000, 0, 0, true);
  188.  
  189. SetTimerEx("LoadPlayerWeapons", 1000, false, "i", playerid);
  190.  
  191.  
  192. return 1;
  193. }
  194.  
  195.  
  196. if(PlayerInfo[playerid][pDeathTime] > 0)
  197. {
  198. // PlayerInfo[playerid][pBugDeath] = 0;
  199.  
  200. PlayerTextDrawHide(playerid, Textdraw1[playerid]);
  201. SetPPosEx(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ], 0.0, PlayerInfo[playerid][pInt], PlayerInfo[playerid][pVirtual], false); // FBI
  202.  
  203. Showdeathtd(playerid, true);
  204. // SetPlayerPos(playerid, PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
  205.  
  206. ApplyAnimation(playerid, "WUZI", "CS_DEAD_GUY", 4.0, 0, 0, 0, 1, 0, 1);
  207. TogglePlayerControllable(playerid, true);
  208.  
  209. SafeSetPlayerHealth(playerid, 10000.0);
  210.  
  211. SetTimerEx("LoadPlayerWeapons", 1000, false, "i", playerid);
  212.  
  213.  
  214. return 1;
  215. }
  216.  
  217. PlayerPlaySound(playerid, 1184 , 0.0, 0.0,0.0);
  218.  
  219. player_enter_biz[playerid] = -1;
  220.  
  221. new house = -1;
  222. new f_house = -1;
  223.  
  224. if(GetPlayerHouse(playerid) != -1) house = GetPlayerHouse(playerid);
  225. if(GetPlayerHouseLodger(playerid) != -1) house = GetPlayerHouseLodger(playerid);
  226.  
  227. if(PlayerInfo[playerid][pSelectSpawn] == 1) return SetPPos(playerid, 1512.5323,-2286.9011,13.5469,265.6523, 0, 0, false), PlayerInfo[playerid][pSelectSpawn] = 0;
  228. if(PlayerInfo[playerid][pSelectSpawn] == 2) return SetPPos(playerid, 397.7661,-1800.8658,7.8281,353.8233, 0, 0, false), PlayerInfo[playerid][pSelectSpawn] = 0;
  229. if(PlayerInfo[playerid][pSelectSpawn] == 3)
  230. {
  231. if(PlayerInfo[playerid][pPosX] == 0.0 || PlayerInfo[playerid][pPosY] == 0.0 || PlayerInfo[playerid][pPosZ] == 0.0 || PlayerInfo[playerid][pPosA] == 0.0)
  232. {
  233. SetPPos(playerid, 398.6810, -1795.5673, 7.8281, 339.9007, PlayerInfo[playerid][pInt], PlayerInfo[playerid][pVirtual], true);
  234. PlayerInfo[playerid][pSelectSpawn] = 0;
  235. }
  236. else
  237. {
  238. SetPPos(playerid, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], PlayerInfo[playerid][pPosA], PlayerInfo[playerid][pInt], PlayerInfo[playerid][pVirtual], true);
  239. PlayerInfo[playerid][pSelectSpawn] = 0;
  240. }
  241. return 1;
  242. }
  243. if(PlayerInfo[playerid][pSelectSpawn] == 4)
  244. {
  245. new member = PlayerInfo[playerid][pMember];
  246. PlayerInfo[playerid][pSelectSpawn] = 0;
  247. return SetPPos(playerid, FracInfo[member][fSpawn][0], FracInfo[member][fSpawn][1], FracInfo[member][fSpawn][2], FracInfo[member][fSpawn][3], FracInfo[member][fInt], FracInfo[member][fVw], true);
  248. }
  249. if(PlayerInfo[playerid][pSelectSpawn] == 5)
  250. {
  251. if(GetPlayerHouse(playerid) == -1) return SetPPos(playerid, 397.7661,-1800.8658,7.8281,353.8233, 0, 0, false);
  252. PlayerEnterToHouse(playerid, house, 1), PlayerInfo[playerid][pSelectSpawn] = 0;
  253. PlayerInfo[playerid][pSelectSpawn] = 0;
  254. return 1;
  255. }
  256. if(PlayerInfo[playerid][pSelectSpawn] == 7) return SetPPos(playerid, 397.7661,-1800.8658,7.8281,353.8233, 0, 0, false), PlayerInfo[playerid][pSelectSpawn] = 0;
  257.  
  258. return 1;
  259. }
  260.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement