Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.15 KB | None | 0 0
  1. function LoadSVehicles() {
  2.  
  3. for(new x = 1; x <= cache_num_rows(); x++) {
  4. Iter_Add(ServerCars, x);
  5. new s = x - 1;
  6.  
  7. ServerVehicles[x][vID] = cache_get_field_content_int(s, "vID");
  8. ServerVehicles[x][vModel] = cache_get_field_content_int(s, "vModel");
  9. ServerVehicles[x][vLocation][0] = cache_get_field_content_float(s, "LocationX");
  10. ServerVehicles[x][vLocation][1] = cache_get_field_content_float(s, "LocationY");
  11. ServerVehicles[x][vLocation][2] = cache_get_field_content_float(s, "LocationZ");
  12. ServerVehicles[x][vAngle] = cache_get_field_content_float(s, "Angle");
  13. ServerVehicles[x][vColor][0] = cache_get_field_content_int(s, "Color1");
  14. ServerVehicles[x][vColor][1] = cache_get_field_content_int(s, "Color2");
  15. ServerVehicles[x][vFaction] = cache_get_field_content_int(s, "Faction");
  16. ServerVehicles[x][vRank] = cache_get_field_content_int(s, "Rank");
  17. ServerVehicles[x][vVirtual] = cache_get_field_content_int(s, "Virtual");
  18. ServerVehicles[x][vClan] = cache_get_field_content_int(s, "Clan");
  19.  
  20. if(ServerVehicles[x][vModel] >= 400 && ServerVehicles[x][vModel] <= 611) {
  21. ServerVehicles[x][vSpawned] = CreateVehicleEx(ServerVehicles[x][vModel], ServerVehicles[x][vLocation][0], ServerVehicles[x][vLocation][1], ServerVehicles[x][vLocation][2], ServerVehicles[x][vAngle], ServerVehicles[x][vColor][0], ServerVehicles[x][vColor][1], -1);
  22. new idd = ServerVehicles[x][vSpawned];
  23. SetVehicleVirtualWorld(idd, ServerVehicles[idd][vVirtual]);
  24. if(ServerVehicles[idd][vFaction] != 0) {
  25. if(ServerVehicles[idd][vModel] == 411) {
  26. new policecar = CreateObject(19327, 1534.2373, -1643.2886, 5.9373, -87.6999, 90.4001, -87.1805);
  27. SetObjectMaterialText(policecar, "POLICE", 0, 50, "Arial", 25, 1, -16777216, 0, 1);
  28. new lspdcar = CreateObject(19419,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
  29. AttachObjectToVehicle(policecar, idd, 0.0, -1.9, 0.3, 270.0, 0.0, 0.0);
  30. AttachObjectToVehicle(lspdcar, idd, 0.0646, 0.1661, 0.6957, 0.0000, 0.0000, 0.0000);
  31. }
  32. if(ServerVehicles[idd][vModel] == 541) {
  33. if(ServerVehicles[idd][vFaction] == 2) {
  34. new object1 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  35. new object2 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  36. AttachObjectToVehicle(object1, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
  37. AttachObjectToVehicle(object2, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
  38. }
  39. }
  40. if(ServerVehicles[idd][vModel] == 525) {
  41. new object1 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  42. new object2 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  43. AttachObjectToVehicle(object1, idd, -0.600000,-0.485000,1.450000,0.000000,0.000000,0.000000);
  44. AttachObjectToVehicle(object2, idd, 0.600000,-0.485000,1.450000,0.000000,0.000000,0.000000);
  45. }
  46. }
  47. new str[64];
  48. if(ServerVehicles[idd][vFaction] != 0) format(str, 64, "F%d %d", ServerVehicles[idd][vFaction], idd);
  49. else format(str, sizeof(str), "RO-0%d", ServerVehicles[x][vSpawned]);
  50. SetVehicleNumberPlate(idd, str);
  51. }
  52. }
  53. printf("Server vehicles: %d", Iter_Count(ServerCars));
  54. return 1; }
  55.  
  56. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) {
  57. if(ispassenger == 0) {
  58. new vehicle = GetVehicleID(vehicleid);
  59. if(ServerVehicles[vehicle][vID] != 0 && JobWorking[playerid] == 0) {
  60. if(vehicle >= 130 && vehicle <= 135) {
  61. if(GetPVarInt(playerid, "InLesson") == -1) return sendError(playerid, "Nu ai o lectie activa!"), SlapPlayer(playerid);
  62. }
  63. else if(ServerVehicles[vehicle][vFaction] == 1 || ServerVehicles[vehicle][vFaction] == 2 || ServerVehicles[vehicle][vFaction] == 3) {
  64. if(ServerVehicles[vehicle][vRank] > PlayerInfo[playerid][pRank]) {
  65. gMsg[0] = EOS;
  66. format(gMsg, sizeof(gMsg), "Ai nevoie de rank %d pentru a lua acest vehicul.", ServerVehicles[vehicle][vRank]);
  67. SCM(playerid, COLOR_GREY, gMsg);
  68. SlapPlayer(playerid);
  69. }
  70. else if(OnDuty[playerid] == 0 && IsACop(playerid)) {
  71. SCM(playerid, COLOR_LGREEN, "Nu poti folosi vehiculele factiunii daca nu esti la datorie!");
  72. SlapPlayer(playerid);
  73. return 1;
  74. }
  75. else if(!IsACop(playerid)) {
  76. gMsg[0] = EOS;
  77. format(gMsg, sizeof(gMsg), "Nu faci parte din factiunea %s.", FactionName(ServerVehicles[vehicle][vFaction]));
  78. SCM(playerid, COLOR_GREY, gMsg);
  79. SlapPlayer(playerid);
  80. }
  81. }
  82. else if(ServerVehicles[vehicle][vFaction] != PlayerInfo[playerid][pMember] && ServerVehicles[vehicle][vFaction] != 0) {
  83. gMsg[0] = EOS;
  84. format(gMsg, sizeof(gMsg), "Nu faci parte din factiunea %s.", FactionName(ServerVehicles[vehicle][vFaction]));
  85. SCM(playerid, COLOR_GREY, gMsg);
  86. SlapPlayer(playerid);
  87. }
  88. else {
  89. if(OnDuty[playerid] == 0 && IsACop(playerid) && Copcar2(vehicle)) {
  90. SCM(playerid, COLOR_LGREEN, "Nu poti folosi vehiculele factiunii daca nu esti la datorie!");
  91. SlapPlayer(playerid);
  92. return 1;
  93. }
  94. }
  95. }
  96. if(IsABoat(vehicleid) && GetPVarInt(playerid, "InLesson") == -1) {
  97. if(PlayerInfo[playerid][pBoatLic] < 1 && InDealer[playerid] == 0) {
  98. sendError(playerid,"Nu ai licenta de navigatie.");
  99. SlapPlayer(playerid);
  100. TogglePlayerControllable(playerid, 1);
  101. }
  102. }
  103. else if(IsAPlane(vehicleid) && GetPVarInt(playerid, "InLesson") == -1) {
  104. if(PlayerInfo[playerid][pFlyLic] < 1 && InDealer[playerid] == 0) {
  105. sendError(playerid,"Nu ai licenta de zbor.");
  106. SlapPlayer(playerid);
  107. TogglePlayerControllable(playerid, 1);
  108. }
  109. }
  110. else {
  111. if(PlayerInfo[playerid][pCarLic] < 1) {
  112. if(!IsAPlane(vehicleid) || IsABike2(vehicleid) || InExamen[playerid] == 1 || GetVehicleModel(vehicleid) == 471 || InDealer[playerid] > 0) { }
  113. else {
  114. sendError(playerid,"Nu ai licenta de condus.");
  115. SlapPlayer(playerid);
  116. TogglePlayerControllable(playerid, 1);
  117. SetTimerEx("UnFreezeStation", 500, 0, "i", playerid);
  118. }
  119. }
  120. }
  121. }
  122. return 1; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement