HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*******************************************************************************
  2.  
  3.   SM Parachute
  4.  
  5.   Version: 2.5
  6.   Author: SWAT_88
  7.  
  8.   1.0 First version, should work on basically any mod
  9.   1.1 Linear fallspeed added.
  10.   1.2 Key assignment amended
  11.   1.3 Added +use Button support. No keybinding required!
  12. Fixed some bugs in linear Flight mode:
  13. You dont stay hanging on the wall.
  14. You don't bounce when you touch the ground.
  15. You dont have Gravity 0.1 when you jump holding the E button.
  16.   1.4 Fixed a serious bug:
  17. Maxplayers are now correctly counted.
  18.   1.5 Added new features:
  19. Information, welcome and status messages in Chat, Panel or BottomCenterText!
  20. Buy Parachute and Sell Parachute added ! (CS ONLY)
  21. Translations added !
  22. Works on basically any mod !
  23.   1.6 Model Added!
  24.   1.7 Fixed another bug in linear Flight mode.
  25. Linear Flight mode should be bugfree now!
  26. Added Cvar for model display.
  27.   1.7b Fixed a small bug for checking the model.
  28. Added a better check for Parachute ending.
  29.   1.7c Fixed a stupid bug in HandleSay.
  30.   1.8 Fixed a bug in OnPlayerDisconnect.
  31. Changed /bp /sp to !bp !sp
  32. Added new features:
  33. Realistic velocity-decrease.
  34. More detail on model textures.
  35. A new parachute.
  36.   1.9 Added a new button: Space.
  37. Added automatic button change for TF2.
  38.   2.0 Fixed some bugs:
  39. in RoundMsg
  40. in Chat Commands
  41.   2.5 Fixed this error: "Can't create physics object for model/parachute/parachute_carbon.mdl".
  42.  
  43.   Description:
  44.  
  45. If cost = 0 then Everybody have a parachute.
  46. To use your parachute press and hold your E(+use)/Space(+jump) button while falling.
  47. If you are running a TF2 server the button will automatic change to Space.
  48. I checked whether cstrike is running or not, so dont be afraid of crashing the plugin in another Mod, It's safe!!!
  49. Sidenote:
  50. To change the model you have to edit the global variables for the names. Afterwards recompile sm_parachute.sp. Here is a tutorial.
  51. To change the texture you have to recompile the smd and change its content. Here is the Model source.
  52.  
  53.   Commands:
  54.  
  55. Press E(+use) to slow down your fall.
  56. No more binding Keys!
  57. Write !bp or !buy_parachute in Chat to buy a parachute (Only if cost > 0) !
  58. Write !sp or !sell_parachute in Chat to sell your parachute (Only if cost > 0) !
  59.  
  60.   Cvars:
  61.  
  62. sm_parachute_enabled "1" - 0: disables the plugin - 1: enables the plugin
  63.  
  64. sm_parachute_fallspeed "100" - speed of the fall when you use the parachute
  65.  
  66. sm_parachute_linear "1" - 0: disables linear fallspeed - 1: enables it
  67.  
  68. sm_parachute_msgtype "1" - 0: disables Information - 1: Chat - 2: Panel - 3: BottomCenter
  69.  
  70. sm_parachute_cost "0" - cost of the parachute (CS ONLY) (If cost = 0 then free for everyone)
  71.  
  72. sm_parachute_payback "75" - how many percent of the parachute cost you get when you sell your parachute (ie. 75% of 1000 = 750$)
  73.  
  74. sm_parachute_welcome "1" - 0: disables Welcome Message - 1: enables it
  75.  
  76. sm_parachute_roundmsg "1" - 0: disables Round Message - 1: enables it
  77.  
  78. sm_parachute_model "1" - 0: dont use the model - 1: display the Model
  79.  
  80. sm_parachute_decrease "50" - 0: dont use Realistic velocity-decrease - x: sets the velocity-decrease.
  81.  
  82. sm_parachute_button "1" - 1: uses button +USE for parachute usage. - 2: uses button +JUMP.
  83.  
  84.   Supported Languages:
  85.  
  86. en English
  87. de German
  88.  
  89.   If you write a Translation post it in this thread.
  90.  
  91.   Setup (SourceMod):
  92.  
  93. Install the smx file to addons\sourcemod\plugins.
  94. Install the translation file to addons\sourcemod\translations.
  95. (Re)Load Plugin or change Map.
  96.  
  97.   TO DO:
  98.  
  99. Smooth model movement.(I will need expert help for this)
  100. Animations.(I will not code it, it's too complicate, but any other expert can code it. It's Open Source)
  101.  
  102.   Copyright:
  103.  
  104. Everybody can edit this plugin and copy this plugin.
  105.  
  106.   Thanks to:
  107.  
  108. Greyscale
  109. Pinkfairie
  110. bl4nk
  111. theY4Kman
  112. Knagg0
  113. KRoT@L
  114. JTP10181
  115.  
  116. Fordította: BBk
  117.  
  118.   HAVE FUN!!!
  119.  
  120. *******************************************************************************/
  121.  
  122. #include <sourcemod>
  123. #include <sdktools>
  124.  
  125. #define PARACHUTE_VERSION "2.5"
  126.  
  127. //Parachute Model
  128. #define PARACHUTE_MODEL "parachute_carbon"
  129.  
  130. //Parachute Textures
  131. #define PARACHUTE_PACK "pack_carbon"
  132. #define PARACHUTE_TEXTURE "parachute_carbon"
  133.  
  134. new g_iVelocity = -1;
  135. new g_iMoney = -1;
  136. new g_maxplayers = -1;
  137.  
  138. new String:g_game[30];
  139. new String:path_model[256];
  140. new String:path_pack[256];
  141. new String:path_texture[256];
  142.  
  143. new Handle:g_fallspeed = INVALID_HANDLE;
  144. new Handle:g_enabled = INVALID_HANDLE;
  145. new Handle:g_linear = INVALID_HANDLE;
  146. new Handle:g_msgtype = INVALID_HANDLE;
  147. new Handle:g_cost = INVALID_HANDLE;
  148. new Handle:g_payback = INVALID_HANDLE;
  149. new Handle:g_welcome = INVALID_HANDLE;
  150. new Handle:g_roundmsg = INVALID_HANDLE;
  151. new Handle:g_version = INVALID_HANDLE;
  152. new Handle:g_model = INVALID_HANDLE;
  153. new Handle:g_decrease = INVALID_HANDLE;
  154. new Handle:g_button = INVALID_HANDLE;
  155.  
  156. new x;
  157. new cl_flags;
  158. new cl_buttons;
  159. new Float:speed[3];
  160. new bool:isfallspeed;
  161.  
  162. new USE_BUTTON;
  163. new String:ButtonText[265];
  164.  
  165. new bool:inUse[MAXPLAYERS+1];
  166. new bool:hasPara[MAXPLAYERS+1];
  167. new bool:hasModel[MAXPLAYERS+1];
  168. new Parachute_Ent[MAXPLAYERS+1];
  169.  
  170. public Plugin:myinfo =
  171. {
  172. name = "SM Parachute",
  173. author = "SWAT_88",
  174. description = "To use your parachute press and hold your E(+use) button while falling.",
  175. version = PARACHUTE_VERSION,
  176. url = "http://www.sourcemod.net/"
  177. };
  178.  
  179. public OnPluginStart()
  180. {
  181. LoadTranslations ("sm_parachute.phrases");
  182.  
  183. g_enabled = CreateConVar("sm_parachute_enabled","1");
  184. g_fallspeed = CreateConVar("sm_parachute_fallspeed","100");
  185. g_linear = CreateConVar("sm_parachute_linear","1");
  186. g_msgtype = CreateConVar("sm_parachute_msgtype","1");
  187. g_cost = CreateConVar("sm_parachute_cost","0");
  188. g_payback = CreateConVar("sm_parachute_payback","75");
  189. g_welcome = CreateConVar("sm_parachute_welcome","1");
  190. g_roundmsg = CreateConVar("sm_parachute_roundmsg","1");
  191. g_version = CreateConVar("sm_parachute_version", PARACHUTE_VERSION, "SM Parachute Version", FCVAR_NOTIFY);
  192. g_model = CreateConVar("sm_parachute_model","1");
  193. g_decrease = CreateConVar("sm_parachute_decrease","50");
  194. g_button = CreateConVar("sm_parachute_button","1");
  195. g_iVelocity = FindSendPropOffs("CBasePlayer", "m_vecVelocity[0]");
  196. g_iMoney = FindSendPropOffs("CCSPlayer", "m_iAccount");
  197. g_maxplayers = GetMaxClients();
  198. SetConVarString(g_version, PARACHUTE_VERSION);
  199.  
  200. InitModel();
  201. InitGameMode();
  202.  
  203. RegConsoleCmd("say",HandleSay,"",FCVAR_GAMEDLL);
  204. RegConsoleCmd("say_team",HandleSay,"",FCVAR_GAMEDLL);
  205. HookEvent("player_death",PlayerDeath);
  206. HookEvent("player_spawn",PlayerSpawn);
  207. HookConVarChange(g_enabled, CvarChange_Enabled);
  208. HookConVarChange(g_linear, CvarChange_Linear);
  209. HookConVarChange(g_cost, CvarChange_Cost);
  210. HookConVarChange(g_model, CvarChange_Model);
  211. HookConVarChange(g_button, CvarChange_Button);
  212. }
  213.  
  214. public OnPluginEnd(){
  215. CloseHandle(g_fallspeed);
  216. CloseHandle(g_enabled);
  217. CloseHandle(g_linear);
  218. CloseHandle(g_msgtype);
  219. CloseHandle(g_cost);
  220. CloseHandle(g_payback);
  221. CloseHandle(g_welcome);
  222. CloseHandle(g_roundmsg);
  223. CloseHandle(g_version);
  224. CloseHandle(g_model);
  225. CloseHandle(g_decrease);
  226. }
  227.  
  228. public InitModel(){
  229. Format(path_model,255,"models/parachute/%s",PARACHUTE_MODEL);
  230. Format(path_pack,255,"materials/models/parachute/%s",PARACHUTE_PACK);
  231. Format(path_texture,255,"materials/models/parachute/%s",PARACHUTE_TEXTURE);
  232. }
  233.  
  234. public InitGameMode(){
  235. GetGameFolderName(g_game, 29);
  236. if(StrEqual(g_game,"tf",false)){
  237. SetConVarInt(g_button,2);
  238. SetButton(2);
  239. }
  240. else{
  241. SetButton(1);
  242. }
  243. }
  244.  
  245. public OnMapStart(){
  246. new String:path[256];
  247.  
  248. strcopy(path,255,path_model);
  249. StrCat(path,255,".mdl")
  250. PrecacheModel(path,true);
  251.  
  252. strcopy(path,255,path_model);
  253. StrCat(path,255,".dx80.vtx")
  254. AddFileToDownloadsTable(path);
  255.  
  256. strcopy(path,255,path_model);
  257. StrCat(path,255,".dx90.vtx")
  258. AddFileToDownloadsTable(path);
  259.  
  260. strcopy(path,255,path_model);
  261. StrCat(path,255,".mdl")
  262. AddFileToDownloadsTable(path);
  263.  
  264. strcopy(path,255,path_model);
  265. StrCat(path,255,".sw.vtx")
  266. AddFileToDownloadsTable(path);
  267.  
  268. strcopy(path,255,path_model);
  269. StrCat(path,255,".vvd")
  270. AddFileToDownloadsTable(path);
  271.  
  272. strcopy(path,255,path_model);
  273. StrCat(path,255,".xbox.vtx")
  274. AddFileToDownloadsTable(path);
  275.  
  276. strcopy(path,255,path_pack);
  277. StrCat(path,255,".vmt")
  278. AddFileToDownloadsTable(path);
  279.  
  280. strcopy(path,255,path_pack);
  281. StrCat(path,255,".vtf")
  282. AddFileToDownloadsTable(path);
  283.  
  284. strcopy(path,255,path_texture);
  285. StrCat(path,255,".vmt")
  286. AddFileToDownloadsTable(path);
  287.  
  288. strcopy(path,255,path_texture);
  289. StrCat(path,255,".vtf")
  290. AddFileToDownloadsTable(path);
  291. }
  292.  
  293. public OnEventShutdown()
  294. {
  295. UnhookEvent("player_death",PlayerDeath);
  296. UnhookEvent("player_spawn",PlayerSpawn);
  297. }
  298.  
  299. public OnClientPutInServer(client)
  300. {
  301. inUse[client] = false;
  302. hasPara[client] = false;
  303. hasModel[client] = false;
  304. g_maxplayers = GetMaxClients();
  305. CreateTimer (20.0, WelcomeMsg, client);
  306. }
  307.  
  308. public OnClientDisconnect(client){
  309. g_maxplayers = GetMaxClients();
  310. CloseParachute(client);
  311. }
  312.  
  313. public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast){
  314. new client;
  315. client = GetClientOfUserId(GetEventInt(event, "userid"));
  316. if (GetConVarInt(g_cost) == 0){
  317. CreateTimer (1.0, RoundMsg, client);
  318. }
  319. return Plugin_Continue;
  320. }
  321.  
  322. public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast){
  323. new client;
  324. client = GetClientOfUserId(GetEventInt(event, "userid"));
  325. hasPara[client] = false;
  326. EndPara(client);
  327. return Plugin_Continue;
  328. }
  329.  
  330. public Action:RoundMsg(Handle:timer, any:client){
  331. if(GetConVarInt(g_roundmsg) == 1){
  332. if(IsClientConnected (client) && IsClientInGame(client))
  333. PrintMsg(client,"Have Got Free Parachute");
  334. }
  335. return Plugin_Continue;
  336. }
  337.  
  338. public StartPara(client,bool:open)
  339. {
  340. decl Float:velocity[3];
  341. decl Float:fallspeed;
  342. if (g_iVelocity == -1) return;
  343. if((GetConVarInt(g_enabled)== 1 && hasPara[client]) || (GetConVarInt(g_enabled) == 1 && GetConVarInt(g_cost) == 0)){
  344. fallspeed = GetConVarFloat(g_fallspeed)*(-1.0);
  345. GetEntDataVector(client, g_iVelocity, velocity);
  346. if(velocity[2] >= fallspeed){
  347. isfallspeed = true;
  348. }
  349. if(velocity[2] < 0.0) {
  350. if(isfallspeed && GetConVarInt(g_linear) == 0){
  351. }
  352. else if((isfallspeed && GetConVarInt(g_linear) == 1) || GetConVarFloat(g_decrease) == 0.0){
  353. velocity[2] = fallspeed;
  354. }
  355. else{
  356. velocity[2] = velocity[2] + GetConVarFloat(g_decrease);
  357. }
  358. TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity);
  359. SetEntDataVector(client, g_iVelocity, velocity);
  360. SetEntityGravity(client,0.1);
  361. if(open) OpenParachute(client);
  362. }
  363. }
  364. }
  365.  
  366. public EndPara(client)
  367. {
  368. if(GetConVarInt(g_enabled)== 1 ){
  369. SetEntityGravity(client,1.0);
  370. inUse[client]=false;
  371. CloseParachute(client);
  372. }
  373. }
  374.  
  375. public OpenParachute(client){
  376. decl String:path[256];
  377. strcopy(path,255,path_model);
  378. StrCat(path,255,".mdl")
  379.  
  380. if(GetConVarInt(g_model) == 1){
  381. Parachute_Ent[client] = CreateEntityByName("prop_dynamic_override");
  382. DispatchKeyValue(Parachute_Ent[client],"model",path);
  383. SetEntityMoveType(Parachute_Ent[client], MOVETYPE_NOCLIP);
  384. DispatchSpawn(Parachute_Ent[client]);
  385.  
  386. hasModel[client]=true;
  387. TeleportParachute(client);
  388. }
  389. }
  390.  
  391. public TeleportParachute(client){
  392. if(hasModel[client] && IsValidEntity(Parachute_Ent[client])){
  393. decl Float:Client_Origin[3];
  394. decl Float:Client_Angles[3];
  395. decl Float:Parachute_Angles[3] = {0.0, 0.0, 0.0};
  396. GetClientAbsOrigin(client,Client_Origin);
  397. GetClientAbsAngles(client,Client_Angles);
  398. Parachute_Angles[1] = Client_Angles[1];
  399. TeleportEntity(Parachute_Ent[client], Client_Origin, Parachute_Angles, NULL_VECTOR);
  400. }
  401. }
  402.  
  403. public CloseParachute(client){
  404. if(hasModel[client] && IsValidEntity(Parachute_Ent[client])){
  405. RemoveEdict(Parachute_Ent[client]);
  406. hasModel[client]=false;
  407. }
  408. }
  409.  
  410. public Check(client){
  411. if(GetConVarInt(g_enabled)== 1 ){
  412. GetEntDataVector(client,g_iVelocity,speed);
  413. cl_flags = GetEntityFlags(client);
  414. if(speed[2] >= 0 || (cl_flags & FL_ONGROUND)) EndPara(client);
  415. }
  416. }
  417.  
  418. public OnGameFrame()
  419. {
  420. if(GetConVarInt(g_enabled) == 0) return;
  421. for (x = 1; x <= g_maxplayers; x++)
  422. {
  423. if (IsClientInGame(x) && IsPlayerAlive(x))
  424. {
  425. cl_buttons = GetClientButtons(x);
  426. if (cl_buttons & USE_BUTTON)
  427. {
  428. if (!inUse[x])
  429. {
  430. inUse[x] = true;
  431. isfallspeed = false;
  432. StartPara(x,true);
  433. }
  434. StartPara(x,false);
  435. TeleportParachute(x);
  436. }
  437. else
  438. {
  439. if (inUse[x])
  440. {
  441. inUse[x] = false;
  442. EndPara(x);
  443. }
  444. }
  445. Check(x);
  446. }
  447. }
  448. }
  449.  
  450. stock GetNextSpaceCount(String:text[],CurIndex){
  451. new Count=0;
  452. new len = strlen(text);
  453. for(new i=CurIndex;i<len;i++){
  454. if(text[i] == ' ') return Count;
  455. else Count++;
  456. }
  457. return Count;
  458. }
  459.  
  460. stock SendHintText(client, String:text[], any:...){
  461. new String:message[192];
  462.  
  463. VFormat(message,191,text, 2);
  464. new len = strlen(message);
  465. if(len > 30){
  466. new LastAdded=0;
  467.  
  468. for(new i=0;i<len;i++){
  469. if((message[i]==' ' && LastAdded > 30 && (len-i) > 10) || ((GetNextSpaceCount(text,i+1) + LastAdded) > 34)){
  470. message[i] = '\n';
  471. LastAdded = 0;
  472. }
  473. else LastAdded++;
  474. }
  475. }
  476. new Handle:HintMessage = StartMessageOne("HintText",client);
  477. BfWriteByte(HintMessage,-1);
  478. BfWriteString(HintMessage,message);
  479. EndMessage();
  480. }
  481.  
  482. public PrintMsg(client,String:msg[]){
  483. new String:translation[256];
  484. if(GetConVarInt(g_enabled) == 0) return;
  485. Format(translation, 255, "%T", msg, LANG_SERVER, ButtonText);
  486. if(GetConVarInt(g_msgtype) == 1){
  487. PrintToChat(client,"\x01\x04[SM Parachute]\x01 %s", translation);
  488. }
  489. else if(GetConVarInt(g_msgtype) == 2) {
  490. new Handle:panel = CreatePanel();
  491. DrawPanelText(panel,translation);
  492. SendPanelToClient(panel,client,PanelHandle,5);
  493. }
  494. else if(GetConVarInt(g_msgtype) == 3){
  495. SendHintText(client,translation);
  496. }
  497. }
  498.  
  499. public PanelHandle(Handle:menu, MenuAction:action, param1, param2){
  500. }
  501.  
  502. public BuyParachute(client){
  503. new money;
  504. new cost;
  505. if (g_iMoney == -1) return;
  506. if (hasPara[client] == false){
  507. money = GetEntData(client,g_iMoney);
  508. cost = GetConVarInt(g_cost);
  509. if (cost == 0){
  510. PrintMsg(client,"Have Free Parachute");
  511. }
  512. else{
  513. if((money - cost)<0){
  514. PrintMsg(client,"No Money");
  515. }
  516. else{
  517. hasPara[client] = true;
  518. SetEntData(client,g_iMoney,money-cost);
  519. PrintMsg(client,"Have Bought Parachute");
  520. }
  521. }
  522. }
  523. else{
  524. PrintMsg(client,"Have Parachute");
  525. }
  526.  
  527. }
  528.  
  529. public SellParachute(client){
  530. new money;
  531. new Float:payback;
  532. new String:pb[10];
  533. if (g_iMoney == -1) return;
  534. if (hasPara[client] == true){
  535. money = GetEntData(client,g_iMoney);
  536. payback = GetConVarInt(g_cost)*(GetConVarFloat(g_payback)/100);
  537. if ((money + payback) > 16000){
  538. SetEntData(client,g_iMoney,16000);
  539. }
  540. else{
  541. FloatToString(payback,pb,9);
  542. SetEntData(client,g_iMoney,money+StringToInt(pb));
  543. }
  544. hasPara[client] = false;
  545. PrintMsg(client,"Sold Parachute");
  546. }
  547. else{
  548. if (GetConVarInt(g_cost)==0){
  549. PrintMsg(client,"Sell Free Parachute");
  550. }
  551. else{
  552. PrintMsg(client,"No Parachute");
  553. }
  554. }
  555. }
  556.  
  557. public Action:HandleSay(client, args){
  558. new String:line[30];
  559. if(GetConVarInt(g_enabled) == 0) return Plugin_Continue;
  560. if (args > 0){
  561. GetCmdArg(1,line,sizeof(line));
  562. if (strcmp(g_game,"cstrike",false)==0){
  563. if (StrEqual(line, "!bp", false) || StrEqual(line, "!buy_parachute", false)) BuyParachute(client);
  564. else if(StrEqual(line, "!sp", false) || StrEqual(line, "!sell_parachute", false)) SellParachute(client);
  565. }
  566. else{
  567. SetConVarInt(g_cost,0);
  568. if (StrEqual(line, "!bp", false) || StrEqual(line, "!buy_parachute", false)) PrintMsg(client,"Have Free Parachute");
  569. else if(StrEqual(line, "!sp", false) || StrEqual(line, "!sell_parachute", false)) PrintMsg(client,"Sell Free Parachute");
  570. }
  571. }
  572. return Plugin_Continue;
  573. }
  574.  
  575.  
  576. public Action:WelcomeMsg (Handle:timer, any:client)
  577. {
  578. if(GetConVarInt(g_enabled) == 0) return Plugin_Continue;
  579.  
  580. if (GetConVarInt (g_welcome) == 1 && IsClientConnected (client) && IsClientInGame (client))
  581. {
  582. PrintToChat(client,"\x01\x04[SM Parachute]\x01 %T", "Welcome", LANG_SERVER);
  583. if (GetConVarInt(g_cost)==0){
  584. PrintToChat(client,"\x01\x04[SM Parachute]\x01 %T", "Parachute For Everyone", LANG_SERVER);
  585. }
  586. else{
  587. PrintToChat(client,"\x01\x04[SM Parachute]\x01 %T", "Buy Help", LANG_SERVER);
  588. PrintToChat(client,"\x01\x04[SM Parachute]\x01 %T", "Sell Help", LANG_SERVER);
  589. }
  590. }
  591. return Plugin_Continue;
  592. }
  593.  
  594.  
  595. public CvarChange_Enabled(Handle:cvar, const String:oldvalue[], const String:newvalue[]){
  596. if (StringToInt(newvalue) == 0){
  597. for (new client = 1; client <= g_maxplayers; client++){
  598. if (IsClientInGame(client) && IsPlayerAlive(client)){
  599. if (hasPara[client]){
  600. SetEntityGravity(client,1.0);
  601. SetEntityMoveType(client,MOVETYPE_WALK);
  602. SellParachuteOff(client,GetConVarInt(g_cost));
  603. }
  604. PrintToChat(client,"\x01\x04[SM Parachute]\x01 %T", "Disabled", LANG_SERVER);
  605. }
  606. }
  607. }
  608. else{
  609. for (new client = 1; client <= g_maxplayers; client++){
  610. if (IsClientInGame(client) && IsPlayerAlive(client)){
  611. PrintToChat(client,"\x01\x04[SM Parachute]\x01 %T", "Enabled", LANG_SERVER);
  612. if (GetConVarInt(g_cost)==0){
  613. PrintToChat(client,"\x01\x04[SM Parachute]\x01 %T", "Parachute For Everyone", LANG_SERVER);
  614. }
  615. else{
  616. PrintToChat(client,"\x01\x04[SM Parachute]\x01 %T", "Buy Help", LANG_SERVER);
  617. PrintToChat(client,"\x01\x04[SM Parachute]\x01 %T", "Sell Help", LANG_SERVER);
  618. }
  619. }
  620. }
  621. }
  622. }
  623.  
  624. public CvarChange_Linear(Handle:cvar, const String:oldvalue[], const String:newvalue[]){
  625. if (StringToInt(newvalue) == 0){
  626. for (new client = 1; client <= g_maxplayers; client++){
  627. if (IsClientInGame(client) && IsPlayerAlive(client) && hasPara[client]){
  628. SetEntityMoveType(client,MOVETYPE_WALK);
  629. }
  630. }
  631. }
  632. }
  633.  
  634. public CvarChange_Cost(Handle:cvar, const String:oldvalue[], const String:newvalue[]){
  635. if (StringToInt(newvalue) == 0){
  636. for (new client = 1; client <= g_maxplayers; client++){
  637. if (IsClientInGame(client) && IsPlayerAlive(client)){
  638. if (hasPara[client]) SellParachuteOff(client,StringToInt(oldvalue));
  639. PrintToChat(client,"\x01\x04[SM Parachute]\x01 %T", "Parachute For Everyone", LANG_SERVER);
  640. }
  641. }
  642. }
  643. else{
  644. if (strcmp(g_game,"cstrike",false) != 0) SetConVarInt(g_cost,0);
  645. }
  646. }
  647.  
  648. public CvarChange_Button(Handle:cvar, const String:oldvalue[], const String:newvalue[]){
  649. if (StringToInt(newvalue) == 1){
  650. SetButton(1);
  651. }
  652. else if(StringToInt(newvalue) == 2){
  653. SetButton(2);
  654. }
  655. }
  656.  
  657. public CvarChange_Model(Handle:cvar, const String:oldvalue[], const String:newvalue[]){
  658. if (StringToInt(newvalue) == 0){
  659. for (new client = 1; client <= g_maxplayers; client++){
  660. if (IsClientInGame(client) && IsPlayerAlive(client)){
  661. CloseParachute(client);
  662. }
  663. }
  664. }
  665. }
  666.  
  667. public SellParachuteOff(client,cost){
  668. new money;
  669. new Float:payback;
  670. new String:pb[10];
  671. if (g_iMoney == -1) return;
  672. if (hasPara[client] == true){
  673. money = GetEntData(client,g_iMoney);
  674. payback = cost*(GetConVarFloat(g_payback)/100);
  675. if ((money + payback) > 16000){
  676. SetEntData(client,g_iMoney,16000);
  677. }
  678. else{
  679. FloatToString(payback,pb,9);
  680. SetEntData(client,g_iMoney,money+StringToInt(pb));
  681. }
  682. hasPara[client] = false;
  683. }
  684. }
  685.  
  686. public SetButton(button){
  687. if (button == 1){
  688. USE_BUTTON = IN_USE;
  689. ButtonText = "E";
  690. }
  691. else if(button == 2){
  692. USE_BUTTON = IN_JUMP;
  693. ButtonText = "Space";
  694. }
  695. }
  696.