create.inc 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. CMD:createfire( playerid, params[] ) {
  2. if( PlayerInfo[playerid][pAdmin] >= 3 ) {
  3. new
  4. Float:amo, type, Float:x, Float:y, Float:z;
  5. if( sscanf( params, "df", type, amo ) ) {
  6. return SendClientMessage( playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /createfire [type (1 = small, 2 = medium, 3 = large)] [up/down amount]" );
  7. }
  8. if( !IsValidFireType(type) ) {
  9. return SendClientMessage(playerid, COLOR_GREY, "Uhoh! This isn't a valid fire type. Valid types include 1: small, 2: medium, 3: large." );
  10. }
  11. GetPlayerPos( playerid, x, y, z );
  12. new vw = GetPlayerVirtualWorld(playerid);
  13. new int = GetPlayerInterior(playerid);
  14. new slot = CreateFire(type, x, y, z, amo, vw, int);
  15. new string[144];
  16. format( string, 144, "You have successfully created fire, with fire ID: %d.", slot );
  17. SendClientMessage( playerid, COLOR_YELLOW, string );
  18. return 1;
  19. }
  20. return 1;
  21. }
  22. /*
  23. CMD:createfirecircle(playerid, params[]) {
  24. if(PlayerInfo[playerid][pAdmin] >= 3) {
  25. new Float:radius;
  26. if(sscanf(params, "f", radius)) {
  27. return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /createfirecircle [radius]");
  28. }
  29. if(radius > 10.0) {
  30. return SendClientMessage(playerid, COLOR_GREY, "The radius cannot be bigger than 10.0 units.");
  31. }
  32. new Float:x, Float:y, Float:z;
  33. GetPlayerPos(playerid, x, y, z);
  34. x -= radius;
  35. y -= radius;
  36. new Float:angle = acos(
  37. (2*floatpower(radius,2) - (floatpower(2.4, 2)))/(2*(2*radius))
  38. );
  39. for(new i; i < 360; i += angle) {
  40. x += (radius * -floatsin((i), degrees));
  41. y += (radius * -floatcos((i), degrees));
  42. CreateFire(FIRE_LARGE, x, y, z, -2.5);
  43. }
  44. SendClientMessage(playerid, COLOR_GREY, "You light a circle of fire, if some aren't appearing, the fire limit may have been reached.");
  45. }
  46. return 1;
  47. }*/
  48. CMD:createfireline(playerid, params[]) {
  49. if(PlayerInfo[playerid][pAdmin] >= 3) {
  50. new Float:length;
  51. if(sscanf(params, "f", length)) {
  52. return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /createfireline [length]");
  53. }
  54. if( length > 10 ) {
  55. return SendClientMessage(playerid, COLOR_GREY, "The length cannot be greater than 10.0 units.");
  56. }
  57. new Float:angle;
  58. GetPlayerFacingAngle(playerid, angle);
  59. new Float:dir_x = (2.4 * -floatsin((angle), degrees));
  60. new Float:dir_y = (2.4 * -floatcos((angle), degrees));
  61. new Float:x, Float:y, Float:z;
  62. new vw = GetPlayerVirtualWorld(playerid);
  63. new int = GetPlayerInterior(playerid);
  64. GetPlayerPos(playerid, x, y, z);
  65. for(new i; i < length; i++) {
  66. x += dir_x;
  67. y += dir_y;
  68. CreateFire(FIRE_LARGE, x, y, z, -2.5, vw, int );
  69. }
  70. SendClientMessage(playerid, COLOR_GREY, "You light a line of fire. If some aren't appearing the fire limit may have been reached.");
  71. }
  72. return 1;
  73. }
  74. CMD:lightfire(playerid, params[]) //only source for players to place fires
  75. {
  76. if(IsAtEvent[playerid])
  77. return SendClientMessage(playerid, COLOR_GREY, "You cannot do this right now.");
  78. if(PlayerInfo[playerid][pJailed])
  79. return SendClientMessage(playerid, COLOR_GREY, "You cannot do this right now.");
  80. if(pInHospital[playerid])
  81. return SendClientMessage(playerid, COLOR_GREY, "You cannot do this right now.");
  82. if(pDeathState[playerid] == PLAYER_STATE_REVIVE)
  83. return SendClientMessage(playerid, COLOR_GREY, "You cannot do this right now.");
  84. if(IsPlayerInAnyVehicle(playerid))
  85. return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot light fires in vehicles.");
  86. if(!(PlayerCuffed[playerid] == 0 || PlayerInfo[playerid][pJailed] > 0 || inPaintball[playerid] != 0))
  87. return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You cannot light a fire right now.");
  88. if(GetPlayerInterior(playerid) != 0)
  89. return SendClientMessage(playerid, COLOR_GREY, "You cannot place camp fires inside interiors.");
  90. if(GetPlayerVirtualWorld(playerid) != 0) {
  91. return SendClientMessage(playerid, COLOR_GREY, "You cannot place camp fires inside other virtual worlds.");
  92. }
  93. new firetype[10], string[128];
  94. if (sscanf(params, "s[10]", firetype)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /lightfire [camp]");
  95. new
  96. Float:player_x, Float:player_y, Float:player_z, Float:player_facing;
  97. GetPlayerPos(playerid, player_x, player_y, player_z);
  98. if(strmatch("camp", firetype))
  99. {
  100. if(PlayerInfo[playerid][pMatches] > 0)
  101. {
  102. new Float:fpos[3];
  103. for(new i = 0; i < MAX_FIRES; i++)
  104. {
  105. GetFirePos(i, fpos[0], fpos[1], fpos[2]);
  106. if(GetFireOwner(i) == playerid)
  107. return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You can only place one fire.");
  108. if(IsPlayerInRangeOfPoint(playerid, 50.0, fpos[0], fpos[1], fpos[2]))
  109. return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} There is a fire already within 50 metres.");
  110. //otherwise create a new fire.
  111. if(!IsValidFire(i)) {
  112. SetPlayerSpecialAction(playerid, 0);
  113. ApplyAnimationEx(playerid, "CARRY", "putdwn", 3.0, 0, 0, 0, 0, 0, 0);
  114. GetPlayerFacingAngle(playerid, player_facing);
  115. player_x += (2.0 * -floatsin((-player_facing -180), degrees));
  116. player_y += (2.0 * -floatcos((-player_facing - 180), degrees));
  117. CreateFire(FIRE_CAMP, player_x, player_y, player_z, -2.5, 0, 0);
  118. SetFireOwner(i, playerid);
  119. PlayerInfo[playerid][pMatches]--;
  120. format(string, sizeof(string), "* %s kneels down and lights a fire.", PlayerICName(playerid));
  121. ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  122. SetTimerEx("OnPlayerPlaceFire", 3000, 0, "i", playerid);
  123. return 1;
  124. }
  125. }
  126. return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} max fires reached.");
  127. } else return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} You don't have any matches.");
  128. }
  129. /*else if(strmatch("big", firetype))
  130. {
  131. //restrictions
  132. if(PlayerInfo[playerid][pLevel] < 5)
  133. return SendClientMessage(playerid, COLOR_GREY, "You must be at least level 5 to light out of control fires.");
  134. if(PlayerInfo[playerid][pJerrycan] < 10 || PlayerInfo[playerid][pMatches] < 1)
  135. return SendClientMessage(playerid, COLOR_GREY, "You must have a Jerry Can with at least 10 litres of diesel, and matches.");
  136. //user stuff - animations ect
  137. new fire_count = 2;
  138. for(new i = 0; i < MAX_FIRES; i++)
  139. {
  140. if(!IsValidFire(i))
  141. {
  142. GetPlayerFacingAngle(playerid, player_facing);
  143. player_x += (2.9 + random(2) * -floatsin((-(player_facing - 180)), degrees));
  144. player_y += (2.9 + random(2) * -floatcos((-(player_facing - 180)), degrees));
  145. CreateFire(FIRE_LARGE, player_x, player_y, player_z, -2.3);
  146. SetFireVirtualWorld(i, GetPlayerVirtualWorld(playerid));
  147. fire_count--;
  148. PlayerInfo[playerid][pMatches]--;
  149. if(fire_count == 0)
  150. {
  151. format(str, sizeof(str), "* %s spreads diesel gas around using their Jerry Can and lights it.", PlayerICName(playerid));
  152. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  153. SetPlayerSpecialAction(playerid, 0);
  154. ApplyAnimationEx(playerid, "CARRY", "putdwn", 3.0, 0, 0, 0, 0, 0, 0);
  155. //placing fire, setting variables
  156. PlayerInfo[playerid][pJerrycan] = PlayerInfo[playerid][pJerrycan] - 10;
  157. return 1;
  158. }
  159. }
  160. }
  161. SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error:{FFFFFF} Max fires has been reached !");
  162. }*/
  163. else
  164. SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /lightfire [camp]");
  165. return 1;
  166. }