Jokeℝ1472771893 Posted October 27, 2012 Share Posted October 27, 2012 function createSpeaker(thePlayer) local x, y, z = getElementPosition(thePlayer) speakerObject = createObject(2229, x, y, z-1) outputChatBox("You have Succesfully created a speaker!", thePlayer, 0, 250, 0) if (isPedInVehicle(thePlayer)) then local vehicle = getPedOccupiedVehicle(thePlayer) attachElements(speakerObject, vehicle) triggerClientEvent(root, "playTheSound", root, x, y, z, vehicle) else triggerClientEvent(root, "playTheSound", root, x, y, z) end end addCommandHandler("ps", createSpeaker) function deleteSpeaker(thePlayer) if (isElement(speakerObject)) then destroyElement(speakerObject) outputChatBox("You have Succesfully destroyed the Speaker!", thePlayer, 0, 0, 255) triggerClientEvent("stopTheSound", root) else outputChatBox("Speaker is not created!", thePlayer, 250, 0, 0) end end addCommandHandler("ds", deleteSpeaker) how to make this commands only for Admins? Link to comment
myonlake Posted October 27, 2012 Share Posted October 27, 2012 If you want to check all that on server-side, then only use these. Server-side isObjectInACLGroup getPlayerAccount getAccountName But if you also want to check it client-side, then use these. Server-side isObjectInACLGroup getPlayerAccount getAccountName getElementData Client-side getElementData Link to comment
TAPL Posted October 27, 2012 Share Posted October 27, 2012 Haven't you learn this part yet? You already got a script with such thing before, you must learn it. https://forum.multitheftauto.com/viewtopic.php?f=91&t=48686 Link to comment
Jokeℝ1472771893 Posted October 27, 2012 Author Share Posted October 27, 2012 Haven't you learn this part yet?You already got a script with such thing before, you must learn it. https://forum.multitheftauto.com/viewtopic.php?f=91&t=48686 that's true i did same but nothing. Link to comment
TAPL Posted October 27, 2012 Share Posted October 27, 2012 Haven't you learn this part yet?You already got a script with such thing before, you must learn it. https://forum.multitheftauto.com/viewtopic.php?f=91&t=48686 that's true i did same but nothing. Post the code. Link to comment
Jokeℝ1472771893 Posted October 27, 2012 Author Share Posted October 27, 2012 ok i will post it but don't laugh on me i try to put it in all lines function createSpeaker(thePlayer) local x, y, z = getElementPosition(thePlayer) speakerObject = createObject(2229, x, y, z-1) local acc = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then outputChatBox("You have Succesfully created a speaker!", thePlayer, 0, 250, 0) if (isPedInVehicle(thePlayer)) then local vehicle = getPedOccupiedVehicle(thePlayer) attachElements(speakerObject, vehicle) triggerClientEvent(root, "playTheSound", root, x, y, z, vehicle) else triggerClientEvent(root, "playTheSound", root, x, y, z) end end addCommandHandler("ps", createSpeaker) function deleteSpeaker(thePlayer) if (isElement(speakerObject)) then destroyElement(speakerObject) outputChatBox("You have Succesfully destroyed the Speaker!", thePlayer, 0, 0, 255) triggerClientEvent("stopTheSound", root) else outputChatBox("Speaker is not created!", thePlayer, 250, 0, 0) end end addCommandHandler("ds", deleteSpeaker) Link to comment
AhmadQTR Posted October 28, 2012 Share Posted October 28, 2012 (edited) ok i will post it but don't laugh on me i try to put it in all lines function createSpeaker(thePlayer) local x, y, z = getElementPosition(thePlayer) speakerObject = createObject(2229, x, y, z-1) local acc = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then outputChatBox("You have Succesfully created a speaker!", thePlayer, 0, 250, 0) if (isPedInVehicle(thePlayer)) then local vehicle = getPedOccupiedVehicle(thePlayer) attachElements(speakerObject, vehicle) triggerClientEvent(root, "playTheSound", root, x, y, z, vehicle) else triggerClientEvent(root, "playTheSound", root, x, y, z) end end addCommandHandler("ps", createSpeaker) function deleteSpeaker(thePlayer) if (isElement(speakerObject)) then destroyElement(speakerObject) outputChatBox("You have Succesfully destroyed the Speaker!", thePlayer, 0, 0, 255) triggerClientEvent("stopTheSound", root) else outputChatBox("Speaker is not created!", thePlayer, 250, 0, 0) end end addCommandHandler("ds", deleteSpeaker) What errors do you have? EDIT : You forgot to add "end" for function createSpeaker Edited October 28, 2012 by Guest Link to comment
TAPL Posted October 28, 2012 Share Posted October 28, 2012 line 4 change player to thePlayer. Link to comment
Jokeℝ1472771893 Posted October 28, 2012 Author Share Posted October 28, 2012 function createSpeaker(thePlayer) local x, y, z = getElementPosition(thePlayer) speakerObject = createObject(2229, x, y, z-1) local acc = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then outputChatBox("You have Succesfully created a speaker!", thePlayer, 0, 250, 0) if (isPedInVehicle(thePlayer)) then local vehicle = getPedOccupiedVehicle(thePlayer) attachElements(speakerObject, vehicle) triggerClientEvent(root, "playTheSound", root, x, y, z, vehicle) else triggerClientEvent(root, "playTheSound", root, x, y, z) end end addCommandHandler("ps", createSpeaker) function deleteSpeaker(thePlayer) if (isElement(speakerObject)) then destroyElement(speakerObject) outputChatBox("You have Succesfully destroyed the Speaker!", thePlayer, 0, 0, 255) triggerClientEvent("stopTheSound", root) else outputChatBox("Speaker is not created!", thePlayer, 250, 0, 0) end end addCommandHandler("ds", deleteSpeaker) like this? Link to comment
TAPL Posted October 28, 2012 Share Posted October 28, 2012 You missed "end" in function createSpeaker. Link to comment
Jokeℝ1472771893 Posted October 28, 2012 Author Share Posted October 28, 2012 in what line? Link to comment
AhmadQTR Posted October 28, 2012 Share Posted October 28, 2012 in what line? function createSpeaker(thePlayer) local x, y, z = getElementPosition(thePlayer) speakerObject = createObject(2229, x, y, z-1) local acc = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then outputChatBox("You have Succesfully created a speaker!", thePlayer, 0, 250, 0) if (isPedInVehicle(thePlayer)) then local vehicle = getPedOccupiedVehicle(thePlayer) attachElements(speakerObject, vehicle) triggerClientEvent(root, "playTheSound", root, x, y, z, vehicle) else triggerClientEvent(root, "playTheSound", root, x, y, z) end end end addCommandHandler("ps", createSpeaker) function deleteSpeaker(thePlayer) if (isElement(speakerObject)) then destroyElement(speakerObject) outputChatBox("You have Succesfully destroyed the Speaker!", thePlayer, 0, 0, 255) triggerClientEvent("stopTheSound", root) else outputChatBox("Speaker is not created!", thePlayer, 250, 0, 0) end end addCommandHandler("ds", deleteSpeaker) added it for you Link to comment
Jokeℝ1472771893 Posted October 28, 2012 Author Share Posted October 28, 2012 it can make all ppl but only Admins can hear it. so how to fix it? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now