Jump to content

A music player


Dustymetro

Recommended Posts

Can anyone please gimme a music player or something

like i write 

/play [mp3.link] 

it will play

and if i write play again it will stop

I just want a player which allows me to play my songs thanks in advnace

it should be heard by everyone

and only admins can play it

dont gimme a script or something i am very new .. gimme a zip file like how we get in the community 

sorry for demanding so much :P

Edited by Dustymetro
Link to post

I don't think you will find someone that will make your script.

Also this kind of scripts is present in the community. I also searched and found something, just the first i found of many nice scripts.

Most script are not compiled, so you can see how they did what they wanted to: basically i'm telling you to learn how to script in LUA and create your own resources, it's faster than writing in the forum most of the time! It will solve a lot of your problems, and you will not fully depend on other scripters. The above script, if i'm right, gives to all the players the command, and not only admins: this something you can do to start scripting. The "structure" of the scripts can be easily learned even from the existing script itself, or from the LUA tutorials and manuals online. For MTA specific function there's the wiki. Here you will be able to find every function that you can use to manipulate the game.

I know this is not exactly what you were asking for (an already completed script) but this way it will be much easier for you in the future. Hope you understand and good scripting! Obviously for every doubt we are still here!

Edited by LoPollo
Link to post

Hello, i am new in this world.. But i believe i can help you:

Well, so i'll try explain some things.. as you do know MTA is client-server, so your need to make this system use both sides, why? playSound3D is a function a client side and your need access to that from the server side..

Example, this is a command in server side:

addCommandHandler("play", function(player, cmd, ...)
	if(getElementData(player, "players:admin") == true) then
		if(getElementData(player, "playing") == true) then
			triggerClientEvent(root, "client:stopSound", root);

			setElementData(player, "playing", false);

			outputChatBox("Sound stopped!", player);
		else
			local url = table.concat({...}, " ");
			local x, y, z = getElementPosition(player);

			triggerClientEvent(root, "client:playSound", root, x, y, z, url);
			
			setElementData(player, "playing", true);

			outputChatBox("You're listening: " .. url, player);
		end
	end
end);

and put this in client-side

addEvent("client:playSound", true)
addEventHandler("client:playSound", root, function (x, y, z, ...)
	local url = table.concat({...}, " ");

	clientSpeaker = playSound3D(url, x, y, z);
end)

addEvent("client:stopSound", true)
addEventHandler("client:stopSound", root, function ()
	stopSound(clientSpeaker)
end)

you only need change getElementData(player, "players:admin") for your admin variable or change for your function, etc.. if you have any question, do it.

Edited by Chainsaw
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...