Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
ani-gtascripter

Head-phone mod

Recommended Posts

ani-gtascripter

Hey guys, I am making a head-phone mod but there is a problem in it!

Will anyone tell me how to solve the error?

The error it shows is "file not found"!

Here is the code....

 

 

using GTA;
using GTA.Native;
using System;
using System.IO;
using System.Windows.Forms;
namespace Headphone_mod
{
public class Head_phone_mod : Script
{
private GTA.Object headphone;
private bool enable;
private System.Media.SoundPlayer music01;
private System.Media.SoundPlayer music02;
private System.Media.SoundPlayer music03;
public Head_phone_mod()
{
base.KeyDown += new GTA.KeyEventHandler(this.keydown);
base.KeyUp += new GTA.KeyEventHandler(this.keyup);
this.enable = false;
music01 = new System.Media.SoundPlayer();
music01.SoundLocation = ".\\scrripts\\head-phone\\music01.wav";
music01.Load();
music02 = new System.Media.SoundPlayer();
music02.SoundLocation = ".\\scrripts\\head-phone\\music02.wav";
music02.Load();
music03 = new System.Media.SoundPlayer();
music03.SoundLocation = ".\\scrripts\\head-phone\\music03.wav";
music03.Load();
}
public void keydown(object sender, GTA.KeyEventArgs e)
{
if (e.Key == Keys.Alt)
{
if (this.enable == true)
{
this.enable = false;
}
else
{
this.enable = true;
this.headphone = World.CreateObject("HEADPHONE", Player.Character.Position.Around(4f));
GTA.Native.Function.Call("ATTACH_OBJECT_TO_PED", this.headphone, 0x4B5, 0f, 0f, 0f, 0f, 1f, 0f);
}
if (e.Key == Keys.F1)
{
if (this.enable == true)
{
Game.DisplayText("Playing first song from the playlist.", 20);
music01.Play();
}
else
{
Game.DisplayText("Head-Phone mod is Disabled. Press Alt to Enable it.", 20);
}
}
if (e.Key == Keys.F2)
{
if (this.enable == true)
{
Game.DisplayText("Playing second song from the playlist.", 20);
music02.Play();
}
else
{
Game.DisplayText("Head-Phone mod is Disabled. Press Alt to Enable it.", 20);
}
}
if (e.Key == Keys.F3)
{
if (this.enable == true)
{
Game.DisplayText("Playing third song from the playlist.", 20);
music03.Play();
}
else
{
Game.DisplayText("Head-Phone mod is Disabled. Press Alt to Enable it.", 20);
}
}
}
}
public void keyup(object sender, GTA.KeyEventArgs a)
{
}
}
}
Edited by ani-gtascripter

Share this post


Link to post
Share on other sites
nyolc8

scrripts? scripts :)

Share this post


Link to post
Share on other sites
ani-gtascripter

scrripts? scripts :)

I did not understand what you ment!

:panic:

Share this post


Link to post
Share on other sites
Rugz007

He says the path is not correct

It's not scrripts dumbass first check the code then ask questions! Lock down topic

Share this post


Link to post
Share on other sites
ani-gtascripter

He says the path is not correct

It's not scrripts dumbass first check the code then ask questions! Lock down topic

What's the problem with the script?

I think it is correct, got my bug!

Its really the location problem, I changed the location and now it does not shows the error.

Share this post


Link to post
Share on other sites
nyolc8

 

He says the path is not correct

It's not scrripts dumbass first check the code then ask questions! Lock down topic

What's the problem with the script?

I think it is correct, got my bug!

Its really the location problem, I changed the location and now it does not shows the error.

 

That was what I meant... you misspelled scripts in the path and you wrote "scrripts" instead of "scripts".

Share this post


Link to post
Share on other sites
ani-gtascripter
That was what I meant... you misspelled scripts in the path and you wrote "scrripts" instead of "scripts".

 

Yes, thanks for that!

Share this post


Link to post
Share on other sites
ani-gtascripter

Well okay, the code I messaged yesterday is updated!

In the new code you can play .mp3 sounds too!Here it is!

 

using GTA;
using GTA.Native;
using System;
using System.IO;
using System.Windows.Forms;
using WMPLib;
using System.Media;
using System.IO;
namespace Headphone_mod
{
public class Head_phone_mod : Script
{
private GTA.Object headphone;
private bool enable;
public Head_phone_mod()
{
base.KeyDown += new GTA.KeyEventHandler(this.keydown);
base.KeyUp += new GTA.KeyEventHandler(this.keyup);
this.enable = false;
}
public void keydown(object sender, GTA.KeyEventArgs e)
{
if (e.Key == Keys.Alt)
{
if (this.enable == true)
{
this.enable = false;
}
else
{
this.enable = true;
this.headphone = World.CreateObject("HEADPHONE", this.Player.Character.Position.Around(4f));
GTA.Native.Function.Call("ATTACH_OBJECT_TO_PED", this.headphone, 0x4B5, 0f, 0f, 0f, 0f, 1f, 0f);
}
if (e.Key == Keys.F1)
{
if (this.enable == true)
{
Game.DisplayText("Playing first song from the playlist.", 20);
WMPLib.WindowsMediaPlayer song01 = new WindowsMediaPlayer();
song01.URL = @"C:\\GTA IV music\\song01.mp3";
song01.controls.play();
}
else
{
Game.DisplayText("Head-Phone mod is Disabled. Press Alt to Enable it.", 20);
}
}
if (e.Key == Keys.F2)
{
if (this.enable == true)
{
Game.DisplayText("Playing second song from the playlist.", 20);
WMPLib.WindowsMediaPlayer song02 = new WindowsMediaPlayer();
song02.URL = @"C:\\GTA IV music\\song01.mp3";
song02.controls.play();
}
else
{
Game.DisplayText("Head-Phone mod is Disabled. Press Alt to Enable it.", 20);
}
}
if (e.Key == Keys.F3)
{
song03.controls.play();
if (this.enable == true)
{
Game.DisplayText("Playing third song from the playlist.", 20);
WMPLib.WindowsMediaPlayer song03 = new WindowsMediaPlayer();
song03.URL = "C:\\GTA IV music\\song01.mp3";
}
else
{
Game.DisplayText("Head-Phone mod is Disabled. Press Alt to Enable it.", 20);
}
}
}
}
public void keyup(object sender, GTA.KeyEventArgs a)
{
}
}
}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.