Advertisement
razvan_xd

fixed .inc

Jun 11th, 2014
731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 14.74 KB | None | 0 0
  1. /* YSF - kurta999's version */
  2. #if defined _YSF_included
  3.     #endinput
  4. #endif
  5. #define _YSF_included
  6.  
  7. // File functions
  8. native ffind(const pattern[], filename[], len, &idx);
  9. native frename(const oldname[], const newname[]);
  10.  
  11. // Directory functions
  12. native dfind(const pattern[], filename[], len, &idx);
  13. native dcreate(const name[]);
  14. native drename(const oldname[], const newname[]);
  15.  
  16. // Server rule and other functions
  17. native SetModeRestartTime(Float:time);
  18. native Float:GetModeRestartTime();
  19.  
  20. native SetPlayerAdmin(playerid, bool:admin); // Set player as RCON admin
  21. native LoadFilterScript(scriptname[]); // difference between "rcon loadfs": Return -> True if success, false if not
  22. native UnLoadFilterScript(scriptname[]); // ^
  23. native GetFilterScriptCount();
  24. native GetFilterScriptName(id, name[], len = sizeof(name));
  25.  
  26. #define CON_VARFLAG_DEBUG       1
  27. #define CON_VARFLAG_READONLY    2
  28. #define CON_VARFLAG_RULE        4
  29. #define CON_VARFLAG_UNREMOVABLE 8
  30.  
  31. native AddServerRule(name[], value[], flags = CON_VARFLAG_RULE);
  32. native SetServerRule(name[], value[]);
  33. native ModifyFlag(name[], flags);
  34.  
  35. // Per player things
  36. native SetPlayerGravity(playerid, Float:gravity);
  37. native Float:GetPlayerGravity(playerid);
  38. native SetPlayerTeamForPlayer(forplayerid, playerid, teamid);
  39. native GetPlayerTeamForPlayer(forplayerid, playerid);
  40. native GetPlayerWeather(playerid);
  41. native TogglePlayerWidescreen(playerid, bool:set);
  42. native IsPlayerWidescreenToggled(playerid);
  43. native GetPlayerSpawnPos(playerid, &Float:fX, &Float:fY, &Float:fZ);
  44. native GetPlayerSkillLevel(playerid, skill);
  45. native GetPlayerCheckpoint(playerid, &Float:fX, &Float:fY, &Float:fZ, &Float:fSize);
  46. native GetPlayerRaceCheckpoint(playerid, &Float:fX, &Float:fY, &Float:fZ, &Float:fNextX, &Float:fNextY, &fNextZ, &Float:fSize);
  47. native GetPlayerWorldBounds(playerid, &Float:x_max, &Float:x_min, &Float:y_max, &Float:y_min);
  48. native IsPlayerInModShop(playerid);
  49. native GetPlayerSirenState(playerid);
  50. native GetPlayerGearState(playerid);
  51. native GetPlayerHydraReactorAngle(playerid);
  52. native Float:GetPlayerTrainSpeed(playerid);
  53. native Float:GetPlayerZAim(playerid);
  54. native GetPlayerSurfingOffsets(playerid, &Float:fOffsetX, &Float:fOffsetY, &Float:fOffsetZ);
  55. native GetPlayerRotationQuat(playerid, &Float:w, &Float:x, &Float:y, &Float:z);
  56.  
  57. // Objects get - global
  58. native GetObjectModel(objectid);
  59. native Float:GetObjectDrawDistance(objectid);
  60. native GetObjectAttachedData(objectid, &attached_vehicleid, &attached_objectid);
  61. native GetObjectAttachedOffset(objectid, &Float:fX, &Float:fY, &Float:fZ, &Float:fRotX, &Float:fRotY, &Float:fRotZ);
  62.  
  63. // Objects get - player
  64. native GetPlayerObjectModel(playerid, objectid);
  65. native Float:GetPlayerObjectDrawDistance(playerid, objectid);
  66. native GetPlayerObjectAttachedData(playerid, objectid, &attached_vehicleid, &attached_objectid);
  67. native GetPlayerObjectAttachedOffset(playerid, objectid, &Float:fX, &Float:fY, &Float:fZ, &Float:fRotX, &Float:fRotY, &Float:fRotZ);
  68.  
  69. // special - for attached objects
  70. native GetPlayerAttachedObject(playerid, index, &modelid, &bone, &Float:fX, &Float:fY, &Float:fZ, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fSacleX, &Float:fScaleY, &Float:fScaleZ, &materialcolor1, &materialcolor2);
  71.  
  72. //n_ative AttachPlayerObjectToPlayer(objectplayer, objectid, attachplayer, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:rX, Float:rY, Float:rZ);
  73. native AttachPlayerObjectToObject(playerid, objectid, attachtoid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ, SyncRotation = 1);
  74.  
  75. // RakNet ban functions
  76. native ClearBanList();
  77. native IsBanned(ipaddress[]);
  78.  
  79. // Raknet
  80. native SetTimeoutTime(playerid, time_ms);
  81. native GetMTUSize();
  82. native GetLocalIP(index, localip[], len = sizeof(localip));
  83.  
  84. // vehicle functions
  85. native GetVehicleSpawnPos(vehicleid, &Float:fX, &Float:fY, &Float:fZ);
  86. native GetVehicleColor(vehicleid, &color1, &color2);
  87. native GetVehiclePaintjob(vehicleid);
  88. native GetVehicleInterior(vehicleid);
  89. native GetVehicleNumberPlate(vehicleid, plate[], len = sizeof(plate));
  90. native SetVehicleRespawnDelay(vehicleid, delay);
  91. native GetVehicleRespawnDelay(vehicleid);
  92. native GetVehicleOccupiedTick(vehicleid); // GetTickCount() - GetVehicleOccupiedTick(vehicleid) = time passed since vehicle is occupied, in ms
  93. native SetVehicleRespawnTick(vehicleid);
  94. native GetVehicleRespawnTick(vehicleid); // GetTickCount() - GetVehicleRespawnTick(vehicleid) = time passed since vehicle spawned, in ms
  95. native GetVehicleLastDriver(vehicleid);
  96.  
  97. // Gangzones - Global
  98. native IsValidGangZone(zoneid);
  99. native IsPlayerInGangZone(playerid, zoneid);
  100. native IsGangZoneVisibleForPlayer(playerid, zoneid);
  101. native GangZoneGetColorForPlayer(playerid, zoneid);
  102. native GangZoneGetFlashColorForPlayer(playerid, zoneid);
  103. native GangZoneGetPos(zoneid, &Float:fMinX, &Float:fMinY, &Float:fMaxX, &Float:fMaxY);
  104.  
  105. // Gangzones - Player
  106. native CreatePlayerGangZone(playerid, Float:minx, Float:miny, Float:maxx, Float:maxy);
  107. native PlayerGangZoneDestroy(playerid, zoneid);
  108. native PlayerGangZoneShow(playerid, zoneid, color);
  109. native PlayerGangZoneHide(playerid, zoneid);
  110. native PlayerGangZoneFlash(playerid, zoneid, color);
  111. native PlayerGangZoneStopFlash(playerid, zoneid);
  112. native IsValidPlayerGangZone(playerid, zoneid);
  113. native IsPlayerInPlayerGangZone(playerid, zoneid);
  114. native IsPlayerGangZoneVisible(playerid, zoneid);
  115. native PlayerGangZoneGetColor(playerid, zoneid);
  116. native PlayerGangZoneGetFlashColor(playerid, zoneid);
  117. native PlayerGangZoneGetPos(playerid, zoneid);
  118.  
  119. // Textdraw - Global
  120. native IsValidTextDraw(Text:textdrawid);
  121. native IsTextDrawVisibleForPlayer(playerid, Text:textdrawid);
  122. native TextDrawGetString(Text:textdrawid, text[], len = sizeof(text));
  123. native TextDrawSetPos(Text:textdrawid, Float:fX, Float:fY); // You can change textdraw pos with it, but you need to use TextDrawShowForPlayer() after that
  124. native TextDrawGetLetterSize(Text:textdrawid, &Float:fX, &Float:fY);
  125. native TextDrawGetFontSize(Text:textdrawid, &Float:fX, &Float:fY);
  126. native TextDrawGetPos(Text:textdrawid, &Float:fX, &Float:fY);
  127. native TextDrawGetColor(Text:textdrawid);
  128. native TextDrawGetBoxColor(Text:textdrawid);
  129. native TextDrawGetBackgroundColor(Text:textdrawid);
  130. native TextDrawGetShadow(Text:textdrawid);
  131. native TextDrawGetOutline(Text:textdrawid);
  132. native TextDrawGetFont(Text:textdrawid);
  133. native TextDrawIsBox(Text:textdrawid);
  134. native TextDrawIsProportional(Text:textdrawid);
  135. native TextDrawGetAlignment(Text:textdrawid);
  136. native TextDrawGetPreviewModel(Text:textdrawid);
  137. native TextDrawGetPreviewRot(Text:textdrawid, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fZoom);
  138. native TextDrawGetPreviewVehCol(Text:textdrawid, &color1, &color2);
  139.  
  140. // Textdraw - Player
  141. native IsValidPlayerTextDraw(playerid, PlayerText:textdrawid);
  142. native IsPlayerTextDrawVisible(playerid, PlayerText:textdrawid);
  143. native PlayerTextDrawGetString(playerid, PlayerText:textdrawid, text[], len = sizeof(text));
  144. native PlayerTextDrawSetPos(playerid, PlayerText:textdrawid, Float:fX, Float:fY);
  145. native PlayerTextDrawGetLetterSize(playerid, PlayerText:textdrawid, &Float:fX, &Float:fY);
  146. native PlayerTextDrawGetFontSize(playerid, PlayerText:textdrawid, &Float:fX, &Float:fY);
  147. native PlayerTextDrawGetPos(playerid, PlayerText:textdrawid, &Float:fX, &Float:fY);
  148. native PlayerTextDrawGetColor(playerid, PlayerText:textdrawid);
  149. native PlayerTextDrawGetBoxColor(playerid, PlayerText:textdrawid);
  150. native PlayerTextDrawGetBackgroundCol(playerid, PlayerText:textdrawid);
  151. native PlayerTextDrawGetShadow(playerid, PlayerText:textdrawid);
  152. native PlayerTextDrawGetOutline(playerid, PlayerText:textdrawid);
  153. native PlayerTextDrawGetFont(playerid, PlayerText:textdrawid);
  154. native PlayerTextDrawIsBox(playerid, PlayerText:textdrawid);
  155. native PlayerTextDrawIsProportional(playerid, PlayerText:textdrawid);
  156. native PlayerTextDrawGetAlignment(playerid, PlayerText:textdrawid);
  157. native PlayerTextDrawGetPreviewModel(playerid, PlayerText:textdrawid);
  158. native PlayerTextDrawGetPreviewRot(playerid, PlayerText:textdrawid, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fZoom);
  159. native PlayerTextDrawGetPreviewVehCol(playerid, PlayerText:textdrawid, &color1, &color2);
  160.  
  161. // 3D Text - Global
  162. native IsValid3DTextLabel(Text3D:id);
  163. native Get3DTextLabelText(Text3D:id, text[], len = sizeof(text));
  164. native Get3DTextLabelColor(Text3D:id);
  165. native Get3DTextLabelPos(Text3D:id, &Float:fX, &Float:fY, &Float:fZ);
  166. native Float:Get3DTextLabelDrawDistance(Text3D:id);
  167. native Get3DTextLabelLOS(Text3D:id);
  168. native Get3DTextLabelVirtualWorld(Text3D:id);
  169. native Get3DTextLabelAttachedData(Text3D:id, &attached_playerid, &attached_vehicleid);
  170.  
  171. // 3D Text - Player
  172. native IsValidPlayer3DTextLabel(playerid, PlayerText3D:id);
  173. native GetPlayer3DTextLabelText(playerid, PlayerText3D:id, text[], len = sizeof(text));
  174. native GetPlayer3DTextLabelColor(playerid, PlayerText3D:id);
  175. native GetPlayer3DTextLabelPos(playerid, PlayerText3D:id, &Float:fX, &Float:fY, &Float:fZ);
  176. native Float:GetPlayer3DTextLabelDrawDist(playerid, PlayerText3D:id);
  177. native GetPlayer3DTextLabelLOS(playerid, PlayerText3D:id);
  178. native GetPlayer3DTextLabelVirtualW(playerid, PlayerText3D:id);
  179.  
  180. // Menu
  181. native IsMenuDisabled(Menu:menuid);
  182. native IsMenuRowDisabled(Menu:menuid, row);
  183. native GetMenuColumns(Menu:menuid);
  184. native GetMenuItems(Menu:menuid, column);
  185. native GetMenuPos(Menu:menuid, &Float:fX, &Float:fY);
  186. native GetMenuColumnWidth(Menu:menuid, column, &Float:fColumn1, &Float:fColumn2);
  187. native GetMenuColumnHeader(Menu:menuid, column, header[], len = sizeof(header));
  188. native GetMenuItem(Menu:menuid, column, itemid, item[], len = sizeof(item));
  189.  
  190. // Pickups
  191. native IsValidPickup(pickupid);
  192. native GetPickupPos(pickupid, &Float:fX, &Float:fY, &Float:fZ);
  193. native GetPickupModel(pickupid);
  194. native GetPickupType(pickupid);
  195. native GetPickupVirtualWorld(pickupid);
  196.  
  197. // Y_Less's model sizes inc
  198. native GetColCount();
  199. native Float:GetColSphereRadius(modelid);
  200. native GetColSphereOffset(modelid, &Float:fX, &Float:fY, &Float:fZ);
  201.  
  202. // Callbacks
  203. forward OnPlayerEnterGangZone(playerid, zoneid);
  204. forward OnPlayerLeaveGangZone(playerid, zoneid);
  205. forward OnPlayerEnterPlayerGangZone(playerid, zoneid);
  206. forward OnPlayerLeavePlayerGangZone(playerid, zoneid);
  207.  
  208. //////////////////////////////////////////////////////////////
  209. // Fixes
  210. //////////////////////////////////////////////////////////////
  211.  
  212. // No comment..
  213. #if !defined IsValidVehicle
  214.     native IsValidVehicle(vehicleid);
  215. #endif
  216.  
  217. native Float:GetGravity();
  218. native GetWeather();
  219. native GetWeaponSlot(weaponid);
  220.  
  221. enum
  222. {
  223.     BS_BOOL,
  224.     BS_CHAR,
  225.     BS_UNSIGNEDCHAR,
  226.     BS_SHORT,
  227.     BS_UNSIGNEDSHORT,
  228.     BS_INT,
  229.     BS_UNSIGNEDINT,
  230.     BS_FLOAT,
  231.     BS_STRING
  232. };
  233.  
  234. // FOR DEVELOPERS ONLY!!!!!!!!!!!!!!!!!!!!
  235. native SendRPC(playerid, RPC, {Float,_}:...); // playerid == -1 -> broadcast
  236. native SendData(playerid, {Float,_}:...); // playerid == -1 -> broadcast
  237.  
  238. /* EXAMPLE
  239. CMD:pickup(playerid, params[])
  240. {
  241.     new
  242.         Float:X, Float:Y, Float:Z;
  243.     GetPlayerPos(playerid, X, Y, Z);
  244.  
  245.     SendRPC(playerid, 95, // rpcid
  246.         BS_INT, strval(params), // int - pickupid
  247.         BS_INT, 1222,    // int - modelid
  248.         BS_INT, 19,     // int   - type
  249.         BS_FLOAT, X + 2.0,   // float
  250.         BS_FLOAT, Y,     // float
  251.         BS_FLOAT, Z);    // float
  252.     return 1;
  253. }
  254.  
  255. CMD:destroypickup(playerid, params[])
  256. {
  257.     SendRPC(playerid, 63, // rpcid
  258.         BS_INT, strval(params));    // int - pickupid
  259.     return 1;
  260. }
  261. */
  262.  
  263. // Initialize plugin functions
  264. native YSF_AddPlayer(playerid);
  265. native YSF_RemovePlayer(playerid);
  266. native YSF_StreamIn(playerid, forplayerid);
  267. native YSF_StreamOut(playerid, forplayerid);
  268.  
  269. public OnPlayerConnect(playerid)
  270. {
  271.     YSF_AddPlayer(playerid);
  272.     #if defined YSF_OnPlayerConnect
  273.         return YSF_OnPlayerConnect(playerid);
  274.     #else
  275.         return 1;
  276.     #endif
  277. }
  278.  
  279. #if defined YSF_OnPlayerConnect
  280.     forward YSF_OnPlayerConnect(playerid);
  281. #endif
  282. #if defined _ALS_OnPlayerConnect
  283.     #undef OnPlayerConnect
  284. #else
  285.     #define _ALS_OnPlayerConnect
  286. #endif
  287. #define OnPlayerConnect YSF_OnPlayerConnect
  288.  
  289.  
  290. public OnPlayerDisconnect(playerid, reason)
  291. {
  292.     YSF_RemovePlayer(playerid);
  293.     #if defined YSF_OnPlayerDisconnect
  294.         return YSF_OnPlayerDisconnect(playerid, reason);
  295.     #else
  296.         return 1;
  297.     #endif
  298. }
  299.  
  300. #if defined YSF_OnPlayerDisconnect
  301.     forward YSF_OnPlayerDisconnect(playerid, reason);
  302. #endif
  303. #if defined _ALS_OnPlayerDisconnect
  304.     #undef OnPlayerDisconnect
  305. #else
  306.     #define _ALS_OnPlayerDisconnect
  307. #endif
  308. #define OnPlayerDisconnect YSF_OnPlayerDisconnect
  309.  
  310.  
  311. //////////////////////////////////////////////
  312. public OnPlayerStreamIn(playerid, forplayerid)
  313. {
  314.     YSF_StreamIn(playerid, forplayerid);
  315.     #if defined YSF_OnPlayerStreamIn
  316.         return YSF_OnPlayerStreamIn(playerid, forplayerid);
  317.     #else
  318.         return 1;
  319.     #endif
  320. }
  321.  
  322. #if defined YSF_OnPlayerStreamIn
  323.     forward YSF_OnPlayerStreamIn(playerid, forplayerid);
  324. #endif
  325. #if defined _ALS_OnPlayerStreamIn
  326.     #undef OnPlayerStreamIn
  327. #else
  328.     #define _ALS_OnPlayerStreamIn
  329. #endif
  330. #define OnPlayerStreamIn YSF_OnPlayerStreamIn
  331.  
  332. //////////////////////////////////////////////
  333. public OnPlayerStreamOut(playerid, forplayerid)
  334. {
  335.     YSF_StreamOut(playerid, forplayerid);
  336.     #if defined YSF_OnPlayerStreamOut
  337.         return YSF_OnPlayerStreamOut(playerid, forplayerid);
  338.     #else
  339.         return 1;
  340.     #endif
  341. }
  342.  
  343. #if defined YSF_OnPlayerStreamOut
  344.     forward YSF_OnPlayerStreamOut(playerid, forplayerid);
  345. #endif
  346. #if defined _ALS_OnPlayerStreamOut
  347.     #undef OnPlayerStreamOut
  348. #else
  349.     #define _ALS_OnPlayerStreamOut
  350. #endif
  351. #define OnPlayerStreamOut YSF_OnPlayerStreamOut
  352.  
  353. stock YSF_AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2)
  354. {
  355.     return AddStaticVehicle(modelid, spawn_x, spawn_y, spawn_z, z_angle, (color1 == -1) ? (random(255)) : (color1), (color2 == -1) ? (random(255)) : (color2));
  356. }
  357.  
  358. #if defined _ALS_AddStaticVehicle
  359.     #undef AddStaticVehicle
  360. #else
  361.     #define _ALS_AddStaticVehicle
  362. #endif
  363. #define AddStaticVehicle YSF_AddStaticVehicle
  364.  
  365. stock YSF_AddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay)
  366. {
  367.     return AddStaticVehicleEx(modelid, spawn_x, spawn_y, spawn_z, z_angle, (color1 == -1) ? (random(255)) : (color1), (color2 == -1) ? (random(255)) : (color2), respawn_delay);
  368. }
  369.  
  370. #if defined _ALS_AddStaticVehicleEx
  371.     #undef AddStaticVehicleEx
  372. #else
  373.     #define _ALS_AddStaticVehicleEx
  374. #endif
  375. #define AddStaticVehicleEx YSF_AddStaticVehicleEx
  376.  
  377. stock YSF_CreateVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay)
  378. {
  379.     return CreateVehicle(modelid, spawn_x, spawn_y, spawn_z, z_angle, (color1 == -1) ? (random(255)) : (color1), (color2 == -1) ? (random(255)) : (color2), respawn_delay);
  380. }
  381.  
  382. #if defined _ALS_CreateVehicle
  383.     #undef CreateVehicle
  384. #else
  385.     #define _ALS_CreateVehicle
  386. #endif
  387. #define CreateVehicle YSF_CreateVehicle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement