Facebook
From tes1231111, 2 Months ago, written in C.
Embed
Download Paste or View Raw
Hits: 276
  1. /*
  2.  Soly
  3.  
  4.  isPlayerAndroid(playerId)
  5.  setDeviceInfo(playerId, deviceType)
  6.  isInvalidObject(modelId)
  7.  
  8. */
  9. #define SONY // ÇÀÊÎÌÅÍÒÈÒÜ ÅÑËÈ ÂÑÅ = ÏÊ
  10. #define INVALID_OBJECTS_VERSION 0x3
  11.  
  12. #if defined _invalidobjects_included
  13.  #endinput
  14. #endif
  15. #define _invalidobjects_included
  16.  
  17. #if !defined PAWNCMD_INC_
  18.  #error "plz include Pawn.RakNet"
  19. #endif
  20.  
  21. #if defined RPC_CREATE_OBJECT
  22.  #undef RPC_CREATE_OBJECT
  23.  #define RPC_CREATE_OBJECT 44
  24. #else
  25.  #define RPC_CREATE_OBJECT 44
  26. #endif
  27.  
  28. #if defined RPC_WORLDVEHICLE_ADD
  29.  #undef RPC_WORLDVEHICLE_ADD
  30.  #define RPC_WORLDVEHICLE_ADD 164
  31. #else
  32.  #define RPC_WORLDVEHICLE_ADD 164
  33. #endif
  34.  
  35. #if defined RPC_SET_PLAYER_SKIN
  36.  #undef RPC_SET_PLAYER_SKIN
  37.  #define RPC_SET_PLAYER_SKIN 153
  38. #else
  39.  #define RPC_SET_PLAYER_SKIN 153
  40. #endif
  41.  
  42. #if defined RPC_CLIENT_JOIN
  43.  #undef RPC_CLIENT_JOIN
  44.  #define RPC_CLIENT_JOIN 25
  45. #else
  46.  #define RPC_CLIENT_JOIN 25
  47. #endif
  48.  
  49. #if defined RPC_CREATE_PICKUP
  50.  #undef RPC_CREATE_PICKUP
  51.  #define RPC_CREATE_PICKUP 95
  52. #else
  53.  #define RPC_CREATE_PICKUP 95
  54. #endif
  55.  
  56. #define PICKUP_REPLACE_MODEL 1239
  57.  
  58. #define PLAYER_DEVICE_PC 0
  59. #define PLAYER_DEVICE_ANDROID 1
  60.  
  61.  
  62. enum E_CLIENT_KEY
  63. {
  64.  e_clientVersion,
  65.  e_szAuthKey[44]
  66. }
  67.  
  68. static const stock m_szClientVersions[][E_CLIENT_KEY] = {
  69.  {90, "E02262CF28BC542486C558D4BE9EFB716592AFAF8B"// INT32
  70.  byteMod,      // UINT8
  71.  byteNicknameLen,    // UINT8
  72.  NickName[MAX_PLAYER_NAME], // char  
  73.  uiClientChallengeResponse,  // UINT32
  74.  byteAuthKeyLen,    // UINT8
  75.  auth_key[64],     // char  
  76.  iClientVerLen,     // UINT8
  77.  ClientVersion[12]   // char  
  78.  
  79. };
  80.  
  81. enum E_PICKUP_STRUCT
  82. {
  83.  dPickupID,    // UINT32
  84.  dModelID,     // UINT32
  85.     dSpawnType,    // UINT32
  86.     Float:pickupX,   // FLOAT  
  87.     Float:pickupY,   // FLOAT  
  88.     Float:pickupZ    // FLOAT  
  89. };
  90.  
  91. enum E_OBJECT_STRUCT
  92. {
  93.  e_wObjectID,    // INT16
  94.  e_ModelID,    // UINT32
  95.  Float:e_objectX,  // FLOAT
  96.  Float:e_objectY,  // FLOAT
  97.  Float:e_objectZ,  // FLOAT
  98.  Float:e_rotx,   // FLOAT
  99.  Float:e_roty,   // FLOAT
  100.  Float:e_rotz,   // FLOAT
  101.  float:e_DrawDistance, // FLOAT
  102.  e_NoCameraCol,   // UINT8
  103.  e_attachedObject,  // UINT16
  104.  e_attachedVehicle,  // UINT16
  105.  float:e_AttachOffsetX, // FLOAT
  106.  float:e_AttachOffsetY, // FLOAT
  107.  float:e_AttachOffsetZ, // FLOAT
  108.  float:e_AttachRotX,  // FLOAT
  109.  float:e_AttachRotY,  // FLOAT
  110.  float:e_AttachRotZ,  // FLOAT
  111.  e_SyncRotation    // UINT8
  112.  
  113. };
  114.  
  115. enum E_VEHICLE_STRUCT
  116. {
  117.  e_vVehicleID,    // INT16
  118.  e_vModelID,    // UINT32
  119.  Float:e_posX,
  120.  Float:e_posY,
  121.  Float:e_posZ,
  122.  Float:e_rot,
  123.  e_vColor1,
  124.  e_vColor2,
  125.  Float:e_vHealth,
  126.  e_vInterior,
  127.  e_vDoorDamageStatus,
  128.  e_vPanelDamageStatus,
  129.  e_vByteLightDamageStatus,
  130.  e_vByteTimeDamageStatus,
  131.  e_vByteAddSiren
  132.  
  133. };
  134.  
  135. enum E_PLAYER_STRUCT
  136. {
  137.  e_usPlayerID,
  138.  e_bTeam,
  139.  e_uiSkin,
  140.  e_pfPosX,
  141.  e_pfPosY,
  142.  e_pfPosZ,
  143.  e_pfRot,
  144.  e_uiColor,
  145.  e_bFighting,
  146.  e_boolVisible
  147. };
  148.  
  149. static dataObject[E_OBJECT_STRUCT];
  150. static vehicleData[E_VEHICLE_STRUCT];
  151. static playerData[E_PLAYER_STRUCT];
  152.  
  153. static playerDevice[MAX_PLAYERS char];
  154.  
  155. stock isPlayerAndroid(playerId)
  156. {
  157.     if(playerId == -1) return 1;
  158.     return playerDevice{playerId};
  159. }
  160.  
  161. stock setDeviceInfo(playerId, deviceType)
  162. {
  163.  playerDevice{playerId} = deviceType;
  164.  return 1;
  165. }
  166.  
  167. stock isValidVehicle(modelId)
  168. {
  169.  if(isInvalidVehicle(modelId))
  170.  {
  171.      if(getReplacableVehicleModel(modelId) == -1)
  172.      {
  173.          return 0;
  174.      }
  175.  }
  176.  return 1;
  177. }
  178.  
  179. stock isValidSkin(modelId)
  180. {
  181.     if(isInvalidSkin(modelId))
  182.  {
  183.      if(getReplacableSkinModel(modelId) == -1)
  184.      {
  185.          return 0;
  186.      }
  187.  }
  188.  return 1;
  189. }
  190.  
  191. stock isInvalidObject(modelId)
  192. {
  193.  if(modelId < 11000)
  194.   return -1;
  195.  new returnval = -1;
  196.  for(new it; it < sizeof(m_szSampModels); it++)
  197.  {
  198.   if(m_szSampModels[it] == modelId)
  199.   {
  200.    returnval = modelId;
  201.    break;
  202.   }
  203.  }
  204.  return returnval;
  205. }
  206.  
  207. stock isInvalidVehicle(modelId)
  208. {
  209.  if(modelId < 400 || modelId > 611)
  210.  {
  211.   return 1;
  212.  }
  213.  
  214.  if(modelId < 15000 || modelId > 15100)
  215.  {
  216.   for(new i = 0; i < MAX_VEH_MODELS_REPLACE; i++)
  217.   {
  218.    if(vehModels[i][0] == modelId)
  219.    {
  220.     return 1;
  221.    }
  222.   }
  223.  }
  224.  else
  225.  {
  226.   return 1;
  227.  }
  228.  
  229.  return 0;
  230. }
  231.  
  232. stock getReplacableVehicleModel(modelId)
  233. {
  234.  if(!(15_000 <= modelId <= 15_100))
  235.  {
  236.   for(new i = 0; i < MAX_VEH_MODELS_REPLACE; i++)
  237.   {
  238.    if(vehModels[i][0] == modelId)
  239.    {
  240.     return vehModels[i][1];
  241.    }
  242.   }
  243.  }
  244.  else return 412;
  245.  
  246.  return -1;
  247. }
  248.  
  249. #define MAX_SERIAL_LENGTH 64
  250.  
  251. new g_usSAMPMajorVersions[MAX_PLAYERS];
  252. new g_usSAMPMinorVersions[MAX_PLAYERS];
  253. new g_bSAMPModified[MAX_PLAYERS];
  254. new g_usLauncherVersion[MAX_PLAYERS];
  255. new g_usModpackVersion[MAX_PLAYERS];
  256. new g_szSerialNumbers[MAX_PLAYERS][MAX_SERIAL_LENGTH + 1];
  257. new g_bUsesNewFormatData[MAX_PLAYERS];
  258.  
  259. stock isInvalidSkin(modelId)
  260. {
  261.  if(modelId < 1 || modelId > 311)
  262.  {
  263.   return 1;
  264.  }
  265.     for(new i = 0; i < MAX_SKIN_MODELS_REPLACE; i++)
  266.  {
  267.      if(skinModels[i][0] == modelId)
  268.      {
  269.          return 1;
  270.      }
  271.  }
  272.  return 0;
  273. }
  274.  
  275. stock getReplacableSkinModel(modelId)
  276. {
  277.     for(new i = 0; i < MAX_SKIN_MODELS_REPLACE; i++)
  278.  {
  279.      if(skinModels[i][0] == modelId)
  280.      {
  281.          return skinModels[i][1];
  282.      }
  283.  }
  284.  return -1;
  285. }
  286.  
  287. #define MAX_OBJECT_MODELS_REPLACE  3
  288. static objModels[MAX_OBJECT_MODELS_REPLACE] = { 1241, 13182, 9183 };
  289.  
  290. stock isInvalidObjectModel(modelId)
  291. {
  292.     for(new i = 0; i < MAX_OBJECT_MODELS_REPLACE; i++)
  293.  {
  294.      if(objModels[i] == modelId)
  295.      {
  296.          return 1;
  297.      }
  298.  }
  299.  return 0;
  300. }
  301.  
  302. stock getReplacableObjectModel(modelId)
  303. {
  304.     for(new i = 0; i < MAX_OBJECT_MODELS_REPLACE; i++)
  305.  {
  306.      if(objModels[i][0] == modelId)
  307.      {
  308.          return skinModels[i][1];
  309.      }
  310.  }
  311.  return -1;
  312. }
  313.  
  314. #if defined _inc_y_hooks || defined _INC_y_hooks
  315.     hook OnIncomingRPC(playerid, rpcid, BitStream:bs)
  316. #else
  317.     public OnIncomingRPC(playerid, rpcid, BitStream:bs)
  318. #endif
  319. {
  320.     if(rpcid == RPC_CLIENT_JOIN)
  321.     {
  322.         // Èãíîðèðóåì âñþ îáðàáîòêó äàííûõ è ñðàçó óñòàíàâëèâàåì íóæíûå çíà÷åíèÿ
  323.         setDeviceInfo(playerid, 1); // Óñòàíàâëèâàåì óñòðîéñòâî êàê Android
  324.         g_bUsesNewFormatData[playerid] = 1; // Èñïîëüçóåì íîâûé ôîðìàò äàííûõ
  325.         setPlayerAndroidVers(playerid, 101); // Óñòàíàâëèâàåì âåðñèþ Android 101
  326.     }
  327.     return 1;
  328. }
  329.  
  330.     #define OnIncomingRPC INCLUDE_OnIncomingRPC
  331.     #if defined INCLUDE_OnIncomingRPC
  332.         forward INCLUDE_OnIncomingRPC(playerid, rpcid, BitStream:bs);
  333.     #endif
  334. #endif
  335.  
  336. #define RPC_ScrGivePlayerWeapon 22
  337. #define RPC_ScrSetPlayerAttachedObject 113
  338. #define RPC_WorldPlayerAdd  32
  339.  
  340. stock ProcessReplaceSkin(playerid, BitStream:bs)
  341. {
  342.     new player, skinid;
  343.  BS_ReadValue(
  344.   bs,
  345.    PR_UINT32, player,
  346.   PR_UINT32, skinid);
  347.  
  348.  if(isInvalidSkin(skinid))
  349.  {
  350.   new bool: yes;
  351.   for(new i; i < MAX_SKIN_MODELS_REPLACE; i++)
  352.   {
  353.    if(skinid == skinModels[i][0])
  354.    {
  355.     if(getPlayerAndroidVers(playerid) < skinModels[i][2])
  356.     {
  357.      new BitStream:bitstream = BS_New();
  358.      BS_WriteValue(
  359.       bitstream,
  360.       PR_UINT32, player,  //id
  361.       PR_UINT32, 1);
  362.      BS_RPC(bitstream, playerid, RPC_SET_PLAYER_SKIN, PR_HIGH_PRIORITY, PR_RELIABLE_SEQUENCED);
  363.      BS_Delete(bitstream);
  364.      yes = true;
  365.      break;
  366.     }
  367.    }
  368.   }
  369.  
  370.   if(!yes)
  371.   {
  372.    // ïåðåïèñàòü ìîäåëü
  373.    new BitStream:bitstream = BS_New();
  374.    BS_WriteValue(
  375.     bitstream,
  376.     PR_UINT32, player,  //id
  377.     PR_UINT32, getReplacableSkinModel(skinid));
  378.    BS_RPC(bitstream, playerid, RPC_SET_PLAYER_SKIN, PR_HIGH_PRIORITY, PR_RELIABLE_SEQUENCED);
  379.    BS_Delete(bitstream);
  380.   }
  381.   return 1;
  382.  }
  383.  return 0;
  384. }
  385.  
  386. /*
  387.  
  388. enum E_PLAYER_STRUCT
  389. {
  390.  e_usPlayerID,
  391.  e_bTeam,
  392.  e_uiSkin,
  393.  e_pfPosX,
  394.  e_pfPosY,
  395.  e_pfPosZ,
  396.  e_pfRot,
  397.  e_uiColor,
  398.  e_bFighting,
  399.  e_boolVisible
  400. };
  401.  
  402. */
  403.  
  404. stock ProcessReplaceSkinAdd(playerid, BitStream:bs)
  405. {
  406.     static clearPlayerData[E_PLAYER_STRUCT];
  407.  playerData = clearPlayerData;
  408.  
  409.  BS_ReadValue(
  410.    bs,
  411.      PR_INT16, playerData[e_usPlayerID],
  412.   PR_UINT8, playerData[e_bTeam],
  413.   PR_UINT32, playerData[e_uiSkin],
  414.   PR_FLOAT, playerData[e_pfPosX],
  415.   PR_FLOAT, playerData[e_pfPosY],
  416.   PR_FLOAT, playerData[e_pfPosZ],
  417.   PR_FLOAT, playerData[e_pfRot],
  418.   PR_UINT32, playerData[e_uiColor],
  419.   PR_UINT8, playerData[e_bFighting],
  420.   PR_BOOL, playerData[e_boolVisible]);
  421.  
  422.  if(isInvalidSkin(playerData[e_uiSkin]))
  423.  {
  424.    new BitStream:bitstream = BS_New();
  425.  
  426.   BS_WriteValue(
  427.     bitstream,
  428.       PR_INT16, playerData[e_usPlayerID],
  429.    PR_UINT8, playerData[e_bTeam],
  430.    PR_UINT32, getReplacableSkinModel(playerData[e_uiSkin]),
  431.    PR_FLOAT, playerData[e_pfPosX],
  432.    PR_FLOAT, playerData[e_pfPosY],
  433.    PR_FLOAT, playerData[e_pfPosZ],
  434.    PR_FLOAT, playerData[e_pfRot],
  435.    PR_UINT32, playerData[e_uiColor],
  436.    PR_UINT8, playerData[e_bFighting],
  437.    PR_BOOL, playerData[e_boolVisible]);
  438.  
  439.   BS_RPC(bitstream, playerid, RPC_WorldPlayerAdd, PR_HIGH_PRIORITY, PR_RELIABLE_SEQUENCED);
  440.   BS_Delete(bitstream);
  441.   return 1;
  442.  }
  443.  return 0;
  444. }
  445.  
  446. stock ProcessReplaceVehicle(playerid, BitStream:bs)
  447. {
  448.     static clearVehicleData[E_VEHICLE_STRUCT];
  449.  vehicleData = clearVehicleData;
  450.  new modSlots[14];
  451.  new bytePaintJob;
  452.  new color1, color2;
  453.  
  454.  BS_ReadValue(
  455.    bs,
  456.      PR_INT16, vehicleData[e_vVehicleID],
  457.   PR_UINT32, vehicleData[e_vModelID],
  458.   PR_FLOAT, vehicleData[e_posX],
  459.   PR_FLOAT, vehicleData[e_posY],
  460.   PR_FLOAT, vehicleData[e_posZ],
  461.   PR_FLOAT, vehicleData[e_rot],
  462.   PR_UINT8, vehicleData[e_vColor1],
  463.   PR_UINT8, vehicleData[e_vColor2],
  464.   PR_FLOAT, vehicleData[e_vHealth],
  465.   PR_UINT8, vehicleData[e_vInterior],
  466.   PR_UINT32, vehicleData[e_vDoorDamageStatus],
  467.   PR_UINT32, vehicleData[e_vPanelDamageStatus],
  468.   PR_UINT8, vehicleData[e_vByteLightDamageStatus],
  469.   PR_UINT8, vehicleData[e_vByteTimeDamageStatus],
  470.   PR_UINT8, vehicleData[e_vByteAddSiren]);
  471.  for(new i = 0; i < 14; i++)
  472.  {
  473.    BS_ReadValue(bs, PR_UINT8, modSlots[i]);
  474.  }
  475.  BS_ReadValue(bs, PR_UINT8, bytePaintJob);
  476.  BS_ReadValue(bs, PR_UINT32, color1, PR_UINT32, color2);
  477.  
  478.  if(isInvalidVehicle(vehicleData[e_vModelID]))
  479.  {
  480.    new BitStream:bitstream = BS_New();
  481.  
  482.   BS_WriteValue(
  483.      bitstream,
  484.        PR_INT16, vehicleData[e_vVehicleID],
  485.    PR_UINT32, getReplacableVehicleModel(vehicleData[e_vModelID]),
  486.    PR_FLOAT, vehicleData[e_posX],
  487.    PR_FLOAT, vehicleData[e_posY],
  488.    PR_FLOAT, vehicleData[e_posZ],
  489.    PR_FLOAT, vehicleData[e_rot],
  490.    PR_UINT8, vehicleData[e_vColor1],
  491.    PR_UINT8, vehicleData[e_vColor2],
  492.    PR_FLOAT, vehicleData[e_vHealth],
  493.    PR_UINT8, vehicleData[e_vInterior],
  494.    PR_UINT32, vehicleData[e_vDoorDamageStatus],
  495.    PR_UINT32, vehicleData[e_vPanelDamageStatus],
  496.    PR_UINT8, vehicleData[e_vByteLightDamageStatus],
  497.    PR_UINT8, vehicleData[e_vByteTimeDamageStatus],
  498.    PR_UINT8, vehicleData[e_vByteAddSiren]);
  499.    
  500.   for(new i = 0; i < 14; i++)
  501.   {
  502.    BS_WriteValue(bitstream, PR_UINT8, modSlots[i]);
  503.   }
  504.   BS_WriteValue(bitstream, PR_UINT8, bytePaintJob);
  505.   BS_WriteValue(bitstream, PR_UINT32, color1, PR_UINT32, color2);
  506.  
  507.   BS_RPC(bitstream, playerid, RPC_WORLDVEHICLE_ADD, PR_HIGH_PRIORITY, PR_RELIABLE_SEQUENCED);
  508.   BS_Delete(bitstream);
  509.   return 1;
  510.  }
  511.  return 0;
  512. }
  513. /*
  514. stock ProcessReplaceVehicle(playerid, BitStream:bs)
  515. {
  516.     static clearVehicleData[E_VEHICLE_STRUCT];
  517.  vehicleData = clearVehicleData;
  518.  new modSlots[14];
  519.  new bytePaintJob;
  520.  new color1, color2;
  521.  
  522.  BS_ReadValue(
  523.    bs,
  524.      PR_INT16, vehicleData[e_vVehicleID],
  525.   PR_UINT32, vehicleData[e_vModelID],
  526.   PR_FLOAT, vehicleData[e_posX],
  527.   PR_FLOAT, vehicleData[e_posY],
  528.   PR_FLOAT, vehicleData[e_posZ],
  529.   PR_FLOAT, vehicleData[e_rot],
  530.   PR_UINT8, vehicleData[e_vColor1],
  531.   PR_UINT8, vehicleData[e_vColor2],
  532.   PR_FLOAT, vehicleData[e_vHealth],
  533.   PR_UINT8, vehicleData[e_vInterior],
  534.   PR_UINT32, vehicleData[e_vDoorDamageStatus],
  535.   PR_UINT32, vehicleData[e_vPanelDamageStatus],
  536.   PR_UINT8, vehicleData[e_vByteLightDamageStatus],
  537.   PR_UINT8, vehicleData[e_vByteTimeDamageStatus],
  538.   PR_UINT8, vehicleData[e_vByteAddSiren]);
  539.  
  540.  for(new i = 0; i < 14; i++)
  541.  {
  542.    BS_ReadValue(bs, PR_UINT8, modSlots[i]);
  543.  }
  544.  BS_ReadValue(bs, PR_UINT8, bytePaintJob);
  545.  BS_ReadValue(bs, PR_UINT32, color1, PR_UINT32, color2);
  546.  
  547.  if(isInvalidVehicle(vehicleData[e_vModelID]))
  548.  {
  549.   new bool: yes;
  550.   for(new g; g < MAX_VEH_MODELS_REPLACE; g++)
  551.   {
  552.    if(vehicleData[e_vModelID] == vehModels[g][0])
  553.    {
  554.     if(getPlayerAndroidVers(playerid) < vehModels[g][2])
  555.     {
  556.      new BitStream:bitstream = BS_New();
  557.  
  558.      BS_WriteValue(
  559.       bitstream,
  560.       PR_INT16, vehicleData[e_vVehicleID],
  561.       PR_UINT32, vehModels[g][1],
  562.       PR_FLOAT, vehicleData[e_posX],
  563.       PR_FLOAT, vehicleData[e_posY],
  564.       PR_FLOAT, vehicleData[e_posZ],
  565.       PR_FLOAT, vehicleData[e_rot],
  566.       PR_UINT8, vehicleData[e_vColor1],
  567.       PR_UINT8, vehicleData[e_vColor2],
  568.       PR_FLOAT, vehicleData[e_vHealth],
  569.       PR_UINT8, vehicleData[e_vInterior],
  570.       PR_UINT32, vehicleData[e_vDoorDamageStatus],
  571.       PR_UINT32, vehicleData[e_vPanelDamageStatus],
  572.       PR_UINT8, vehicleData[e_vByteLightDamageStatus],
  573.       PR_UINT8, vehicleData[e_vByteTimeDamageStatus],
  574.       PR_UINT8, vehicleData[e_vByteAddSiren]);
  575.      
  576.      for(new i = 0; i < 14; i++)
  577.      {
  578.       BS_WriteValue(bitstream, PR_UINT8, modSlots[i]);
  579.      }
  580.      BS_WriteValue(bitstream, PR_UINT8, bytePaintJob);
  581.      BS_WriteValue(bitstream, PR_UINT32, color1, PR_UINT32, color2);
  582.  
  583.      BS_RPC(bitstream, playerid, RPC_WORLDVEHICLE_ADD, PR_HIGH_PRIORITY, PR_RELIABLE_SEQUENCED);
  584.      BS_Delete(bitstream);
  585.      yes = true;
  586.      break;
  587.     }
  588.    }
  589.   }
  590.  
  591.   if(!yes)
  592.   {
  593.    new BitStream:bitstream = BS_New();
  594.  
  595.    BS_WriteValue(
  596.     bitstream,
  597.     PR_INT16, vehicleData[e_vVehicleID],
  598.     PR_UINT32, getReplacableVehicleModel(vehicleData[e_vModelID]),
  599.     PR_FLOAT, vehicleData[e_posX],
  600.     PR_FLOAT, vehicleData[e_posY],
  601.     PR_FLOAT, vehicleData[e_posZ],
  602.     PR_FLOAT, vehicleData[e_rot],
  603.     PR_UINT8, vehicleData[e_vColor1],
  604.     PR_UINT8, vehicleData[e_vColor2],
  605.     PR_FLOAT, vehicleData[e_vHealth],
  606.     PR_UINT8, vehicleData[e_vInterior],
  607.     PR_UINT32, vehicleData[e_vDoorDamageStatus],
  608.     PR_UINT32, vehicleData[e_vPanelDamageStatus],
  609.     PR_UINT8, vehicleData[e_vByteLightDamageStatus],
  610.     PR_UINT8, vehicleData[e_vByteTimeDamageStatus],
  611.     PR_UINT8, vehicleData[e_vByteAddSiren]);
  612.    
  613.    for(new i = 0; i < 14; i++)
  614.    {
  615.     BS_WriteValue(bitstream, PR_UINT8, modSlots[i]);
  616.    }
  617.    BS_WriteValue(bitstream, PR_UINT8, bytePaintJob);
  618.    BS_WriteValue(bitstream, PR_UINT32, color1, PR_UINT32, color2);
  619.  
  620.    BS_RPC(bitstream, playerid, RPC_WORLDVEHICLE_ADD, PR_HIGH_PRIORITY, PR_RELIABLE_SEQUENCED);
  621.    BS_Delete(bitstream);
  622.   }
  623.   return 1;
  624.  }
  625.  return 0;
  626. }
  627. */  
  628. stock IsShouldSendCreateObject(playerid, BitStream:bs)
  629. {
  630.     //new dataObject[E_OBJECT_STRUCT];
  631.  static clearDataObject[E_OBJECT_STRUCT];
  632.  dataObject = clearDataObject;
  633.  BS_ReadValue(
  634.   bs,
  635.    PR_INT16, dataObject[e_wObjectID],
  636.     PR_UINT32, dataObject[e_ModelID],
  637.      PR_FLOAT, dataObject[e_objectX],
  638.      PR_FLOAT, dataObject[e_objectY],
  639.      PR_FLOAT, dataObject[e_objectZ],
  640.      PR_FLOAT, dataObject[e_rotx],
  641.      PR_FLOAT, dataObject[e_roty],
  642.      PR_FLOAT, dataObject[e_rotz],
  643.      PR_FLOAT, dataObject[e_DrawDistance],
  644.      PR_UINT8, dataObject[e_NoCameraCol],
  645.      PR_UINT16, dataObject[e_attachedObject],
  646.      PR_UINT16, dataObject[e_attachedVehicle],
  647.      PR_FLOAT, dataObject[e_AttachOffsetX],
  648.      PR_FLOAT, dataObject[e_AttachOffsetY],
  649.      PR_FLOAT, dataObject[e_AttachOffsetZ],
  650.      PR_FLOAT, dataObject[e_AttachRotX],
  651.      PR_FLOAT, dataObject[e_AttachRotY],
  652.      PR_FLOAT, dataObject[e_AttachRotZ],
  653.      PR_UINT8, dataObject[e_SyncRotation]
  654.   );
  655.  
  656.  if(isInvalidObjectModel(dataObject[e_ModelID]))
  657.  {
  658.      return 0;
  659.  }
  660.  return 1;
  661. }
  662.  
  663. stock IsShouldSendCreateAttached(playerid, BitStream:bs)
  664. {
  665.     new sPlayerID, iSlot, bCreate;
  666.     BS_ReadValue(
  667.   bs,
  668.   PR_UINT16, sPlayerID,
  669.   PR_UINT32, iSlot,
  670.   PR_BOOL,   bCreate);
  671.  if(bCreate)
  672.  {
  673.    new modelid;
  674.      BS_ReadValue(bs, PR_UINT32, modelid);
  675.      if(isInvalidObjectModel(modelid))
  676.   {
  677.    return 0;
  678.      }
  679.  }
  680.  return 1;
  681. }
  682.  
  683. #define WEAPON_SECURE 0x100
  684. #define WEAPON_SECURE_KEY 0x15
  685.  
  686. #if defined _inc_y_hooks || defined _INC_y_hooks
  687.  hook OnOutcomingRPC(playerid, rpcid, BitStream:bs)
  688. #else
  689.  public OnOutcomingRPC(playerid, rpcid, BitStream:bs)
  690. #endif
  691.  {
  692.   if(rpcid == RPC_CREATE_OBJECT)
  693.   {
  694.    if(isPlayerAndroid(playerid) != 0) // åñëè èãðîê ñ âåäðà
  695.    {
  696.     if(getPlayerAndroidVers(playerid) < server_invalid_client) // åñëè ó èãðîêà âåðñèÿ, êîòîðàÿ íèæå âåðñèè êëèåíòà ñ ëèìèòîì è ìîäïàêîì
  697.     {
  698.      if(!IsShouldSendCreateObject(playerid, bs)) // åñëè ìîäåëü íåâàëèäíàÿ, òî íå îòñûëàåì
  699.      {
  700.       new _frmtsrt[50];
  701.       format(_frmtsrt, sizeof(_frmtsrt), "[Warning] Bad object model: 32");
  702.       SendClientMessage(playerid, 0xa9c4e4FF, _frmtsrt);
  703.       return 0;
  704.      }
  705.     }
  706.    }
  707.    else // èíà÷å èãðîê ñ ÏÊ
  708.    {
  709.        if(!IsShouldSendCreateObject(playerid, bs)) // åñëè ìîäåëü íåâàëèäíàÿ, òî íå îòñûëàåì
  710.     {
  711.      new _frmtsrt[50];
  712.      format(_frmtsrt, sizeof(_frmtsrt), "[Warning] Bad object model: 32");
  713.      SendClientMessage(playerid, 0xa9c4e4FF, _frmtsrt);
  714.      return 0;
  715.     }
  716.    }
  717.   }
  718.   else if(rpcid == RPC_ScrGivePlayerWeapon) // ñåðâåðíàÿ çàùèòà
  719.   {
  720.       new val1, val2;
  721.       BS_ReadValue(
  722.         bs,
  723.           PR_UINT32, val1,
  724.     PR_UINT32, val2);
  725.  
  726.    new BitStream:bitstream = BS_New();
  727.    BS_WriteValue(
  728.       bitstream,
  729.        PR_UINT32, val1,  //id
  730.        PR_UINT32, val2,  //model
  731.        PR_UINT32, WEAPON_SECURE ^ WEAPON_SECURE_KEY
  732.    );
  733.    BS_RPC(bitstream, playerid, RPC_ScrGivePlayerWeapon, PR_HIGH_PRIORITY, PR_RELIABLE_SEQUENCED);
  734.    BS_Delete(bitstream);
  735.    return 0;
  736.   }
  737.   else if(rpcid == RPC_ScrSetPlayerAttachedObject)
  738.   {
  739.       if(isPlayerAndroid(playerid) != 0) // åñëè èãðîê ñ âåäðà
  740.    {
  741.     if(getPlayerAndroidVers(playerid) < server_invalid_client) // åñëè ó èãðîêà âåðñèÿ, êîòîðàÿ íèæå âåðñèè êëèåíòà ñ ëèìèòîì è ìîäïàêîì
  742.     {
  743.         if(!IsShouldSendCreateAttached(playerid, bs)) // åñëè ìîäåëü íåâàëèäíàÿ, òî íå îòñûëàåì
  744.         {
  745.             new _frmtsrt[50];
  746.       format(_frmtsrt, sizeof(_frmtsrt), "[Warning] Bad object mode1: 33");
  747.       SendClientMessage(playerid, 0xa9c4e4FF, _frmtsrt);
  748.       return 0;
  749.         }
  750.     }
  751.    }
  752.    else // èíà÷å èãðîê ñ ÏÊ
  753.    {
  754.        if(!IsShouldSendCreateAttached(playerid, bs)) // åñëè ìîäåëü íåâàëèäíàÿ, òî íå îòñûëàåì
  755.        {
  756.            new _frmtsrt[50];
  757.      format(_frmtsrt, sizeof(_frmtsrt), "[Warning] Bad object model: 33");
  758.      SendClientMessage(playerid, 0xa9c4e4FF, _frmtsrt);
  759.      return 0;
  760.        }
  761.    }
  762.  
  763.   }
  764.   else if(rpcid == RPC_WorldPlayerAdd)
  765.   {
  766.    if(isPlayerAndroid(playerid) != 0 && !gPlayerModPack[playerid]) // åñëè èãðîê ñ âåäðà
  767.    {
  768.     if(getPlayerAndroidVers(playerid) < server_invalid_client) // åñëè ó èãðîêà âåðñèÿ, êîòîðàÿ íèæå âåðñèè êëèåíòà ñ ëèìèòîì è ìîäïàêîì
  769.     {
  770.      if(ProcessReplaceSkinAdd(playerid, bs)) // åñëè ìîäåëü áûëà çàìåíåíà óñïåøíî, òî îðèãèíàëüíûé ïàêåò íå îòñûëàåì
  771.      {
  772.          return 0;
  773.      }
  774.     }
  775.    }
  776.    else // èíà÷å èãðîê ñ ÏÊ
  777.    {
  778.     if(ProcessReplaceSkinAdd(playerid, bs)) // åñëè ìîäåëü áûëà çàìåíåíà óñïåøíî, òî îðèãèíàëüíûé ïàêåò íå îòñûëàåì
  779.     {
  780.         return 0;
  781.     }
  782.    }
  783.   }
  784.   else if(rpcid == RPC_WORLDVEHICLE_ADD)
  785.   {
  786.    if(isPlayerAndroid(playerid) != 0 && !gPlayerModPack[playerid]) // åñëè èãðîê ñ âåäðà
  787.    {
  788.     if(getPlayerAndroidVers(playerid) < server_invalid_client) // åñëè ó èãðîêà âåðñèÿ, êîòîðàÿ íèæå âåðñèè êëèåíòà ñ ëèìèòîì è ìîäïàêîì
  789.     {
  790.      if(ProcessReplaceVehicle(playerid, bs)) // åñëè ìîäåëü áûëà çàìåíåíà óñïåøíî, òî îðèãèíàëüíûé ïàêåò íå îòñûëàåì
  791.      {
  792.          return 0;
  793.      }
  794.     }
  795.    }
  796.    else // èíà÷å èãðîê ñ ÏÊ
  797.    {
  798.     if(ProcessReplaceVehicle(playerid, bs)) // åñëè ìîäåëü áûëà çàìåíåíà óñïåøíî, òî îðèãèíàëüíûé ïàêåò íå îòñûëàåì
  799.     {
  800.         return 0;
  801.     }
  802.    }
  803.   }
  804.   else if(rpcid == RPC_SET_PLAYER_SKIN)
  805.   {
  806.       if(isPlayerAndroid(playerid) != 0 && !gPlayerModPack[playerid]) // åñëè èãðîê ñ âåäðà
  807.    {
  808.     if(getPlayerAndroidVers(playerid) < server_invalid_client) // åñëè ó èãðîêà âåðñèÿ, êîòîðàÿ íèæå âåðñèè êëèåíòà ñ ëèìèòîì è ìîäïàêîì
  809.     {
  810.      if(ProcessReplaceSkin(playerid, bs)) // åñëè ìîäåëü áûëà çàìåíåíà óñïåøíî, òî îðèãèíàëüíûé ïàêåò íå îòñûëàåì
  811.      {
  812.          return 0;
  813.      }
  814.     }
  815.    }
  816.    else // èíà÷å èãðîê ñ ÏÊ
  817.    {
  818.                 if(ProcessReplaceSkin(playerid, bs)) // åñëè ìîäåëü áûëà çàìåíåíà óñïåøíî, òî îðèãèíàëüíûé ïàêåò íå îòñûëàåì
  819.     {
  820.         return 0;
  821.     }
  822.    }
  823.   }
  824.   else if(rpcid == RPC_CREATE_PICKUP)
  825.   {
  826.    if(isPlayerAndroid(playerid) != 0)
  827.    {
  828.     if(getPlayerAndroidVers(playerid) < server_invalid_client)
  829.     {
  830.      new dataPickup[E_PICKUP_STRUCT];
  831.      BS_ReadValue(
  832.             bs,
  833.             PR_UINT32, dataPickup[dPickupID],
  834.             PR_UINT32, dataPickup[dModelID],
  835.             PR_UINT32, dataPickup[dSpawnType],
  836.             PR_FLOAT, dataPickup[pickupX],
  837.             PR_FLOAT, dataPickup[pickupY],
  838.             PR_FLOAT, dataPickup[pickupZ]
  839.          );
  840.  
  841.      if(isInvalidObject(dataPickup[dModelID]) != -1)
  842.      {
  843.       new _frmtsrt[50];
  844.       format(_frmtsrt, sizeof(_frmtsrt), "[Warning] Bad pickup model: %d(%d)", dataPickup[dModelID], dataPickup[dPickupID]);
  845.       SendClientMessage(playerid, 0xa9c4e4FF, _frmtsrt);
  846.       // ïåðåïèñàòü ìîäåëü
  847.       new BitStream:bitstream = BS_New();
  848.       BS_WriteValue(
  849.           bitstream,
  850.           PR_UINT32, dataPickup[dPickupID],  //id
  851.           PR_UINT32, PICKUP_REPLACE_MODEL, //model
  852.           PR_UINT32, dataPickup[dSpawnType],  //type.
  853.           PR_FLOAT, dataPickup[pickupX],      //x.
  854.           PR_FLOAT, dataPickup[pickupY],   //y.
  855.           PR_FLOAT, dataPickup[pickupZ]   //z.
  856.       );
  857.       BS_RPC(bitstream, playerid, RPC_CREATE_PICKUP, PR_HIGH_PRIORITY, PR_RELIABLE_SEQUENCED);
  858.       BS_Delete(bitstream);  
  859.       return 0;
  860.      }
  861.     }
  862.    }
  863.   }
  864.   #if defined INCLUDE_OnOutcomingRPC
  865.    return INCLUDE_OnOutcomingRPC(playerid, rpcid, BitStream:bs);
  866.   #else
  867.    return 1;
  868.   #endif
  869.  }
  870.  
  871. #if !defined _inc_y_hooks && !defined _INC_y_hooks
  872.  #if defined _ALS_OnOutcomingRPC
  873.   #undef OnOutcomingRPC
  874.  #else
  875.   #define _ALS_OnOutcomingRPC
  876.  #endif
  877.  
  878.  #define OnOutcomingRPC INCLUDE_OnOutcomingRPC
  879.  #if defined INCLUDE_OnOutcomingRPC
  880.   forward INCLUDE_OnOutcomingRPC(playerid, rpcid, BitStream:bs);
  881.  #endif
  882. #endif